Skip to content

feat(rivet-core): CoverageStore for external coverage evidence (witness consumer)#208

Merged
avrabe merged 1 commit intomainfrom
feat/witness-coverage-evidence-consumer
Apr 25, 2026
Merged

feat(rivet-core): CoverageStore for external coverage evidence (witness consumer)#208
avrabe merged 1 commit intomainfrom
feat/witness-coverage-evidence-consumer

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Apr 25, 2026

Summary

Adds a coverage_evidence module to rivet-core that consumes branch / MC/DC / line coverage evidence emitted by external tools (initially the upstream emitter at pulseengine/witness, schema URL https://pulseengine.eu/witness-rivet-evidence/v1).

This is a separate concept from the existing coverage.rs traceability-rule coverage:

  • coverage.rs (existing) — models artifact-graph rule satisfaction
  • coverage_evidence.rs (new) — ingests external test-run evidence for downstream rendering

The on-disk YAML schema is documented in the upstream emitter at pulseengine/witness/docs/research/rivet-evidence-consumer.md.

What's added

  • CoverageEvidence (per-artifact, per-run): artifact, coverage_type (branch | mcdc | line), total, covered, percentage, hits, uncovered branch ids
  • CoverageStore: insert, latest_for, history_for, summary; mirrors ResultStore semantics (newest-first ordering, summary from latest run)
  • load_evidence(file) and load_evidence_dir(dir): rejects unknown schema URLs, skips invalid files in dir-mode with a stderr warning
  • Error::CoverageEvidence variant for typed error propagation

End-to-end flow (post-merge + rivet release)

  1. This PR merges → CoverageStore ships in a future rivet release
  2. witness emitter writes evidence YAML matching the v1 schema
  3. rivet ingests via load_evidence_dir → CoverageStore
  4. Downstream rendering (dashboard, reports) reads via latest_for / summary

Test plan

  • cargo test -p rivet-core --lib — 780 passed (9 new)
  • cargo clippy -p rivet-core -- -D warnings — clean
  • cargo deny check — pass
  • cargo fmt — clean
  • CI green (this PR triggers it)

Reviewer notes

  • Schema URL is fixed at v1 with version-bump rejection in load_evidence. Future versions will need a discriminator and explicit migration.
  • load_evidence_dir is intentionally permissive: invalid files emit a stderr warning and are skipped, so a directory mixing rivet evidence with other YAML doesn't fail the whole load. Strict mode would be a follow-up if needed.

🤖 Generated with Claude Code

Introduces a `coverage_evidence` module mirroring the `results.rs`
ResultStore pattern for branch / MC/DC / line coverage evidence emitted
by external tools. The on-disk YAML schema is documented in upstream
emitter pulseengine/witness's `docs/research/rivet-evidence-consumer.md`
under `schema: https://pulseengine.eu/witness-rivet-evidence/v1`.

This is a separate concept from the existing `coverage.rs` traceability-
rule coverage. CoverageReport models the artifact graph; CoverageStore
ingests test-run evidence for downstream rendering.

Adds:
- CoverageEvidence (per-artifact, per-run): artifact, coverage_type
  (branch | mcdc | line), total, covered, percentage, hits, uncovered
  branch ids
- CoverageStore: insert, latest_for, history_for, summary; mirrors
  ResultStore semantics (newest-first ordering, summary from latest run)
- load_evidence(file) and load_evidence_dir(dir): rejects unknown
  schema URLs, skips invalid files in dir-mode with a stderr warning
- Error::CoverageEvidence variant for typed error propagation

9 unit tests cover: type display, completeness check, store ordering,
latest_for / history_for, summary aggregation, YAML round-trip,
unknown-schema rejection, mixed-dir filtering, nonexistent-dir handling.

cargo test -p rivet-core --lib: 780 passed (including the 9 new).
cargo clippy -p rivet-core -- -D warnings: clean.
cargo deny check: pass.
cargo fmt: clean.

Implements: REQ-009 (rivet evidence consumption surface)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 25, 2026

Codecov Report

❌ Patch coverage is 95.47325% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
rivet-core/src/coverage_evidence.rs 95.47% 11 Missing ⚠️

📢 Thoughts on this report? Let us know!

@github-actions
Copy link
Copy Markdown

📐 Rivet artifact delta

No artifact changes in this PR. Code-only changes (renderer, CLI wiring, tests) don't touch the artifact graph.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Rivet Criterion Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: a8cad5c Previous: c7d5664 Ratio
store_lookup/10000 471434 ns/iter (± 1467) 378215 ns/iter (± 1969) 1.25
traceability_matrix/1000 60828 ns/iter (± 179) 43287 ns/iter (± 135) 1.41
query/10000 116345 ns/iter (± 918) 91697 ns/iter (± 323) 1.27

This comment was automatically generated by workflow using github-action-benchmark.

@avrabe avrabe merged commit 8a5a4a7 into main Apr 25, 2026
21 of 25 checks passed
@avrabe avrabe deleted the feat/witness-coverage-evidence-consumer branch April 25, 2026 22:11
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.

1 participant