Skip to content

Commit a42200a

Browse files
add plan and cursor prompts for schema v2
Implements the SCHEMA-V2 propose merge gate with a four-PR rollout (EDGE_SCHEMA, HTTP/ASYNC endpoint flips, Producer node, hints v3) and per-PR execution contracts. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 1e1167b commit a42200a

2 files changed

Lines changed: 773 additions & 0 deletions

File tree

plans/CURSOR-PROMPTS-SCHEMA-V2.md

Lines changed: 269 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
# Cursor task prompts — SCHEMA-V2 (PR-A → PR-D)
2+
3+
Per-PR delegation prompts derived from
4+
[`plans/PLAN-SCHEMA-V2.md`](./PLAN-SCHEMA-V2.md). Each section is one hand-off —
5+
copy the block for the PR you are implementing.
6+
7+
**Landing order:** **A → B → C → D**. Do not start the next PR until the prior one
8+
is merged to `master`.
9+
10+
**Merge gate (Decision 29):** This file and `PLAN-SCHEMA-V2.md` must exist on
11+
`master` before **PR-A** code merges.
12+
13+
**Common rules for all prompts:**
14+
15+
- The plan is the source of truth. If this prompt and
16+
[`plans/PLAN-SCHEMA-V2.md`](./PLAN-SCHEMA-V2.md) disagree, the plan wins.
17+
- Do **not** modify files outside the deliverables list. Sentinel greps in each
18+
prompt must return **zero** on `git diff master..HEAD` for forbidden patterns.
19+
- No backward-compat shims (`CallerInfo` alias, dual edges, v13 soft-migration).
20+
- Use `.venv/bin/python` and `.venv/bin/ruff` only.
21+
- Run `.venv/bin/ruff check .` and `.venv/bin/python -m pytest tests -v` before
22+
opening the PR (heavy tests optional unless you touch indexer e2e).
23+
- PR description must include: scope sentence, manual evidence (exact command from
24+
prompt), link to plan section, grep enumeration (PR-B/C), re-index callout.
25+
- Do not push from the agent; you handle `git push` and `gh pr create`.
26+
27+
---
28+
29+
## PR-A — `EDGE_SCHEMA` + doc generator + ontology v14 (no DDL flips)
30+
31+
**Branch:** `feat/schema-v2-edge-schema` off latest `master`
32+
**Plan section:** [`plans/PLAN-SCHEMA-V2.md` § PR-A](./PLAN-SCHEMA-V2.md#pr-a--edge_schema--doc-generator--ontology-v14-no-ddl-flips)
33+
**Propose:** [`propose/SCHEMA-V2-PROPOSE.md`](../propose/SCHEMA-V2-PROPOSE.md) §6 PR-A
34+
35+
### Scope
36+
37+
Implement PR-A only: schema infrastructure + `ONTOLOGY_VERSION` 14 + generated docs.
38+
**Do not** flip `HTTP_CALLS` / `ASYNC_CALLS` endpoints or add `Producer` DDL.
39+
40+
### Out of scope (do NOT touch)
41+
42+
- `build_ast_graph.py` rel endpoint changes (`FROM Client`, `Producer` table).
43+
- `HttpCallRow` / `pass5` / `pass6` behaviour.
44+
- `kuzu_queries.find_route_callers`, `trace_request_flow`, `pr_analysis` Cypher.
45+
- `mcp_v2.py` / `server.py` tool surfaces (except if a test import requires none).
46+
- `mcp_hints.py` hints v3 templates.
47+
- `propose/HINTS-V3-PROPOSE.md` (does not exist yet).
48+
49+
**Sentinel (must be zero on diff):**
50+
51+
```bash
52+
git diff master..HEAD | grep -E 'FROM Client TO Route|FROM Producer TO Route|DECLARES_PRODUCER|ProducerRow|RouteCaller'
53+
```
54+
55+
### Deliverables
56+
57+
See plan § PR-A file list. Headline:
58+
59+
1. `java_ontology.py``EdgeAttr`, `EdgeSpec`, `EDGE_SCHEMA` (10 edges, **current**
60+
Symbol→Route for HTTP/ASYNC), `BROWNFIELD_RESOLVER_STRATEGY_SET`.
61+
2. `scripts/generate_edge_navigation.py` + committed `docs/EDGE-NAVIGATION.md`.
62+
3. `tests/test_schema_consistency.py`, `tests/test_edge_navigation_doc.py`.
63+
4. `ast_java.py``ONTOLOGY_VERSION = 14`.
64+
5. `README.md`, `docs/AGENT-GUIDE.md` — version **14** + re-index note (shape changes in B/C).
65+
6. `build_ast_graph.py` — export DDL tuple for tests only (no endpoint edits).
66+
67+
### Tests (verbatim names)
68+
69+
- `test_schema_ddl_endpoints_match_edge_schema_*` (all 10 edges)
70+
- `test_edge_navigation_doc_matches_generator_output`
71+
- `test_generate_edge_navigation_check_detects_drift`
72+
- `test_kuzu_graph_get_raises_when_graph_ontology_too_old`
73+
74+
### Manual evidence (paste in PR description)
75+
76+
```bash
77+
.venv/bin/python scripts/generate_edge_navigation.py --check
78+
.venv/bin/ruff check .
79+
.venv/bin/python -m pytest tests/test_schema_consistency.py tests/test_edge_navigation_doc.py tests/test_kuzu_queries.py::test_kuzu_graph_get_raises_when_graph_ontology_too_old -v
80+
python -c "from java_ontology import EDGE_SCHEMA; from ast_java import ONTOLOGY_VERSION; assert ONTOLOGY_VERSION==14; assert len(EDGE_SCHEMA)==10; assert EDGE_SCHEMA['HTTP_CALLS'].src=='Symbol'"
81+
```
82+
83+
### PR title
84+
85+
`feat(schema): add EDGE_SCHEMA, edge navigation doc generator, bump ontology to v14`
86+
87+
---
88+
89+
## PR-B — flip `HTTP_CALLS` to `Client → Route`
90+
91+
**Branch:** `feat/schema-v2-http-calls-client-origin` off latest `master` (post PR-A)
92+
**Plan section:** [`plans/PLAN-SCHEMA-V2.md` § PR-B](./PLAN-SCHEMA-V2.md#pr-b--flip-http_calls-to-client--route)
93+
**Propose:** [`propose/SCHEMA-V2-PROPOSE.md`](../propose/SCHEMA-V2-PROPOSE.md) §6 PR-B
94+
95+
### Scope
96+
97+
Flip HTTP caller edges and all HTTP downstream traversals/APIs. Async may remain
98+
one-hop `Symbol-[:ASYNC_CALLS]` until PR-C; document if `trace_request_flow` is
99+
HTTP-only two-hop in this PR.
100+
101+
### Out of scope (do NOT touch)
102+
103+
- `Producer` node, `DECLARES_PRODUCER`, `ASYNC_CALLS` endpoint flip.
104+
- `find(kind="producer")`, `resolve(hint_kind="producer")`.
105+
- Hints v3 / `EDGE_SCHEMA`-driven neighbor templates (PR-D).
106+
- `GraphMeta` `producers_total` counters.
107+
108+
**Sentinel (must be zero on diff):**
109+
110+
```bash
111+
git diff master..HEAD | grep -E 'MATCH \(s:Symbol\)-\[:HTTP_CALLS\]|symbol_id=member\.node_id|HttpCallRow\([^)]*symbol_id|FROM Producer TO Route|DECLARES_PRODUCER'
112+
```
113+
114+
### Deliverables
115+
116+
See plan § PR-B. Headline:
117+
118+
1. `EDGE_SCHEMA["HTTP_CALLS"]``Client`/`Route`; regen `docs/EDGE-NAVIGATION.md`.
119+
2. `build_ast_graph.py` — DDL, `HttpCallRow.client_id`, pass5/6, `_CREATE_HTTP_CALL`.
120+
3. `kuzu_queries.py``RouteCaller`, `find_route_callers`, trace inbound HTTP, impact HTTP.
121+
4. `pr_analysis.py` — two-hop HTTP.
122+
5. MCP/doc/test updates per plan; **grep enumeration required** (below).
123+
124+
### Grep enumeration (mandatory in PR description)
125+
126+
```bash
127+
grep -rn 'HTTP_CALLS\|ASYNC_CALLS' --include='*.py' --include='*.md' .
128+
```
129+
130+
Account for **every** line: changed, unchanged with justification, or N/A.
131+
132+
### Tests (minimum set — add others if plan lists more)
133+
134+
- `test_neighbors_client_outbound_http_calls_returns_routes`
135+
- `test_two_http_clients_on_one_method_produce_two_edges`
136+
- `test_unresolved_client_has_no_http_calls_out_edge`
137+
- `test_cross_service_http_trace_four_hop`
138+
- `test_pr_analysis_finds_routes_via_declares_client`
139+
- `test_find_route_callers_returns_route_caller_with_client_node_id`
140+
- `test_trace_request_flow_inbound_includes_caller_node_id`
141+
- `test_schema_ddl_endpoints_match_edge_schema_http_calls`
142+
143+
### Manual evidence
144+
145+
```bash
146+
rm -rf /tmp/schema-v2-http && .venv/bin/python build_ast_graph.py \
147+
--source-root tests/fixtures/http_caller_smoke \
148+
--kuzu-path /tmp/schema-v2-http/code_graph.kuzu --verbose 2>/dev/null | tail -5
149+
.venv/bin/python -c "
150+
import kuzu
151+
db=kuzu.Database('/tmp/schema-v2-http/code_graph.kuzu')
152+
c=kuzu.Connection(db)
153+
r=c.execute('MATCH (c:Client)-[e:HTTP_CALLS]->() RETURN count(e) AS n').get_as_df()
154+
assert int(r['n'][0])>0, r
155+
print('HTTP_CALLS from Client OK', r['n'][0])
156+
"
157+
.venv/bin/python -m pytest tests/test_call_edges_e2e.py tests/test_kuzu_queries.py tests/test_pr_analysis.py tests/test_brownfield_clients.py -v -k 'http or route_caller or declares_client' --tb=short
158+
```
159+
160+
### PR title
161+
162+
`feat(schema): HTTP_CALLS originates from Client, not Symbol`
163+
164+
---
165+
166+
## PR-C — Producer node + `DECLARES_PRODUCER` + flip `ASYNC_CALLS`
167+
168+
**Branch:** `feat/schema-v2-producer-async-calls` off latest `master` (post PR-B)
169+
**Plan section:** [`plans/PLAN-SCHEMA-V2.md` § PR-C](./PLAN-SCHEMA-V2.md#pr-c--producer-node--declares_producer--flip-async_calls)
170+
**Propose:** [`propose/SCHEMA-V2-PROPOSE.md`](../propose/SCHEMA-V2-PROPOSE.md) §6 PR-C
171+
172+
### Scope
173+
174+
Producer node, async edge flip, GraphMeta, MCP producer parity, describe rollups,
175+
async doc sweep. Complete any deferred async two-hop from PR-B (`trace_request_flow`,
176+
impact, `find_route_callers` async).
177+
178+
### Out of scope (do NOT touch)
179+
180+
- Hints v3 EDGE_SCHEMA templates (PR-D).
181+
- `Consumer` node.
182+
- Composed `DECLARES.HTTP_CALLS` / `DECLARES.ASYNC_CALLS` describe rollups.
183+
184+
**Sentinel (must be zero on diff):**
185+
186+
```bash
187+
git diff master..HEAD | grep -E 'MATCH \(s:Symbol\)-\[:ASYNC_CALLS\]|AsyncCallRow\([^)]*symbol_id|FROM Symbol TO Route.*ASYNC_CALLS|CallerInfo'
188+
```
189+
190+
### Deliverables
191+
192+
See plan § PR-C. Headline:
193+
194+
1. Producer DDL + pass5 materialization + `DECLARES_PRODUCER` + `ASYNC_CALLS` flip.
195+
2. `EDGE_SCHEMA` entries 11; regen docs.
196+
3. `GraphMeta` `producers_total`, `declares_producer_total`.
197+
4. `mcp_v2` / `server``find`/`resolve` producer; `EdgeType` `DECLARES_PRODUCER`.
198+
5. Describe rollups + `pr_analysis` async two-hop.
199+
6. Async grep enumeration (same command as PR-B).
200+
201+
### Tests (minimum set)
202+
203+
- `test_neighbors_method_out_declares_producer_then_async_calls`
204+
- `test_route_inbound_async_callers_are_producer_nodes`
205+
- `test_two_producers_on_one_method_distinct_edges`
206+
- `test_unresolved_producer_node_without_async_calls_out`
207+
- `test_cross_service_async_trace_four_hop`
208+
- `test_mixed_http_client_and_async_producer_same_method`
209+
- `test_find_kind_producer_filter_by_producer_kind`
210+
- `test_resolve_hint_kind_producer_status_none_suggests_find`
211+
- `test_describe_type_includes_declares_declares_producer_rollup`
212+
- `test_graph_meta_includes_producers_total`
213+
214+
### Manual evidence
215+
216+
```bash
217+
rm -rf /tmp/schema-v2-full && .venv/bin/python build_ast_graph.py \
218+
--source-root tests/bank-chat-system \
219+
--kuzu-path /tmp/schema-v2-full/code_graph.kuzu --verbose 2>/dev/null | tail -8
220+
.venv/bin/java-codebase-rag meta --source-root tests/bank-chat-system --index-dir /tmp/schema-v2-full 2>/dev/null | grep -E 'ontology_version|producers_total|clients_total'
221+
.venv/bin/python -m pytest tests/test_call_edges_e2e.py tests/test_mcp_v2.py tests/test_kuzu_queries.py -v -k 'producer or async_calls or declares_producer' --tb=short
222+
```
223+
224+
### PR title
225+
226+
`feat(schema): introduce Producer node and route ASYNC_CALLS through it`
227+
228+
---
229+
230+
## PR-D — hints v3 (blocked)
231+
232+
**Do not start** until [`propose/HINTS-V3-PROPOSE.md`](../propose/HINTS-V3-PROPOSE.md)
233+
exists on the branch you branch from.
234+
235+
**Branch:** `feat/hints-v3-edge-schema` off latest `master` (post PR-C)
236+
**Plan section:** [`plans/PLAN-SCHEMA-V2.md` § PR-D](./PLAN-SCHEMA-V2.md#pr-d--hints-v3-edge_schema-driven-empty-result-hints)
237+
**Propose:** `propose/HINTS-V3-PROPOSE.md` (prerequisite)
238+
239+
### Scope
240+
241+
Implement hints v3 per **HINTS-V3-PROPOSE** (not SCHEMA-V2 propose). Consume
242+
`EDGE_SCHEMA` / `typical_traversals`; replace generic wrong-subject neighbor hints.
243+
244+
### Out of scope (do NOT touch)
245+
246+
- Graph builder / DDL / `ONTOLOGY_VERSION`.
247+
- `HttpCallRow` / `ProducerRow` / pass5/6 (unless propose explicitly requires).
248+
249+
**Sentinel (must be zero on diff):**
250+
251+
```bash
252+
git diff master..HEAD | grep -E 'ONTOLOGY_VERSION|CREATE REL TABLE|HttpCallRow|ProducerRow|build_ast_graph'
253+
```
254+
255+
### Deliverables
256+
257+
See HINTS-V3 propose + plan § PR-D when unblocked.
258+
259+
### Tests (from plan § PR-D)
260+
261+
- `test_hints_neighbors_wrong_subject_symbol_http_calls_suggests_declares_client`
262+
- `test_hints_neighbors_wrong_subject_class_declares_client_suggests_declares_members`
263+
- `test_hints_neighbors_wrong_direction_producer_async_calls`
264+
- `test_hints_neighbors_fuzzy_strategy_layer_c_source_still_emits`
265+
- `test_hints_neighbors_edge_schema_typical_traversal_in_hint`
266+
267+
### PR title
268+
269+
`feat(hints): kind- and direction-aware empty-result hints driven by EDGE_SCHEMA`

0 commit comments

Comments
 (0)