Skip to content

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

Closed

Description

@github-actions

Description

The coverage-aware gating helper for 14 perf linters (ADR-51573, accepted 2026-08-09) silently does nothing on any standard checkout.

pkg/linters/internal/coverage/coverage.go findProfile() matches an on-disk absolute source path against a coverage-profile key using a plain string-suffix check:

func (idx *profileIndex) findProfile(filename string) *xcov.Profile {
	norm := filepath.ToSlash(filename)
	for key, p := range idx.profiles {
		normKey := filepath.ToSlash(key)
		if strings.HasSuffix(norm, "/"+normKey) || norm == normKey {
			return p
		}
	}
	return nil
}

Go coverage profiles key blocks by module-qualified import path (e.g. github.com/github/gh-aw/pkg/linters/appendbytestring/appendbytestring.go), while go/analysis positions are real OS absolute paths (e.g. /home/runner/work/gh-aw/gh-aw/pkg/linters/appendbytestring/appendbytestring.go). The suffix-match only succeeds if the checkout happens to sit under a .../github.com/github/gh-aw/... directory tree — true for old GOPATH-style layouts, false for every standard git clone or GitHub Actions checkout (which uses /home/runner/work/<repo>/<repo>/...).

Net effect: ShouldApply always falls through to its permissive nil-profile branch, so the -hot-threshold coverage gate silently has zero effect on any of the 14 gated linters (appendbytestring, appendoneelement, bytesbufferstring, bytescomparestring, lenstringsplit, mapclearloop, seenmapbool, sortslice, stringbytesroundtrip, stringsconcatloop, stringsjoinone, tolowerequalfold, timenowsub, writebytestring).

The bug is masked by coverage_test.go, whose positive-match tests construct the on-disk filename by literally concatenating the profile key onto a prefix, so the match succeeds by construction rather than by modeling real integration — the tests never exercise a realistic Actions-style absolute path.

Expected Impact

Restores the intended coverage-aware gating for 14 perf linters, closing a gap where the mechanism appears active in CI but performs no filtering at all.

Suggested Agent

Sergo (already found this) or a general refactor/bugfix agent — normalize both sides to a common form (e.g. strip the module prefix from profile keys, or resolve on-disk paths back to module-relative form) and add a regression test using a realistic Actions-style absolute path.

Estimated Effort

Quick (< 1 hour)

Data Source

DeepReport Intelligence Briefing 2026-08-12, mined from Sergo report discussion #52232. Not previously filed as an issue — the run that found it exhausted its create_issue quota on 3 placeholder test calls before the real finding could be filed.

Generated by 🔬 Deep Report · agent · 198.4 AIC · ⌖ 54.5 AIC · ⊞ 11.4K · ◷

  • expires on Aug 14, 2026, 7:07 AM UTC-08:00

Activity

  1. github-actions commented on Aug 13, 2026

    @github-actions
    ContributorAuthor

    🍪 Issue Monster selected this for Copilot

    I've identified this issue as a good candidate for automated resolution and requested assignment to the Copilot coding agent.

    If assignment succeeds, the Copilot coding agent will analyze the issue and create a pull request with the fix.

    Om nom nom! 🍪

    🍪 Om nom nom by Issue Monster · gpt54 · 4 AIC · ⌖ 4.24 AIC · ⊞ 12.9K · ◷

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

Metadata

Metadata

Labels

automationbugcode-qualitycookieimprovementquick-winreliabilitytask-mining

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions