Skip to content

feat(coverage): test-coverage mapping — TestNode + covered-by (5.4)#37

Merged
officialCodeWork merged 1 commit into
developmentfrom
build/phase-5/step-5.4-test-coverage
Jul 15, 2026
Merged

feat(coverage): test-coverage mapping — TestNode + covered-by (5.4)#37
officialCodeWork merged 1 commit into
developmentfrom
build/phase-5/step-5.4-test-coverage

Conversation

@officialCodeWork

Copy link
Copy Markdown
Owner

What

TRACKER step 5.4 — Test coverage mapping (failure mode F3).

  • Core: new TestNode (kind test, framework: vitest | jest | unknown) and a covered-by edge (component → test). Lineage-graph JSON schema regenerated; drift gate green.
  • Parser (detectTests): test files (*.test.*, *.spec.*, __tests__/) are excluded from the component/instance scan via isTestFile, so a test's render(<UserList/>) never materializes a spurious component or instance. They're then swept separately: each component a test renders (JSX tag head) or imports becomes a covered-by edge. Imports are resolved to their source file for precise attribution (so two same-named components don't cross-link), with a name fallback for unresolved JSX tags.
  • Bundle: the tests section is populated from the matched component's render subtree (componentSubtree walks renders → instance-of), and an untested warning is pushed when the matched component itself has no coverage. blastRadius now counts a test as a dependent of the component it covers.

Accept

f3-test-coverage fixture: UserList has a co-located UserList.test.tsx that renders it; Sidebar has none.

  • bundle "Ada Lovelace" → matches UserList, tests: [components/UserList.test.tsx], no untested warning.
  • bundle "Dashboard Settings" → matches Sidebar, tests: [], warnings: ["untested — no test renders Sidebar"].

New GoldenCoverage type + coverage check kind in the eval harness.

Verification

  • 6 packages build/typecheck clean; schema drift gate green
  • unit tests: 176 pass (parser 113 incl. new coverage.test.ts with 6 tests, core 46, agent-sdk 14, vision 3)
  • eval: 262 pass · 0 fail · 0 xfail — precision/recall 1.000, gate OK

🤖 Generated with Claude Code

New `TestNode` (kind `test`, framework vitest/jest/unknown) and
`covered-by` edge in core; lineage-graph schema regenerated, drift gate
green. A `detectTests` parser pass excludes test files from the
component/instance scan (isTestFile) so they never emit spurious nodes,
then sweeps them: every component a test renders (JSX tag) or imports
becomes a covered-by edge. Imports are resolved to their source file for
precise attribution, with a name fallback.

The context bundle populates its `tests` section from the matched
component's render subtree (componentSubtree) and pushes an `untested`
warning when the matched component has no coverage; blastRadius counts a
test as a dependent of the component it covers.

New f3-test-coverage fixture + GoldenCoverage / `coverage` check kind
(UserList covered, Sidebar untested). 6 parser unit tests incl. two
bundle-level. eval 262/0/0, gate OK.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@officialCodeWork
officialCodeWork merged commit dc8ae22 into development Jul 15, 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