Skip to content

feat: prop-flow — per-instance data attribution (C1, the headline case)#14

Merged
officialCodeWork merged 1 commit into
developmentfrom
build/phase-2/step-2.2-prop-flow
Jul 13, 2026
Merged

feat: prop-flow — per-instance data attribution (C1, the headline case)#14
officialCodeWork merged 1 commit into
developmentfrom
build/phase-2/step-2.2-prop-flow

Conversation

@officialCodeWork

Copy link
Copy Markdown
Owner

Summary

TRACKER Step 2.2the step this project exists for. The same <DataTable> component on two pages now reports two different APIs, correctly, per call site:

DataTable @ pages/UsersPage.tsx    ← GET /api/users      (and nothing else)
DataTable @ pages/InvoicesPage.tsx ← GET /api/invoices   (and nothing else)

How

resolvePropFlow traces every instance's expression props to the data populating them in the parent scope, emitting data-source --provides-data--> instance edges tagged with the prop name. Origins handled (depth-capped):

  • useState pairsconst [rows, setRows] = useState() → every setRows call site → the data-source call in the same statement (fetch("/api/users").then(…).then(setRows))
  • direct resultsconst { data } = useQuery(...), const r = useApi("/x"), including await/as-cast wrapping
  • project hooksconst { members } = useMembers() → the hook's own fetches-from edges
  • derivationsdata ?? [], raw.items → recurse on the underlying identifier

traceLineage now includes incoming provides-data sources for instance traces; definition-level traces return a perInstance breakdown, never merged — merging is exactly the C1 poison the fixtures forbid.

The xfail → green ritual

The two expectedFail markers that have gated the scorecard since step 0.2 are removed in this PR — the eval harness forced the removal by reporting unexpected-pass, exactly as designed. Recall jumps 0.895 → 1.000.

108 pass · 0 fail · 0 xfail · 0 unexpected-pass
lineage precision=1.000 recall=1.000 · match accuracy=1.000
  • New fixture c1-prop-variants (react-query + hook-result props) with cross-page poison assertions.
  • Thresholds ratcheted: precision/recall floors 0.9/0.88 → 0.95/0.95.

Test plan

  • 77 unit tests green (5 new: both headline attributions, unmerged perInstance breakdown, query-result and hook-result variants)
  • pnpm eval gate OK

Documentation

  • TRACKER.md — 2.2 done (milestone M2), Status → 2.3

🤖 Generated with Claude Code

Step 2.2 (TRACKER). THE step this project exists for:

- resolvePropFlow: every instance's expression props trace back to the data
  populating them in the parent scope, emitting data-source --provides-data-->
  instance edges (via: propName). Origins: useState pairs (setter call sites
  → data-source in the same statement), direct results (useQuery/useApi,
  incl. await/as-cast wrapping), project-hook results (hook's fetches-from
  edges), and simple derivations (data ?? [], raw.items) — depth-capped.
- traceLineage: instance traces include incoming provides-data sources;
  definition traces return a perInstance breakdown, NEVER merged — merging
  is exactly the C1 poison.
- c1-shared-datatable expectedFail markers removed (the xfail→green ritual):
  DataTable@UsersPage → /api/users only; @InvoicesPage → /api/invoices only.
- New fixture c1-prop-variants (react-query result prop through ?? [],
  custom-hook result prop) with cross-page poison assertions.
- Scorecard: 108 pass / 0 fail / 0 xfail; precision 1.000, recall 1.000
  (was 0.895), match accuracy 1.000. Thresholds ratcheted to 0.95/0.95.
  77 unit tests. Milestone M2 achieved.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@officialCodeWork
officialCodeWork merged commit cec11f7 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