Skip to content

ci(go): fix coverage gate by instrumenting all packages with -coverpkg#157

Merged
izo merged 1 commit intomainfrom
claude/fix-go-coverage-gate-5Tnp0
May 7, 2026
Merged

ci(go): fix coverage gate by instrumenting all packages with -coverpkg#157
izo merged 1 commit intomainfrom
claude/fix-go-coverage-gate-5Tnp0

Conversation

@izo
Copy link
Copy Markdown
Owner

@izo izo commented May 7, 2026

Summary

  • The Go coverage gate in .github/workflows/test.yml ran go test -coverprofile=coverage.out ./... without -coverpkg=./.... Each package's profile only tracked its own statements; cross-package execution (e.g. cmd integration tests driving internal/installer, internal/registry, tui) was never attributed, and packages without their own tests were absent from the profile entirely. The 70% threshold was passing on artificially inflated per-package self-coverage.
  • Add -coverpkg=./... so every package is instrumented on every test run and cross-package usage is properly counted.
  • Drop the threshold from 70% → 35%. With honest measurement, real coverage surfaces at ~38.8%; 35% leaves a small margin for normal fluctuation while still acting as a regression guard.
  • Remove the 2>/dev/null that was hiding go test stderr.

Test plan

  • Run go test -coverpkg=./... -coverprofile=coverage.out ./... locally → all package tests pass.
  • go tool cover -func=coverage.out | tail -1total: (statements) 38.8%.
  • Threshold check (pct=38; [ "$pct" -lt 35 ] → false) → gate passes.
  • CI run on this PR confirms the new gate executes cleanly across ubuntu-latest and macos-latest.

https://claude.ai/code/session_016UwwMWsDgFY16GHiEAwuvu


Generated by Claude Code

The Go coverage gate used `go test -coverprofile=coverage.out ./...` without
`-coverpkg=./...`. Each package only measured its own statements; cross-package
execution (cmd integration tests driving internal/*) was never attributed, and
packages without tests were absent from the profile entirely. The 70% threshold
was passing on artificially inflated per-package self-coverage.

Add `-coverpkg=./...` so every package is instrumented and cross-package usage
is properly counted. Real coverage surfaces at ~38.8% — drop the threshold to
35% so the gate is honest and still acts as a regression guard. Also drop the
`2>/dev/null` redirect that was hiding test stderr.

https://claude.ai/code/session_016UwwMWsDgFY16GHiEAwuvu
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b0aff4d4-2610-48f1-a231-fe37fc8529b4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/fix-go-coverage-gate-5Tnp0

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@izo izo marked this pull request as ready for review May 7, 2026 20:30
@izo izo merged commit f465cd5 into main May 7, 2026
5 checks passed
@izo izo deleted the claude/fix-go-coverage-gate-5Tnp0 branch May 7, 2026 20:30
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