Skip to content

Fix coverage.findProfile path matching so perf-linter coverage gating actually applies - #52566

Merged
pelikhan merged 2 commits into
mainfrom
copilot/deep-report-fix-coverage-path-matching-bug
Aug 13, 2026
Merged

pelikhan merged 2 commits into
mainfrom
copilot/deep-report-fix-coverage-path-matching-bug

Conversation

Copilot AI commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

coverage.findProfile() matched on-disk absolute source paths against Go coverage profile keys (module-qualified paths like github.com/github/gh-aw/pkg/foo/foo.go) using a plain suffix check. This only succeeded when the checkout directory happened to sit under a path resembling the module's import path — never true on a standard git clone or GitHub Actions checkout (/home/runner/work/gh-aw/gh-aw/...). ShouldApply therefore always fell through to its permissive nil-profile fallback, making the -hot-threshold coverage gate a silent no-op for all 14 gated perf linters.

Changes

  • Module-relative matching: added modulePrefix(), which reads the running binary's main module path via runtime/debug.ReadBuildInfo(). findProfile strips this prefix from each profile key to derive its module-relative form and matches the on-disk path against that as well as the original raw key (kept for profiles built from a different module).
  • Regression test: added TestFilenameMatchingActionsStyleAbsolutePath, which uses this repo's real module path against a realistic Actions-style absolute path (/home/runner/work/gh-aw/gh-aw/pkg/foo/foo.go) rather than constructing the on-disk path by literally concatenating the profile key, so it exercises the actual mismatch instead of matching by construction.
// profile key (from go test -coverprofile):
// github.com/github/gh-aw/pkg/foo/foo.go
//
// on-disk path (Actions checkout):
// /home/runner/work/gh-aw/gh-aw/pkg/foo/foo.go
//
// old suffix check: never matches -> gating silently disabled
// new check: also compares against module-relative form "pkg/foo/foo.go" -> matches

Copilot AI changed the title [WIP] Fix coverage path-matching bug for perf linter gates Fix coverage.findProfile path matching so perf-linter coverage gating actually applies Aug 13, 2026
Copilot AI requested a review from pelikhan August 13, 2026 19:11
@pelikhan
pelikhan marked this pull request as ready for review August 13, 2026 19:12
Copilot AI balanced review requested due to automatic review settings August 13, 2026 19:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.

@pelikhan
pelikhan merged commit 846ce3f into main Aug 13, 2026
@pelikhan
pelikhan deleted the copilot/deep-report-fix-coverage-path-matching-bug branch August 13, 2026 19:12
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.86.3

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.

[deep-report] coverage.findProfile path-matching bug makes perf-linter coverage gate a silent no-op

3 participants