build: exclude the mage build script from coverage reporting - #610
Closed
jongio wants to merge 2 commits into
Closed
build: exclude the mage build script from coverage reporting#610jongio wants to merge 2 commits into
jongio wants to merge 2 commits into
Conversation
cli/magefile.go carries //go:build mage, so it is never compiled into the test binary and can never report a single covered line. Codecov still counts it, which means any PR that touches the build script is penalised on patch coverage for lines that are structurally impossible to cover. This is the same shape of problem as a lint step that reports findings the policy has already accepted: the signal is always wrong and it gates real work, so it trains people to ignore the gate. Adding it to the ignore list alongside the existing entry point exclusion.
Contributor
|
🚀 Website Preview
Preview has been cleaned up as the PR was closed. |
wbreza
reviewed
Aug 13, 2026
wbreza
left a comment
Collaborator
There was a problem hiding this comment.
The exclusion is safe but inert — cli/magefile.go never reaches Codecov, so this does not fix the patch-gate failure it targets.
What stood out
- Right instinct on gate integrity — A gate that reports findings which are impossible to act on does get tuned out, and that reasoning is sound.
- Symptom traced to the wrong file — The codecov/patch failure cited in the description came from instrumented lines under cli/src/cmd/app/commands/, not from the build script.
- Clean config hygiene — Path shape, quoting, indentation and inline-comment style match the surrounding entries exactly.
Top issues
- [F-001] Ignore entry has no effect; the gate failure it targets originates elsewhere — codecov.yml:35
Improvement opportunities
- [O-001] Apply the exclusion to both mage-tagged scripts if kept as explicit policy (Optional) — codecov.yml:35
wbreza
reviewed
Aug 13, 2026
wbreza
reviewed
Aug 13, 2026
The mage-tagged build scripts never enter the uploaded Go coverage profile, so excluding them cannot affect Codecov. The actual patch failure came from three executable statements in init.go and run.go, addressed by tests on azd-app #609. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 47f148f4-45d6-437f-a453-a1f6ab26194d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
cli/magefile.goto the codecovignorelist.Why
That file carries
//go:build mage, so it is never compiled into the test binary. Not one of its lines can ever be reported as covered, no matter how good the tests get. Codecov still counts them, so any PR that touches the build script gets penalised on patch coverage for lines that are structurally impossible to cover.Found this while investigating a failing
codecov/patchon #609, a comment-only punctuation cleanup. That PR adds no logic at all and still failed the patch gate, because 4 of its changed lines live in the magefile.This is the same shape of problem as the second gosec run removed in azd-core#164: a gate that reports a finding which is not real. Gates that are wrong by construction get ignored, and then they stop catching the real thing.
Scope
One line in
codecov.yml. No code changes.