Skip to content

Associate code coverage with test runs and steps - #75

Merged
ptescher merged 2 commits into
js-attachmentsfrom
code-coverage
Nov 9, 2026
Merged

ptescher merged 2 commits into
js-attachmentsfrom
code-coverage

Conversation

@ptescher

@ptescher ptescher commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Fixes #73. An extension (extensions/code-coverage) associates LCOV or Istanbul coverage that an app handed over as step attachments with the run, test and step, and writes results/<runner>.code.tsv. Expectation reads it (story::codecov) and adds a labelled Code coverage section to each test page (HTML and Markdown): totals at the start and after each step, what each step added, the instrumented revision and scope, and a link to a separately hosted report.

Limits, on purpose: observed execution only (never touches a result or verdict); captures count only for their own run and test fingerprint; missing or unreadable captures are shown as that, not as zero; a step's part is attributed only when counters were cumulative and never went down (restarts and gaps are labelled); raw files stay out of the manual and error notes never quote them.

Shared core: story::sidecar (Rust: file discovery by kind and platform, size cap, field cleaning, run/test crediting) is used by both contract coverage and code coverage; extensions/kit (JS: results reader, attachment finder that refuses paths leaving the directory, record writer) is used by both extensions. Reviewed by an Opus subagent; its defects are fixed here.

Tests: Rust unit and docs tests, kit and extension unit tests, and an end-to-end test (JS client → runner → extension → expectation docs) run in CI.

Stacked on #74 (the JS client's onAttachments).

🤖 Generated with Claude Code

An extension (extensions/code-coverage) reads the LCOV or Istanbul coverage an
app handed over as step attachments, works out per-step differences (baseline,
restarts, gaps) and writes results/<name>.code.tsv. Expectation reads it
(story::codecov) and shows a separate, labelled Code coverage section on the
test's page, apart from the result: totals by step, what each step added, the
instrumented revision and scope, and a link to a separately hosted report.
Captures count only for their own run and test fingerprint, and missing or
unreadable captures are shown as that, not as zero.

Closes #73

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@ptescher
ptescher added this pull request to stack #76 November 9, 2026 19:35
Rust: story::sidecar holds what every extension file shares (finding files by
kind and platform, the size cap, field cleaning, run/test crediting); contract
coverage and code coverage both use it, and results are told from extension
files by one registry of kinds. JS: extensions/kit holds the results reader,
attachment finder (links can't leave the directory) and record writer; both
extensions use it.

Code coverage fixes from review: parse errors in the manual are fixed messages,
never the file's words; a counter that goes down or something that stops being
counted is a restart; the same line in two files is one line; a step must hold
the same files as the first; a .info or coverage.json that isn't coverage is
ignored; Istanbul functions are keyed by id; 'spans' is now 'since' so it can't
be confused with HAR's; the default output is <runner>.code.tsv; plurals,
unique ids and URL encoding.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@ptescher
ptescher marked this pull request as ready for review November 9, 2026 19:50
@ptescher
ptescher merged commit b56f264 into main Nov 9, 2026
3 checks 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.

Associate code coverage reports with test runs

1 participant