Skip to content

feat(parser-react): endpoint resolution — constant folding, route patterns, base-URL stripping#7

Merged
officialCodeWork merged 1 commit into
developmentfrom
build/phase-1/step-1.1-endpoint-resolution
Jul 13, 2026
Merged

feat(parser-react): endpoint resolution — constant folding, route patterns, base-URL stripping#7
officialCodeWork merged 1 commit into
developmentfrom
build/phase-1/step-1.1-endpoint-resolution

Conversation

@officialCodeWork

Copy link
Copy Markdown
Owner

Summary

TRACKER Step 1.1 — the parser starts surviving real code. Real codebases don't call fetch("/api/users") inline; endpoints hide behind constants, object maps, concatenation, and template literals.

What resolves now

Source code Endpoint in graph resolved
fetch(ENDPOINTS.USERS) (declared in another file) /api/users full
fetch(HEALTH_URL) /api/health full
fetch(API_PREFIX + "/reports") /api/reports full
fetch(`/api/orders/${orderId}`) /api/orders/:orderId partial
fetch(`/api/${entity}/list`) /api/:entity/list partial
fetch(buildUrl()) <dynamic> none
  • DataSourceNode gains raw + resolvedendpoint is now the canonical pattern (constants folded, :param placeholders), which is the value attribution matches on and the future cross-graph join key (G6). raw preserves the source expression for evidence.
  • baseUrls scan option strips environment prefixes so graphs stay environment-independent.
  • Folding is depth-capped (6) and goes through go-to-definition, so imported constants resolve across files.

Eval movement

  • New fixtures c2-endpoint-constants, c3-dynamic-endpoints, each with a forbidden assertion that the endpoint must never collapse to <dynamic> (the regression poison for this feature).
  • Thresholds ratcheted (allowed direction): minLineagePrecision: 0.9, minLineageRecall: 0.8.
  • Scorecard: 38 pass / 0 fail / 2 xfail / 0 unexpected-pass · precision 1.000 · recall 0.833 (was 0.714) · match accuracy 1.000.

Test plan

  • 33 unit tests green (9 new resolver tests: literals, constants, object members, concat, resolvable + partial templates, opaque calls, base-URL stripping)
  • pnpm eval gate OK; demo-app golden updated to pattern form (/api/users/:id)
  • Schema regenerated (drift gate green)

Documentation

🤖 Generated with Claude Code

…terns, base-URL stripping

Step 1.1 (TRACKER). Failure modes C2 (constants half), C3:

- resolveEndpoint/resolveStringValue: cross-file constant folding via
  go-to-definition (named constants, ENDPOINTS.X object members, + concat,
  as/satisfies unwrap, depth-capped), template literals with unknown parts
  normalized to :param placeholders (/api/users/${user.id} → /api/users/:id),
  configured baseUrls stripped from resolved endpoints.
- DataSourceNode gains raw (source text) + resolved (full|partial|none);
  endpoint is now the canonical pattern — the cross-graph join key.
- Fixtures c2-endpoint-constants (object member / named const / concat) and
  c3-dynamic-endpoints (dynamic id + dynamic resource segment), both with
  <dynamic>-collapse forbidden assertions.
- Thresholds ratcheted: minLineagePrecision 0.9, minLineageRecall 0.8.
  Scorecard: 38 pass / 0 fail / 2 xfail; precision 1.000, recall 0.833
  (was 0.714), match accuracy 1.000. 33 unit tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@officialCodeWork
officialCodeWork merged commit 13241fc into development Jul 13, 2026
1 check passed
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.

2 participants