Skip to content

feat(schema): introduce Producer node and route ASYNC_CALLS through it#159

Merged
HumanBean17 merged 4 commits into
masterfrom
feat/schema-v2-producer-async-calls
May 16, 2026
Merged

feat(schema): introduce Producer node and route ASYNC_CALLS through it#159
HumanBean17 merged 4 commits into
masterfrom
feat/schema-v2-producer-async-calls

Conversation

@HumanBean17
Copy link
Copy Markdown
Owner

Summary

  • Adds Producer node, DECLARES_PRODUCER, and flips ASYNC_CALLS to Producer → Route (ontology 14 unchanged; full reprocess still required for v14 graph shape).
  • Materializes producers in pass5 (AsyncCallRow.producer_id), emits edges in pass6/write; GraphMeta gains producers_total / declares_producer_total / producers_by_kind.
  • Downstream: two-hop async in find_route_callers, trace_request_flow, impact expansion, pr_analysis; MCP find(kind="producer") / resolve(hint_kind="producer"); type-level describe rollups DECLARES.DECLARES_PRODUCER and OVERRIDDEN_BY.DECLARES_PRODUCER.
  • Regenerated docs/EDGE-NAVIGATION.md (11 edges). PR-D (hints v3) is next — not in this PR.

ASYNC_CALLS / Producer grep (this PR’s *.py / *.md deltas)

Area Accounting
build_ast_graph.py Producer DDL/rows, DECLARES_PRODUCER, ASYNC_CALLS FROM Producer, pass5 materialization, pass6 via producer_id, GraphMeta counters
java_ontology.py DECLARES_PRODUCER + ASYNC_CALLS src=Producer; post-flip traversals
kuzu_queries.py Two-hop async queries; list_producers; RouteCaller producer branch (topic/broker)
mcp_v2.py / server.py producer kind on find/resolve/neighbors schema; no mcp_hints.py
pr_analysis.py Cross-service async reachability two-hop
Tests All 12 Tests for PR-C from plans/PLAN-SCHEMA-V2.md
Docs README, AGENT-GUIDE, exploration skill, EDGE-NAVIGATION

Sentinel checks (zero on diff): no TPL_NEIGHBORS_WRONG_SUBJECT_KIND / neighbors_empty_hints implementation; no Symbol)-[e:ASYNC_CALLS] in production emit/query paths; no ONTOLOGY_VERSION = 15.

Test plan

  • .venv/bin/ruff check build_ast_graph.py kuzu_queries.py mcp_v2.py
  • .venv/bin/python -m pytest tests/test_call_edges_e2e.py tests/test_brownfield_clients.py tests/test_mcp_v2.py tests/test_ast_graph_build.py -v
  • rm -rf /tmp/schema-v2-c && .venv/bin/python build_ast_graph.py --source-root tests/fixtures/http_caller_smoke --kuzu-path /tmp/schema-v2-c --verbose
  • .venv/bin/ruff check .
  • PATH=".venv/bin:$PATH" .venv/bin/python -m pytest tests -v (550 passed, 10 skipped)

Made with Cursor

Add Producer/DECLARES_PRODUCER, flip ASYNC_CALLS to Producer→Route,
wire GraphMeta counters, kuzu two-hop async queries, MCP find/resolve
producer parity, describe rollups, and PR-C tests (ontology 14 unchanged).

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link
Copy Markdown
Owner Author

@HumanBean17 HumanBean17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review summary

Solid, plan-aligned PR-C implementation. Schema flip (Producer + DECLARES_PRODUCER + ASYNC_CALLS: Producer → Route), pass5 materialization, downstream two-hop queries, MCP find/resolve, and describe rollups all match plans/PLAN-SCHEMA-V2.md. Assuming tests are green, this is approve with minor follow-ups.


What looks good

  • End-to-end wiring in build_ast_graph.py, java_ontology.py, and regenerated docs/EDGE-NAVIGATION.md (11 edges); DDL ↔ EDGE_SCHEMA stays consistent.
  • Pass5 mirrors Client: materialize Producer → DECLARES_PRODUCERASYNC_CALLS, sensible dedup keys, GraphMeta producer counters.
  • Downstream updated: find_route_callers, trace_request_flow, impact expansion, pr_analysis all use two-hop async; RouteCaller adds caller_node_kind="producer" with topic/broker.
  • MCP parity: find(kind="producer"), resolve(hint_kind="producer"), type rollups (DECLARES.DECLARES_PRODUCER, OVERRIDDEN_BY.DECLARES_PRODUCER).
  • Plan sentinels respected (ontology 14 unchanged; no Symbol)-[e:ASYNC_CALLS] in production paths).

Should fix before or right after merge

1. MCP tool descriptions still describe a 3-kind world

Literal types were extended, but several LLM-facing strings in server.py were not:

  • _INSTRUCTIONS: resolve still “symbol/route/client”
  • find kind description: no producer
  • resolve hint_kind: still “all three kinds”
  • describe id help: no p: / producer prefix
  • neighbors ids help: still symbol/route/client only

These are part of the MCP contract for tool selection — worth updating in this PR or an immediate follow-up.

2. Pass6 async rematch hardcodes client_kind="kafka_send"

HTTP pass6 reconstructs kind from the Client row; async pass6 always uses kafka_send when rebuilding OutgoingCallDecl for matching. For stream_bridge_send producers, pass6 can diverge from pass5 (producer.producer_kind is on ProducerRow). Suggest using producer.producer_kind when producer is present.

3. docs/AGENT-GUIDE.md banner

Still says “PR-C adds Producer…” in future tense — update to present tense post-merge.


Minor / optional

  • _resolve_producer_candidates reuses client_target / client_target_path ResolveReason values for topic lookup — works, but misleading for agents reading reason.
  • _producer_id omits broker from the hash key; two call sites with same topic + different brokers collapse to one Producer — confirm intentional or add broker to the key.
  • producers_total is on GraphMeta and in counts_json, but not on GraphMetaOutput / KuzuGraph.meta() top-level return (plan said “if applicable”) — optional polish.

Expected breaking change (documented)

Agents must not use neighbors(method_id, out, ["ASYNC_CALLS"]) anymore; traverse DECLARES_PRODUCER then ASYNC_CALLS. Docs/skills updated; runtime hints deferred to PR-D as scoped.


Recommendation: Approve; address MCP description strings and pass6 producer_kind in this PR or a tiny immediate follow-up.

HumanBean17 and others added 3 commits May 16, 2026 20:13
Update server tool descriptions for the four-kind graph surface; use
ProducerRow.producer_kind in pass6 async rematch; fix AGENT-GUIDE v14 banner tense.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use p:<hash> in describe id help; add producer_topic resolve reasons;
document topic-level _producer_id; lock pass6 async_kind via stream_bridge test.

Co-authored-by: Cursor <cursoragent@cursor.com>
Relocate SCHEMA-V2-PROPOSE, PLAN-SCHEMA-V2, and CURSOR-PROMPTS-SCHEMA-V2;
update cross-links and PROPOSES-ORDER (PR-D remains under HINTS-V3).

Co-authored-by: Cursor <cursoragent@cursor.com>
@HumanBean17 HumanBean17 merged commit 5202305 into master May 16, 2026
1 check passed
@HumanBean17 HumanBean17 deleted the feat/schema-v2-producer-async-calls branch May 23, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant