Skip to content

Commit 82ed546

Browse files
committed
Add route handler graph parity slice
1 parent 2b1408f commit 82ed546

16 files changed

Lines changed: 683 additions & 39 deletions

docs/gap-analysis.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,19 +117,19 @@ Complete slices:
117117

118118
Deferred or optional future slices:
119119
- Public surface expansion:
120-
- trace breadth now covers modes, risk labels, and multi-edge-type filtering (Plan 03 complete); `HTTP_CALLS` and `ASYNC_CALLS` edges are now produced via service-pattern call reclassification; remaining gap is `DATA_FLOWS` edges
120+
- trace breadth now covers modes, risk labels, and multi-edge-type filtering (Plan 03 complete); `HTTP_CALLS` and `ASYNC_CALLS` edges are now produced via service-pattern call reclassification, and decorator-backed `HANDLES` edges are verified on the graph-model route fixture; remaining gap is route-linked `DATA_FLOWS` edges
121121
- Query/runtime expansion:
122122
- full Cypher lexer/parser/executor parity beyond the verified shared read-only floor
123123
- broader traversal and query-analysis parity beyond the current shared `detect_changes` contract
124124
- Indexing/runtime expansion:
125125
- deeper usage/type-ref extraction parity beyond the current daily-use slice
126126
- Metadata and enrichment:
127127
- git-history coupling — now implemented (subprocess `git log`, `FILE_CHANGES_WITH` edges)
128-
- long-tail edges — now implemented: `THROWS`/`RAISES` (JS/TS/TSX throw statements); remaining or out-of-scope gaps: `OVERRIDE` (Go-only), `WRITES`/`READS` (not proven original-overlap by the current C reference fixture), `HANDLES`/`DATA_FLOWS` (deferred route-graph)
129-
- route nodes — partially implemented (stub `Route` nodes from `HTTP_CALLS`/`ASYNC_CALLS` edges; no `HANDLES` or `DATA_FLOWS` yet)
128+
- long-tail edges — now implemented: `THROWS`/`RAISES` (JS/TS/TSX throw statements) and decorator-backed `HANDLES`; remaining or out-of-scope gaps: `OVERRIDE` (Go-only), `WRITES`/`READS` (not proven original-overlap by the current C reference fixture), route-linked `DATA_FLOWS` (deferred route-graph)
129+
- route nodes — partially implemented (stub `Route` nodes from `HTTP_CALLS`/`ASYNC_CALLS` edges plus verified decorator-backed `Route`/`HANDLES`; no route-linked `DATA_FLOWS` yet)
130130
- config-linking — partially implemented (Strategy 1 key-symbol + Strategy 2 dependency-import; full config normalization surface not yet ported)
131131
- richer decorator/enrichment promotion
132-
- current entrypoint: [graph-model-parity-plan.md](/Users/skooch/projects/codebase-memory-zig/docs/plans/new/graph-model-parity-plan.md)
132+
- current entrypoint: [graph-model-parity-plan.md](/Users/skooch/projects/codebase-memory-zig/docs/plans/in-progress/graph-model-parity-plan.md)
133133
- Productization beyond the current contract:
134134
- broader installer/self-update behavior
135135
- broader agent integration coverage and installer diagnostics
@@ -428,7 +428,7 @@ The Zig store has the schema (tables + indexes + pragmas) and opens in-memory DB
428428
| `pass_parallel` | 1,427 | MISSING | Thread pool orchestration |
429429
| `pass_similarity` | 505 (minhash.c) | MISSING | MinHash near-clone detection |
430430
| `pass_gitdiff` | ~200 | MISSING | Git diff → changed files/hunks |
431-
| `pass_route_nodes` | 742 | PARTIAL (stub Route nodes from `HTTP_CALLS`/`ASYNC_CALLS` edges; no `HANDLES` or `DATA_FLOWS`) | HTTP route node creation |
431+
| `pass_route_nodes` | 742 | PARTIAL (stub Route nodes from `HTTP_CALLS`/`ASYNC_CALLS` edges plus verified decorator-backed `Route`/`HANDLES`; no route-linked `DATA_FLOWS`) | HTTP route node creation and first handler association slice |
432432
| `pass_tests` | 285 | WORKS for the shared Python `TESTS` / `TESTS_FILE` slice | Test file/function tagging now verified on the local parity fixture; broader language breadth stays follow-on work |
433433
| `pass_enrichment` | ~200 | MISSING (deferred) | Decorator tag enrichment |
434434
| `pass_configlink` | ~200 | PARTIAL (Strategy 1 key-symbol + Strategy 2 dependency-import) | Config-code linking |

docs/plans/new/graph-model-parity-plan.md renamed to docs/plans/in-progress/graph-model-parity-plan.md

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ route-linked data flow, decorator route detection, and the broader config-link
77
normalization surface.
88

99
## Current Phase
10-
Awaiting approval to execute. Move this plan to `docs/plans/in-progress/`
11-
before implementation starts.
10+
Phase 2 route handler modeling is in progress. The first slice has landed:
11+
decorator route extraction now creates `Route` nodes and `HANDLES` edges, and
12+
route-registration calls preserve enough call metadata to emit `HANDLES` when
13+
the handler reference resolves.
1214

1315
## Current Codebase State
1416
- Complete and verified: advanced trace modes, risk labels, include-tests
@@ -18,14 +20,19 @@ before implementation starts.
1820
`src/route_nodes.zig` creates deterministic `Route` nodes from `HTTP_CALLS`
1921
and `ASYNC_CALLS`, `src/pipeline.zig` emits service-pattern call edges, and
2022
`src/query_router.zig` can expose route summaries.
21-
- Still missing for graph-model parity: route handler association, `HANDLES`
22-
edges, route-linked `DATA_FLOWS`, decorator/framework route extraction, and
23-
the full config normalization/linking surface beyond the current key-symbol
24-
and dependency-import strategies.
25-
- Current full Zig-vs-C harness baseline after plan reconciliation:
26-
`151` comparisons, `86` strict matches, `19` diagnostic-only comparisons,
27-
`10` mismatches. The graph-model-related mismatches include the existing
28-
`graph-enrichment-config-deps` and `graph-enrichment-http-calls` query rows.
23+
- Newly implemented in this session: Python decorator route extraction emits
24+
`Route` nodes and `HANDLES` edges; framework route-registration calls such as
25+
`app.get("/path", handler)` now carry route metadata and emit `Route`,
26+
`CALLS`, and `HANDLES` facts when the handler resolves.
27+
- Still missing for graph-model parity: route-linked `DATA_FLOWS`, broader
28+
framework route coverage, HTTP/async calls routed through concrete URL route
29+
nodes, and the full config normalization/linking surface beyond the current
30+
key-symbol and dependency-import strategies.
31+
- Current full Zig-vs-C harness baseline after this route slice:
32+
`158` comparisons, `89` strict matches, `20` diagnostic-only comparisons,
33+
`10` mismatches, and `cli_progress: match`. The graph-model-related
34+
mismatches still include the existing `graph-enrichment-config-deps` and
35+
`graph-enrichment-http-calls` query rows.
2936

3037
## Superseded Plans
3138
- `docs/plans/paused/ready-to-go/04-graph-enrichment-parity-plan.md`
@@ -54,16 +61,20 @@ before implementation starts.
5461
## Phases
5562

5663
### Phase 1: Lock the Remaining Graph Contract
57-
- [ ] Re-read the original route, config-linking, and semantic-edge passes and record only the overlapping behavior still missing from the Zig port.
58-
- [ ] Define fixture-backed acceptance rules for `Route`, `HANDLES`, `HTTP_CALLS`, `ASYNC_CALLS`, route-linked `DATA_FLOWS`, decorator route extraction, and config normalization/linking.
59-
- [ ] Add minimal JavaScript/TypeScript and Python fixtures under `testdata/interop/graph-model/` before changing extractor behavior.
60-
- **Status:** pending approval
64+
- [x] Re-read the original route, config-linking, and semantic-edge passes and record only the overlapping behavior still missing from the Zig port.
65+
- [x] Define fixture-backed acceptance rules for decorator-backed `Route` and `HANDLES` facts.
66+
- [ ] Define fixture-backed acceptance rules for `HTTP_CALLS`, `ASYNC_CALLS`, route-linked `DATA_FLOWS`, and config normalization/linking.
67+
- [x] Add a minimal Python route fixture under `testdata/interop/graph-model/routes/`.
68+
- [ ] Add minimal JavaScript/TypeScript route fixtures once the shared C/Zig public behavior is established for those registrations.
69+
- **Status:** partially complete
6170

6271
### Phase 2: Complete Route Handler Modeling
63-
- [ ] Extend route extraction so supported framework registrations and decorators resolve to handler symbols instead of only creating route rendezvous nodes from outbound calls.
64-
- [ ] Emit `HANDLES` edges from handler functions/methods to `Route` nodes, preserving method/path metadata and duplicate-route suppression.
65-
- [ ] Add store, extractor, pipeline, and Cypher regression coverage for route node creation, handler association, and route summary exposure.
66-
- **Status:** pending approval
72+
- [x] Extend Python decorator route extraction so handlers create route rendezvous nodes.
73+
- [x] Preserve route-registration call metadata and emit `HANDLES` when handler references resolve.
74+
- [x] Emit `HANDLES` edges from handler functions/methods to `Route` nodes for the first supported decorator and registration slices.
75+
- [x] Add extractor, pipeline, and interop regression coverage for route node creation and handler association.
76+
- [ ] Broaden framework coverage and add route summary exposure coverage.
77+
- **Status:** in progress
6778

6879
### Phase 3: Add Route-Linked Data Flow
6980
- [ ] Define the first accepted `DATA_FLOWS` route-link contract from request entry points through handler calls without pretending to solve full local data-flow analysis.
@@ -78,11 +89,11 @@ before implementation starts.
7889
- **Status:** pending approval
7990

8091
### Phase 5: Verify and Reclassify
81-
- [ ] Run `zig build`, `zig build test`, `bash scripts/run_interop_alignment.sh --zig-only`, and focused graph-model fixture queries.
82-
- [ ] Run the full Zig-vs-C interop harness if the C reference binary is available locally.
83-
- [ ] Update `docs/port-comparison.md`, `docs/gap-analysis.md`, and `docs/zig-port-plan.md` only for rows backed by the new fixtures.
92+
- [x] Run `zig build`, `zig build test`, `bash scripts/run_interop_alignment.sh --zig-only`, and focused graph-model fixture queries.
93+
- [x] Run the full Zig-vs-C interop harness if the C reference binary is available locally.
94+
- [x] Update `docs/port-comparison.md`, `docs/gap-analysis.md`, and `docs/zig-port-plan.md` only for rows backed by the new fixtures.
8495
- [ ] Move this plan and its progress log to `docs/plans/implemented/` only after all required verification passes.
85-
- **Status:** pending approval
96+
- **Status:** in progress
8697

8798
## Decisions
8899
| Decision | Rationale |
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Graph Model Parity Progress
2+
3+
## Session: 2026-04-16
4+
5+
### Phase 1: Lock the Remaining Graph Contract
6+
- **Status:** partially complete
7+
- Actions:
8+
- Moved `docs/plans/new/graph-model-parity-plan.md` to `docs/plans/in-progress/graph-model-parity-plan.md` before implementation.
9+
- Starting from current main baseline: full Zig-vs-C harness reports 151 comparisons, 86 strict matches, 19 diagnostic-only comparisons, and 10 known mismatches.
10+
- Re-read the original route-node and service-pattern route registration paths and selected the first shared public contract: decorator-backed routes create `Route` nodes and `HANDLES` edges, with query-visible handler and route rows.
11+
- Added `testdata/interop/graph-model/routes/app.py` and manifest assertions for `Route` and `HANDLES` query rows.
12+
13+
### Phase 2: Complete Route Handler Modeling
14+
- **Status:** in progress
15+
- Actions:
16+
- Extended extractor state so route decorators create `Route` nodes plus `HANDLES` edges during extraction.
17+
- Added route-registration call metadata for framework calls such as `app.get("/path", handler)` and pipeline emission for `Route`, `CALLS`, and `HANDLES` when the handler resolves.
18+
- Added focused unit coverage in `src/extractor.zig`, `src/pipeline.zig`, and `src/service_patterns.zig`.
19+
- Updated Zig golden snapshots; new `graph-model-routes` golden locks `/users` and `list_users -> /users`.
20+
21+
### Verification
22+
- `zig build` -> passed
23+
- `zig build test` -> passed
24+
- `bash scripts/run_interop_alignment.sh --update-golden` -> passed, 20/20 golden snapshots updated
25+
- `bash scripts/run_interop_alignment.sh --zig-only` -> passed, 20/20 golden comparison
26+
- `bash scripts/run_interop_alignment.sh` -> passed with 20 fixtures, 158 comparisons, 89 strict matches, 20 diagnostic-only comparisons, 10 known mismatches, and `cli_progress: match`
27+
28+
## Errors
29+
| Timestamp | Error | Attempt | Resolution |
30+
|-----------|-------|---------|------------|
31+
| 2026-04-16 | Initial `graph-model-routes` manifest used a Zig project name that did not match the indexed directory basename, so query assertions read an empty project. | Ran `--update-golden` and inspected the generated `graph-model-routes` snapshot. | Changed the fixture project to `routes`, regenerated golden snapshots, and verified query rows were populated. |
32+
| 2026-04-16 | JavaScript route-registration fixture improved Zig but was not emitted by the current C binary, adding a new full-harness mismatch. | Ran the full Zig-vs-C harness and inspected per-fixture route outputs. | Switched the strict shared fixture to a Python decorator route that both implementations expose publicly, while keeping Zig registration support covered by unit tests. |
33+
| 2026-04-16 | The redirected harness rerun wrapper used `status`, which is read-only in zsh. | Tried to capture the exit code with `status=$?`. | Re-ran with `rc=$?`; both `--zig-only` and full interop passed. |

docs/plans/new/improvements/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This directory turns the upstream `codebase-memory-mcp` issue and PR review into
1515

1616
These plans are upstream-improvement backlog, not the current parity execution
1717
entrypoint. The active graph-model parity planning entrypoint is
18-
[graph-model-parity-plan.md](/Users/skooch/projects/codebase-memory-zig/docs/plans/new/graph-model-parity-plan.md).
18+
[graph-model-parity-plan.md](/Users/skooch/projects/codebase-memory-zig/docs/plans/in-progress/graph-model-parity-plan.md).
1919

2020
## Plan Index
2121

docs/plans/new/improvements/semantic-graph-expansion-feature-cluster-plan.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Status
44
Backlog improvement cluster. For the current original-project graph-model parity
5-
work, use `docs/plans/new/graph-model-parity-plan.md`; this plan remains as
5+
work, use `docs/plans/in-progress/graph-model-parity-plan.md`; this plan remains as
66
the broader upstream feature-pressure inventory for later semantic expansion.
77

88
## Goal

docs/plans/paused/ready-to-go/04-graph-enrichment-parity-plan.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Status
44
Paused on 2026-04-15. This bundled enrichment plan is superseded by
5-
`docs/plans/new/graph-model-parity-plan.md`. Its git-history slice is already
5+
`docs/plans/in-progress/graph-model-parity-plan.md`. Its git-history slice is already
66
implemented; the remaining route/config/semantic graph work is now tracked in
77
the graph-model parity plan with narrower acceptance gates.
88

docs/plans/paused/superseded/config-linking-and-edge-expansion-plan.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Status
44
Paused on 2026-04-15. This narrower config/edge plan is superseded by
5-
`docs/plans/new/graph-model-parity-plan.md`, which keeps config normalization,
5+
`docs/plans/in-progress/graph-model-parity-plan.md`, which keeps config normalization,
66
route graph completion, and remaining graph-model edge families in one
77
fixture-backed execution order.
88

docs/plans/paused/superseded/route-graph-parity-plan.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Status
44
Paused on 2026-04-15. This narrower route-only plan is superseded by
5-
`docs/plans/new/graph-model-parity-plan.md`, which combines the remaining
5+
`docs/plans/in-progress/graph-model-parity-plan.md`, which combines the remaining
66
route, config-linking, route-linked data-flow, and semantic-edge work into one
77
dependency-ordered graph-model parity tranche.
88

0 commit comments

Comments
 (0)