feat(parser-react): API-client wrapper adapter — heuristic detection + config, chains to depth 3#8
Merged
Conversation
…+ config, chains to depth 3
Step 1.2 (TRACKER). Failure mode C2 (wrapper half):
- detectWrappers: any named callable (function, const fn, object-literal
method) whose body reaches fetch/axios/another wrapper with one of its own
params in the URL is classified as a wrapper. Templates compose through
chains (useApi → apiClient.get → request → fetch), so a call site's
argument substitutes all the way down with constants folded:
useApi('/projects') → /api/projects.
- Method inference: name suffix (apiClient.post → POST) beats inner method.
- ScanOptions.apiWrappers declares wrappers the heuristic can't see.
- Wrapper bodies are plumbing: their own internal fetch emits no data source,
so ':path' placeholders never leak into consumer attribution (fixture has
forbidden assertions for exactly that poison).
- Thresholds ratcheted: minLineageRecall 0.85. Scorecard: 47 pass / 0 fail /
2 xfail; recall 0.857. 39 unit tests (6 new wrapper 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.2 — the wrapper half of C2. Real codebases never call
fetchinline; they route through client layers. The scanner now sees through them:How it works
fetch/axios/another wrapper with one of its own parameters inside the URL is classified as a wrapper. Runs up to 3 composition rounds, so three-layer chains resolve.:parammarker (request→/api:path); chains substitute inward, constants fold along the way. Call sites then substitute the real argument:apiClient.get("/projects")→/api/projects(full).apiClient.post→ POST), inner call's method otherwise.apiWrappersscan option — declare wrappers the heuristic can't see (imported clients, class-based SDKs).forbiddenassertions gate the:path-leak poison forever.Eval movement
c2-api-wrapper(the three-layer chain, GET via hook + POST via event handler).minLineageRecall: 0.85.Test plan
pnpm evalgate OKDocumentation
TRACKER.md— 1.2 done, Status → 1.3🤖 Generated with Claude Code