Skip to content

fix(ci): clear full build cache before coverage to prevent NumStmt mismatch#4362

Merged
yrobla merged 1 commit intomainfrom
fix-coverage
Mar 25, 2026
Merged

fix(ci): clear full build cache before coverage to prevent NumStmt mismatch#4362
yrobla merged 1 commit intomainfrom
fix-coverage

Conversation

@yrobla
Copy link
Copy Markdown
Contributor

@yrobla yrobla commented Mar 25, 2026

Summary

The CI Go build cache is keyed on go.sum, so source-only changes do not bust it. With -coverpkg=./..., every test binary instruments all packages; if any binary was compiled from a stale cached artifact whose coverage statement count differs from the current source, go tool cover -func errors with "inconsistent NumStmt: changed from N to M".

Replace go clean -testcache with go clean -cache -testcache so that both the test-result cache and the compiled artifact cache are wiped before each coverage run, guaranteeing every package is instrumented from fresh source.

Fixes #

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

  • Unit tests (task test)
  • E2E tests (task test-e2e)
  • Linting (task lint-fix)
  • Manual testing (describe below)

Changes

File Change

Does this introduce a user-facing change?

Special notes for reviewers

…smatch

The CI Go build cache is keyed on go.sum, so source-only changes do not
bust it. With -coverpkg=./..., every test binary instruments all packages;
if any binary was compiled from a stale cached artifact whose coverage
statement count differs from the current source, go tool cover -func errors
with "inconsistent NumStmt: changed from N to M".

Replace go clean -testcache with go clean -cache -testcache so that both
the test-result cache and the compiled artifact cache are wiped before each
coverage run, guaranteeing every package is instrumented from fresh source.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@yrobla yrobla requested a review from JAORMX as a code owner March 25, 2026 10:31
@github-actions github-actions bot added the size/XS Extra small PR: < 100 lines changed label Mar 25, 2026
@yrobla yrobla merged commit 344907c into main Mar 25, 2026
17 checks passed
@yrobla yrobla deleted the fix-coverage branch March 25, 2026 10:35
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.60%. Comparing base (46b63d5) to head (8e9e8fa).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4362      +/-   ##
==========================================
+ Coverage   69.46%   69.60%   +0.13%     
==========================================
  Files         480      480              
  Lines       48645    48641       -4     
==========================================
+ Hits        33791    33856      +65     
+ Misses      12219    12188      -31     
+ Partials     2635     2597      -38     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS Extra small PR: < 100 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants