Skip to content

Coverage: fail when a src project is missing from the report - #51

Merged
ANcpLua merged 1 commit into
mainfrom
coverage/require-every-project
Oct 11, 2026
Merged

ANcpLua merged 1 commit into
mainfrom
coverage/require-every-project

Conversation

@ANcpLua

@ANcpLua ANcpLua commented Oct 11, 2026

Copy link
Copy Markdown
Owner

Summary

 Target Coverage
   DependsOn CollectCoverage
+  AssertEverySourceProjectMeasured   # every src/*/*.csproj needs a <package name="…"> in the report
   dotcov check --min-line … --min-branch … --github-summary

From 2026-10-01 (#38, coverlet.MTP 10.1.0) to 2026-10-11 (#46) coverlet excluded DotCov.dll, and the gate and the badge passed on DotCov.Tool and DotCov.Fallout alone. The new check runs before check, so a failure never leaves a PASS summary, and CI only draws the badge after the gate step passes.

Evidence

  • Before: a report without the DotCov package passed the gate (badge history: 99.7% on 09-29, 99.5% from 10-01).
    After: Coverage_SourceProjectMissingFromReport_FailsBeforeTheThresholds expects a non-zero exit naming Dropped and no PASS:; Coverage_EverySourceProjectMeasured_ReachesTheThresholds expects PASS:. Not run locally; this PR's CI runs both and the real gate.

Merge Danger

Door: two-way

Blast Radius: coverage-gate

A new src/ project without coverage now fails CI until the test project's coverlet include filters cover it.

🤖 Generated with Claude Code

From 2026-10-01 to 2026-10-11 coverlet.MTP 10.1.0 excluded DotCov.dll,
and the Coverage gate and the badge passed on the two assemblies left.
The gate now requires a Cobertura package for every project under src/
before the thresholds count. It runs before `check`, so a failure never
leaves a PASS summary, and the badge is only drawn after the gate passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 11, 2026 00:17
@ANcpLua
ANcpLua enabled auto-merge (squash) October 11, 2026 00:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T00:21:01.704000Z eae4387 PR opened
🔒 Security Review ✅ Completed 2026-10-11T00:19:41.725821Z eae4387 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ANcpLua
ANcpLua merged commit 087ce25 into main Oct 11, 2026
10 checks passed
@ANcpLua
ANcpLua deleted the coverage/require-every-project branch October 11, 2026 00:18

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eae43872e4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread build/Build.cs
try
{
while (reader.ReadToFollowing("package"))
measured.Add(reader.GetAttribute("name") ?? "");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Require measured lines before accepting a package

When an assembly is emitted as an empty package, such as <package name="DotCov"><classes /></package>, this adds its name to measured even though the project supplied no coverage data. The subsequent check then evaluates only the other projects and can still return PASS:, recreating the incomplete-measurement result this gate is intended to prevent; require actual line data for each expected package rather than package-name presence alone.

AGENTS.md reference: AGENTS.md:L17-L19

Useful? React with 👍 / 👎.

Comment thread build/Build.cs
// (coverlet.MTP 10.1.0 excluded DotCov.dll while this gate passed on the other two), so every
// src/ project needs a package before the thresholds count. Runs before `check` so a failure
// never leaves a PASS summary behind; a missing input stays `check`'s to report.
private void AssertEverySourceProjectMeasured()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Move project coverage policy into DotCov

This private build-wrapper method now owns project discovery, raw Cobertura interpretation, and the missing-project gate, so DotCov's parser/check path and other consumers do not share the policy and future XML-handling changes must be duplicated to avoid disagreement before check runs. Put the required-package evaluation in DotCov and leave this Fallout build to bind the repository's expected projects and present the result.

AGENTS.md reference: src/DotCov.Fallout/AGENTS.md:L30-L32

Useful? React with 👍 / 👎.

Comment thread build/Build.cs
Comment on lines +117 to +118
if (!source.DirectoryExists() || !Path.Exists(Input))
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Let empty report directories reach the NoData gate

When --reports names an existing directory with no matching coverage files, including a CI run where collection emits nothing, Path.Exists(Input) is true and ReportResolver.Resolve(Input) returns an empty list, so this precheck reports every project as missing before dotcov check can emit its documented NODATA: verdict and warning GitHub summary. Treat an empty resolved input set like a missing input and delegate it to the normal gate so the exit status and summary describe the same inconclusive result.

AGENTS.md reference: AGENTS.md:L17-L19

Useful? React with 👍 / 👎.

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