Skip to content

feat(dataflow): DF3 URL stitcher with placeholder normalisation#6

Merged
smochan merged 1 commit into
mainfrom
feat/df3-stitcher
Apr 27, 2026
Merged

feat(dataflow): DF3 URL stitcher with placeholder normalisation#6
smochan merged 1 commit into
mainfrom
feat/df3-stitcher

Conversation

@smochan

@smochan smochan commented Apr 27, 2026

Copy link
Copy Markdown
Owner

Implements match_route() — the half of v0.2 dataflow that stitches frontend FETCH_CALL URLs to backend ROUTE handlers. 17 new tests, 443 total pass.

Implements match_route(graph, fetch_url, fetch_method, body_keys=None) →
(handler_qualname, confidence) | None.

Confidence rubric:
  1.0  exact literal-segment match
  0.9  placeholders normalised to same shape
       (covers {id}, ${id}, :id, and pure-numeric segments)
  +0.05 body-key overlap bonus when fetch body keys match handler params
       (clamped at 0.95 / 1.0 ceilings)
  0.5  prefix-only fuzzy match (last-resort)

Strips ?query and #fragment, normalises trailing slash, case-insensitive
method comparison. Tiebreaker: more specific path (more literal segments)
wins.

17 new tests covering exact match, placeholders (3 styles), method mismatch,
multi-method same path, specificity tiebreaker, body-key bonus, multiple
placeholders, trailing slash, query string, fragment, prefix fuzzy, case
sensitivity. Self-graph: 443 tests pass.
@smochan smochan merged commit 4d2f235 into main Apr 27, 2026
smochan added a commit that referenced this pull request May 30, 2026
`codegraph serve` generated a pyvis HTML page per explored function
and never pruned them. Long-lived projects could grow
`.codegraph/explore/` to hundreds of MB.

New module `codegraph/cache_prune.py` implements LRU eviction by mtime
(oldest first). `codegraph clean --max-size-mb 50` (default) prunes
until under the cap; `--all` wipes everything. `codegraph serve` runs
the prune on startup and prints the current cache size as a dim line
so users notice if it's still growing.

v0.1.2 backlog item #6.
smochan added a commit that referenced this pull request May 30, 2026
`codegraph serve` generated a pyvis HTML page per explored function
and never pruned them. Long-lived projects could grow
`.codegraph/explore/` to hundreds of MB.

New module `codegraph/cache_prune.py` implements LRU eviction by mtime
(oldest first). `codegraph clean --max-size-mb 50` (default) prunes
until under the cap; `--all` wipes everything. `codegraph serve` runs
the prune on startup and prints the current cache size as a dim line
so users notice if it's still growing.

v0.1.2 backlog item #6.
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