Skip to content

fix(coverage): publish complete scoped denominator - #550

Merged
aviggiano merged 81 commits into
mainfrom
fix/532-coverage-denominator
Aug 14, 2026
Merged

aviggiano merged 81 commits into
mainfrom
fix/532-coverage-denominator

Conversation

@aviggiano

@aviggiano aviggiano commented Aug 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • publish typed coverage evidence with distinct Recon-selected and full-production declaration-completeness views
  • preserve LCOV and Recon-selection snapshots and verify source, range, attribution, and hit consistency at publication
  • disclose exclusions and zero-coverage components, with typed unavailable evidence for blocked measurements
  • carry the exact handoff into report@3 and one canonical scoped Markdown section, rejecting contradictory or unscoped coverage claims
  • add document-local artifact validation so producers catch cross-field errors before publication

Raw covg-eval results remain iteration-only and do not define either published declaration-completeness view.

Fixes #532

Validation

  • pnpm -w run ci

Greptile Summary

The PR adds typed scoped coverage evidence and carries it through artifact validation, runtime authentication, report publication, evals, and public bundles.

  • Adds measured and unavailable coverage-evidence contracts with document-local reconciliation.
  • Authenticates production declarations, Recon selection, LCOV attribution and hits at runtime.
  • Adds canonical Markdown projection and exact report handoff.
  • Introduces producer-facing artifact contract validation and updates topology, schemas, prompts, and documentation.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
packages/artifacts/src/coverage-evidence.ts Defines and reconciles typed measured or unavailable coverage evidence, including file, range, scoped-view, exclusion, and zero-coverage relationships.
packages/artifacts/src/artifact-contracts.ts Registers the coverage evidence and updated report and coverage-goal contracts with document-local semantic validation.
packages/cli/src/commands/artifact/validate.ts Adds producer-facing contract validation that runs registered schema and document-local semantic gates.
packages/prompts/src/render.ts Renders exact contract-validation commands and the canonical coverage Markdown projection into producer prompts.
packages/runtime/src/artifact-gates.ts Authenticates coverage evidence against production source inventory, material declarations, Recon selection, LCOV hits, goals, and Markdown publication.
packages/runtime/src/final-report-markdown.ts Produces and verifies the canonical sanitized scoped-coverage Markdown section.
packages/evals/src/publish.ts Carries finalized typed coverage evidence into eval publication.
packages/modal/src/public-bundle.ts Includes validated coverage evidence and authenticated inputs in the public bundle.
packages/artifacts/schema/coverage-evidence.schema.json Defines the strict structural producer schema paired with document-local reconciliation gates.

Reviews (30): Last reviewed commit: "fix(report): preserve coverage markdown ..." | Re-trigger Greptile

@aviggiano
aviggiano marked this pull request as ready for review August 12, 2026 19:17
@aviggiano
aviggiano force-pushed the fix/532-coverage-denominator branch from ecb69e7 to 6424634 Compare August 12, 2026 20:26
Comment thread packages/runtime/src/artifact-gates.ts Resolved
Comment thread packages/runtime/src/artifact-gates.ts Resolved
@aviggiano
aviggiano marked this pull request as draft August 13, 2026 00:30
@aviggiano
aviggiano force-pushed the fix/532-coverage-denominator branch 5 times, most recently from 61e659c to fca1dd3 Compare August 13, 2026 20:38
@aviggiano
aviggiano marked this pull request as ready for review August 13, 2026 23:28
@aviggiano
aviggiano marked this pull request as draft August 13, 2026 23:34
@aviggiano
aviggiano marked this pull request as ready for review August 13, 2026 23:45
@aviggiano
aviggiano marked this pull request as draft August 14, 2026 00:01
@aviggiano

Copy link
Copy Markdown
Collaborator Author

Review result: hold; do not merge the current metric model.\n\nI pushed the independently valid fix that keeps nested dependency, test, and harness roots such as src/dependencies and src/test out of the production-source inventory. The remaining blocker is metric fidelity: covered is authenticated as any positive DA hit in a declaration range, so a large function with one hit and many zero-hit lines can be counted as 1/1. That is neither broad declaration completeness nor a faithful representation of the pinned covg-eval result.\n\nA direct replacement with a full-line boolean is also not safe. Pinned covg-eval has a separate identity and filtering model: it recognizes only named Solidity functions/modifiers at physical line starts, collapses overloads by name, can collide same-basename contracts, ignores constructors/fallback/receive/getters, starts after the opening-brace line, treats no body DA rows as 100%, and suppresses internal/private missing reports. The current per-declaration schema cannot reproduce that denominator exactly.\n\nThe useful path forward is to publish covg-eval output as its own evaluator-specific typed inventory/result, and publish broad production coverage as a separately named metric. Until those identities and denominators are modeled independently, the PR can still emit misleading scoped scores. I am leaving it open and unmerged.

@aviggiano
aviggiano marked this pull request as ready for review August 14, 2026 00:03
@aviggiano
aviggiano marked this pull request as draft August 14, 2026 00:07
@aviggiano
aviggiano force-pushed the fix/532-coverage-denominator branch from 049bc47 to be7ba46 Compare August 14, 2026 00:07
@aviggiano
aviggiano marked this pull request as ready for review August 14, 2026 00:08
@aviggiano
aviggiano marked this pull request as draft August 14, 2026 00:10
@aviggiano
aviggiano marked this pull request as ready for review August 14, 2026 00:20
@aviggiano
aviggiano marked this pull request as draft August 14, 2026 00:29
@aviggiano
aviggiano force-pushed the fix/532-coverage-denominator branch from 2c7415a to 2d60364 Compare August 14, 2026 04:26
@aviggiano
aviggiano marked this pull request as ready for review August 14, 2026 07:40
@aviggiano

Copy link
Copy Markdown
Collaborator Author

@aviggiano ready for human review. I kept this unmerged. The coverage prompt is now concise (151 lines), with schema/tool details replaced by guidance to confirm against pinned docs or direct CLI --help. Full local CI and the replacement GitHub CI run passed, and fresh Greptile reviewed exact head bec6ca2 at 5/5 with no blocking issues.

@aviggiano

Copy link
Copy Markdown
Collaborator Author

Greptile’s current Contract validation skips reconciliation finding is stale on exact head a21aade6. ultrafuzz artifact validate first validates the immutable bytes against the registered schema, then runs executeOfflineSchemaSemanticGates and converts failures into ARTIFACT_SEMANTIC_GATE_FAILED diagnostics (packages/cli/src/commands/artifact/validate.ts:31-61). coverage-evidence.schema.json registers coverage-evidence-reconciliation (packages/artifacts/src/artifact-schema-metadata.ts:139-144), whose document-local handler calls validateCoverageEvidence. That reconciliation checks unique scopes, per-file and view totals, range/file/kind joins, selected-scope relationships, and overlaps. packages/cli/test/artifact-validate.test.ts:64-158 proves the command rejects a schema-valid but document-semantically-invalid coverage artifact; the compiled regression passes at a21aade6.

The separate zero-coverage point cannot soundly be added to offline reconciliation: covered: false means declaration-incomplete and includes partially hit ranges, whereas zero_coverage_components means no positive authenticated LCOV hit. Only runtime has the sibling LCOV authority needed for that reverse check. Greptile already agreed and withdrew that concern in #550 (comment).

No code change is warranted for either point.

@aviggiano

Copy link
Copy Markdown
Collaborator Author

@aviggiano ready for human review on exact head 812abb7b. I kept this unmerged.

The coverage prompt is now 151 lines (331 on main) and delegates schema/tool specifics to the rendered contract, pinned schemas, official docs, or direct CLI --help. I also fixed the final-report gate so canonical coverage Markdown preserves structural indentation, with regressions for indented measured output and flattened unavailable-evidence nesting.

Fresh Greptile is 5/5 with zero unresolved review threads, and all 9 exact-head checks are green, including the runtime, CLI/typecheck, package, release, Semgrep, and Socket lanes.

@aviggiano aviggiano added this to the v0.1.0 milestone Aug 14, 2026
@aviggiano
aviggiano merged commit 5db7cdc into main Aug 14, 2026
9 checks passed
@aviggiano
aviggiano deleted the fix/532-coverage-denominator branch August 14, 2026 22:12
aviggiano added a commit that referenced this pull request Aug 14, 2026
* fix(coverage): publish complete scoped denominator

* fix(coverage): authenticate complete scoped evidence

* fix(coverage): harden denominator verification

* fix(coverage): index bounded source verification

* fix(runtime): recognize getters after modifier equality

* fix(coverage): authenticate LCOV range evidence

* fix(coverage): harden source and score attribution

* fix: bind each coverage score to its scope

* fix: reject additional unscoped coverage scores

* fix: normalize formatted coverage scores

* fix: inspect rendered coverage prose

* fix(runtime): close rendered coverage scope bypasses

* fix(coverage): exclude nested non-production roots

* fix(coverage): close denominator and score bypasses

* fix(coverage): require complete declaration hits

* refactor(coverage): centralize contract validation guidance

* fix(evals): keep coverage out of finding adjudication

* feat(coverage): model unavailable evidence

* refactor(runtime): trust typed coverage evidence

* Revert "fix(evals): keep coverage out of finding adjudication"

This reverts commit 4bf6173.

* fix(runtime): close rendered coverage bypasses

* fix(coverage): bind every rendered score to its scope

* fix(coverage): finalize typed scoped evidence

* fix(coverage): publish complete scoped denominator

* docs(coverage): match private path sanitization

* fix(coverage): authenticate complete scoped evidence

* fix(coverage): harden denominator verification

* fix(coverage): index bounded source verification

* fix(runtime): recognize getters after modifier equality

* fix(coverage): authenticate LCOV range evidence

* fix(coverage): harden source and score attribution

* fix: bind each coverage score to its scope

* fix: reject additional unscoped coverage scores

* fix: normalize formatted coverage scores

* fix: inspect rendered coverage prose

* fix(runtime): close rendered coverage scope bypasses

* fix(coverage): exclude nested non-production roots

* fix(coverage): close denominator and score bypasses

* fix(coverage): require complete declaration hits

* refactor(coverage): centralize contract validation guidance

* fix(evals): keep coverage out of finding adjudication

* Revert "fix(evals): keep coverage out of finding adjudication"

This reverts commit 4bf6173.

* fix(runtime): close rendered coverage bypasses

* fix(coverage): bind every rendered score to its scope

* fix(runtime): harden unscoped coverage detection

* fix(cli): update finding diagnostic paths

* fix(coverage): bound LCOV hit parsing

* test: align current contract fixtures

* fix(runtime): harden unscoped coverage detection

* fix(coverage): publish complete scoped denominator

* fix(coverage): authenticate complete scoped evidence

* fix(coverage): harden denominator verification

* fix(coverage): index bounded source verification

* fix(runtime): recognize getters after modifier equality

* fix(coverage): authenticate LCOV range evidence

* fix(coverage): harden source and score attribution

* fix: bind each coverage score to its scope

* fix: reject additional unscoped coverage scores

* fix: normalize formatted coverage scores

* fix: inspect rendered coverage prose

* fix(runtime): close rendered coverage scope bypasses

* fix(coverage): exclude nested non-production roots

* fix(coverage): close denominator and score bypasses

* fix(coverage): require complete declaration hits

* refactor(coverage): centralize contract validation guidance

* fix(evals): keep coverage out of finding adjudication

* Revert "fix(evals): keep coverage out of finding adjudication"

This reverts commit 4bf6173.

* fix(runtime): close rendered coverage bypasses

* fix(coverage): bind every rendered score to its scope

* fix(runtime): harden unscoped coverage detection

* fix(runtime): close remaining coverage score bypasses

* fix(coverage): reject disguised unscoped scores

* fix(coverage): finalize scoped evidence validation

* fix(runtime): bound styled coverage scanning

* test(coverage): preserve zero-hit authority boundary

* fix(report): preserve coverage markdown structure
aviggiano added a commit that referenced this pull request Aug 14, 2026
* fix(coverage): publish complete scoped denominator

* fix(coverage): authenticate complete scoped evidence

* fix(coverage): harden denominator verification

* fix(coverage): index bounded source verification

* fix(runtime): recognize getters after modifier equality

* fix(coverage): authenticate LCOV range evidence

* fix(coverage): harden source and score attribution

* fix: bind each coverage score to its scope

* fix: reject additional unscoped coverage scores

* fix: normalize formatted coverage scores

* fix: inspect rendered coverage prose

* fix(runtime): close rendered coverage scope bypasses

* fix(coverage): exclude nested non-production roots

* fix(coverage): close denominator and score bypasses

* fix(coverage): require complete declaration hits

* refactor(coverage): centralize contract validation guidance

* fix(evals): keep coverage out of finding adjudication

* feat(coverage): model unavailable evidence

* refactor(runtime): trust typed coverage evidence

* Revert "fix(evals): keep coverage out of finding adjudication"

This reverts commit 4bf6173.

* fix(runtime): close rendered coverage bypasses

* fix(coverage): bind every rendered score to its scope

* fix(coverage): finalize typed scoped evidence

* fix(coverage): publish complete scoped denominator

* docs(coverage): match private path sanitization

* fix(coverage): authenticate complete scoped evidence

* fix(coverage): harden denominator verification

* fix(coverage): index bounded source verification

* fix(runtime): recognize getters after modifier equality

* fix(coverage): authenticate LCOV range evidence

* fix(coverage): harden source and score attribution

* fix: bind each coverage score to its scope

* fix: reject additional unscoped coverage scores

* fix: normalize formatted coverage scores

* fix: inspect rendered coverage prose

* fix(runtime): close rendered coverage scope bypasses

* fix(coverage): exclude nested non-production roots

* fix(coverage): close denominator and score bypasses

* fix(coverage): require complete declaration hits

* refactor(coverage): centralize contract validation guidance

* fix(evals): keep coverage out of finding adjudication

* Revert "fix(evals): keep coverage out of finding adjudication"

This reverts commit 4bf6173.

* fix(runtime): close rendered coverage bypasses

* fix(coverage): bind every rendered score to its scope

* fix(runtime): harden unscoped coverage detection

* fix(cli): update finding diagnostic paths

* fix(coverage): bound LCOV hit parsing

* test: align current contract fixtures

* fix(runtime): harden unscoped coverage detection

* fix(coverage): publish complete scoped denominator

* fix(coverage): authenticate complete scoped evidence

* fix(coverage): harden denominator verification

* fix(coverage): index bounded source verification

* fix(runtime): recognize getters after modifier equality

* fix(coverage): authenticate LCOV range evidence

* fix(coverage): harden source and score attribution

* fix: bind each coverage score to its scope

* fix: reject additional unscoped coverage scores

* fix: normalize formatted coverage scores

* fix: inspect rendered coverage prose

* fix(runtime): close rendered coverage scope bypasses

* fix(coverage): exclude nested non-production roots

* fix(coverage): close denominator and score bypasses

* fix(coverage): require complete declaration hits

* refactor(coverage): centralize contract validation guidance

* fix(evals): keep coverage out of finding adjudication

* Revert "fix(evals): keep coverage out of finding adjudication"

This reverts commit 4bf6173.

* fix(runtime): close rendered coverage bypasses

* fix(coverage): bind every rendered score to its scope

* fix(runtime): harden unscoped coverage detection

* fix(runtime): close remaining coverage score bypasses

* fix(coverage): reject disguised unscoped scores

* fix(coverage): finalize scoped evidence validation

* fix(runtime): bound styled coverage scanning

* test(coverage): preserve zero-hit authority boundary

* fix(report): preserve coverage markdown structure
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.

Publish the complete coverage denominator instead of a scopeless standardized score

1 participant