From d2e8902fedb6665766b775fd39dfd51e55e01959 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 7 May 2026 19:45:26 +0000 Subject: [PATCH] ci(go): fix coverage gate by instrumenting all packages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .github/workflows/test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 311e510..39745de 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -131,11 +131,13 @@ jobs: - name: Coverage gate working-directory: framework/cli + # -coverpkg=./... instruments every package so cross-package execution + # (e.g. cmd integration tests exercising internal/*) is properly attributed. run: | - go test -coverprofile=coverage.out ./... 2>/dev/null + go test -coverpkg=./... -coverprofile=coverage.out ./... pct=$(go tool cover -func=coverage.out | awk '/^total/{gsub(/%/,"",$3); print int($3)}') echo "Coverage: ${pct}%" - if [ "${pct}" -lt 70 ]; then echo "Coverage ${pct}% below 70% threshold" && exit 1; fi + if [ "${pct}" -lt 35 ]; then echo "Coverage ${pct}% below 35% threshold" && exit 1; fi - name: Build working-directory: framework/cli