Skip to content

build: exclude the mage build script from coverage reporting - #610

Closed
jongio wants to merge 2 commits into
mainfrom
chore/codecov-ignore-magefile
Closed

build: exclude the mage build script from coverage reporting#610
jongio wants to merge 2 commits into
mainfrom
chore/codecov-ignore-magefile

Conversation

@jongio

@jongio jongio commented Aug 13, 2026

Copy link
Copy Markdown
Owner

What

Adds cli/magefile.go to the codecov ignore list.

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/patch on #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.

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.
github-actions Bot added a commit that referenced this pull request Aug 13, 2026
@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

🚀 Website Preview

Your PR preview was available here.

Preview has been cleaned up as the PR was closed.

@wbreza wbreza left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

Comment thread codecov.yml Outdated
Comment thread codecov.yml Outdated
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
@jongio jongio closed this Aug 13, 2026
github-actions Bot added a commit that referenced this pull request Aug 13, 2026
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