feat(parser-react): follow react-query/SWR queryFn references to their endpoints#9
Merged
officialCodeWork merged 1 commit intoJul 13, 2026
Conversation
…r endpoints
Step 1.3 (TRACKER). Failure mode C5:
- endpointFromFunction: queryFn/mutationFn/fetcher expressions resolve to a
function body — inline arrows directly, references via go-to-definition
(cross-file) — and the first data source inside is extracted with the full
1.1/1.2 machinery (constant folding + wrapper substitution work inside
queryFns for free).
- Covers v4/v5 object form ({queryKey, queryFn} / {mutationFn}), v3
positional forms (useQuery(key, fn) / useMutation(fn)), and SWR key-or-
fetcher fallback. Mutations pick up the inner call's method (POST).
- DataSourceNode gains queryKey — the cache identity recorded alongside the
endpoint, groundwork for cache-sharing analysis (C7).
- Fixture c5-queryfn-indirection with the poison assertion that a query KEY
must never be reported as an endpoint.
- Thresholds ratcheted: minLineageRecall 0.88. Scorecard: 60 pass / 0 fail /
2 xfail; recall 0.889. 44 unit tests.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TRACKER Step 1.3 — failure mode C5.
useQuery({ queryKey: ["users"], queryFn: fetchUsers })contains no URL at the call site; the endpoint lives insidefetchUsers, often in another file. The scanner now follows the reference.What resolves now
useQuery({ queryKey: ["users"], queryFn: fetchUsers })GET /api/usersapi/users.ts→ fetch insideuseMutation({ mutationFn: createUser })POST /api/usersuseQuery(["team"], fetchTeam)(v3 positional)GET /api/teamuseQuery({ queryFn: () => fetch("/api/stats")… })GET /api/statsuseSWR(key, fetcher)DataSourceNodegainsqueryKey— cache identity recorded alongside the endpoint (groundwork for cache-sharing analysis, C7).["team"]) must never be reported as an endpoint.Eval movement
c5-queryfn-indirection(4 components, all forms).minLineageRecall: 0.88.Test plan
pnpm evalgate OK; schema regenerated (queryKey field), drift gate greenDocumentation
TRACKER.md— 1.3 done, Status → 1.4🤖 Generated with Claude Code