fix: sync pkg/linters/doc.go to 51 analyzers and add drift guard test#46138
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot merge main and recompile |
|
✅ PR Code Quality Reviewer completed the code quality review. |
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. No ADR enforcement needed: PR #46138 does not have the 'implementation' label and has only 72 new lines of code in business logic directories (threshold: 100). |
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅ |
|
✅ Test Quality Sentinel completed test quality analysis. |
There was a problem hiding this comment.
Pull request overview
Synchronizes linter documentation with the 51 registered analyzers and adds a drift test.
Changes:
- Adds six missing analyzer descriptions.
- Expands analyzer specification coverage.
- Regenerates workflow artifacts and reschedules auto-upgrade.
Show a summary per file
| File | Description |
|---|---|
pkg/linters/doc.go |
Updates analyzer inventory to 51. |
pkg/linters/doc_sync_test.go |
Adds documentation count validation. |
pkg/linters/spec_test.go |
Expands tracked analyzers. |
.github/workflows/skillet.lock.yml |
Regenerates action metadata. |
.github/workflows/release.lock.yml |
Regenerates action metadata. |
.github/workflows/hourly-ci-cleaner.lock.yml |
Regenerates action metadata. |
.github/workflows/avenger.lock.yml |
Regenerates action metadata. |
.github/workflows/agentic-auto-upgrade.yml |
Changes the weekly schedule. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 8/8 changed files
- Comments generated: 7
- Review effort level: Medium
| assert.Equal(t, headerCount, bulletCount, | ||
| "doc.go header says %d analyzers but %d bullet entries were found; "+ | ||
| "update the header or add/remove the missing bullets", | ||
| headerCount, bulletCount) |
| // documentedAnalyzers returns the analyzer subpackages documented in the README | ||
| // "Public API > Subpackages" table. The README documents 41 analyzers | ||
| // "Public API > Subpackages" table. The README documents 46 analyzers | ||
| // subpackages (the non-analyzer `internal` helper subpackage is excluded because | ||
| // it exposes no Analyzer). |
| GH_AW_INFO_ENGINE_ID: "copilot" | ||
| - name: Checkout skills directory | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # 9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 |
| echo "GH_HOST=${GH_HOST}" >> "$GITHUB_ENV" | ||
| - name: Checkout repository | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # 9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 |
| echo "GH_HOST=${GH_HOST}" >> "$GITHUB_ENV" | ||
| - name: Checkout repository | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # 9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 |
| RELEASE_TAG: ${{ needs.config.outputs.release_tag }} | ||
| - name: Setup Go | ||
| uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | ||
| uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # b7ad1dad31e06c5925ef5d2fc7ad053ef454303e |
| on: | ||
| schedule: | ||
| - cron: "11 4 * * 6" # Weekly (auto-upgrade) | ||
| - cron: "21 3 * * 5" # Weekly (auto-upgrade) |
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /tdd — one fixable issue found; otherwise solid work.
📋 Key Themes & Highlights
Issue
assert.Equalarg order indoc_sync_test.go:47: testify's signature is(t, expected, actual).headerCount(the declared value) should be first;bulletCount(the observed value) second. Currently reversed, so failure messages are misleading.
Positive Highlights
- ✅ New
TestDocGo_CountMatchesBulletsis a clean, import-free drift guard — exactly the right level of abstraction. - ✅ Six missing analyzers correctly backfilled in alphabetical order in both
doc.goandspec_test.go. - ✅
spec_test.gousesrequire.NoErrorappropriately for setup-phase failures.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · 28.7 AIC · ⌖ 6.88 AIC · ⊞ 6.7K
Comment /matt to run again
| require.NoError(t, scanner.Err()) | ||
| require.True(t, foundHeader, "doc.go must contain an '// All N active analyzers:' header") | ||
|
|
||
| assert.Equal(t, headerCount, bulletCount, |
There was a problem hiding this comment.
[/tdd] assert.Equal argument order is reversed — testify convention is assert.Equal(t, expected, actual, msg). Here headerCount is the declared (expected) value and bulletCount is the actual observed count, so the arguments should be swapped. With the current order, a failure message reads "expected: 51, got: 47" when the header is the stale value — confusing during triage.
💡 Suggested fix
// current (wrong order):
assert.Equal(t, headerCount, bulletCount,
"doc.go header says %d analyzers but %d bullet entries were found; ...",
headerCount, bulletCount)
// correct order:
assert.Equal(t, bulletCount, headerCount,
"doc.go header says %d analyzers but %d bullet entries were found; ...",
headerCount, bulletCount)@copilot please address this.
There was a problem hiding this comment.
Review: sync pkg/linters/doc.go to 51 analyzers
The drift guard test (TestDocGo_CountMatchesBullets) is a good addition and correctly catches doc.go header/bullet mismatches. However, spec_test.go's documentedAnalyzers() was only partially updated — it still covers 46 of the 51 analyzers.
Blocking issue: 5 analyzers in doc.go are missing from spec_test.go's documentedAnalyzers(): bytescomparestring, httprespbodyclose, httpstatuscode, osgetenvlibrary, sprintfint. They will be silently excluded from spec coverage.
🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · 36.1 AIC · ⌖ 4.43 AIC · ⊞ 5K
|
|
||
| // documentedAnalyzers returns the analyzer subpackages documented in the README | ||
| // "Public API > Subpackages" table. The README documents 41 analyzers | ||
| // "Public API > Subpackages" table. The README documents 46 analyzers |
|
|
||
| // documentedAnalyzers returns the analyzer subpackages documented in the README | ||
| // "Public API > Subpackages" table. The README documents 41 analyzers | ||
| // "Public API > Subpackages" table. The README documents 46 analyzers |
There was a problem hiding this comment.
Missing analyzers in documentedAnalyzers()
The comment says "46 analyzers" but doc.go now declares 51. Five analyzers documented in doc.go's bullet list are absent from documentedAnalyzers():
bytescomparestringhttprespbodyclosehttpstatuscodeosgetenvlibrarysprintfint
The new TestDocGo_CountMatchesBullets drift guard checks that doc.go's header count matches its bullet list — but there's no guard ensuring spec_test.go's documentedAnalyzers() covers all 51. These five analyzers will be silently skipped by the spec test.
Please add the missing imports and docAnalyzer entries, and update the comment to say "51 analyzers". @copilot please address this.
🧪 Test Quality Sentinel Report
📊 Metrics (9 tests)
|
There was a problem hiding this comment.
Two issues need attention
The bullet-count drift guard (TestDocGo_CountMatchesBullets) is a solid addition. Two issues found:
📋 Findings summary
1. Unanchored header regex (medium) — doc_sync_test.go line 26: the pattern // All (\d+) active analyzers: has no ^/$ anchors. Any line that contains that substring will silently overwrite headerCount, potentially masking a real mismatch.
2. documentedAnalyzers() gap widens (high) — doc.go now lists 51 analyzers; spec_test.go has 46 entries. The 5 uncovered analyzers (bytescomparestring, httprespbodyclose, httpstatuscode, osgetenvlibrary, sprintfint) are never validated by TestSpec_PublicAPI_SubpackageAnalyzers. This PR adds 6 bullets to doc.go but only 5 entries to spec_test.go, growing the gap 4 → 5. The new count-match test passes, but spec coverage remains incomplete.
🔎 Code quality review by PR Code Quality Reviewer · 59 AIC · ⌖ 4.55 AIC · ⊞ 5.6K
Comment /review to run again
| require.NoError(t, err, "doc.go must be present in pkg/linters") | ||
| defer f.Close() //nolint:errcheck | ||
|
|
||
| headerRe := regexp.MustCompile(`// All (\d+) active analyzers:`) |
There was a problem hiding this comment.
Unanchored header regex can silently over-match: // All (\d+) active analyzers: has no ^ anchor, so any comment line containing this substring could match, silently overwriting headerCount.
💡 Suggested fix
headerRe := regexp.MustCompile(`^// All (\d+) active analyzers:$`)With anchors, only the canonical header line matches. A line like // see // All 45 active analyzers: was wrong would otherwise match and corrupt the count.
| // regexpcompileinfunction, seenmapbool, sortslice, sprintferrdot, sprintferrorsnew, ssljson, | ||
| // strconvparseignorederror, stringreplaceminusone, stringscountcontains, stringsindexcontains, timeafterleak, timesleepnocontext, | ||
| // tolowerequalfold, uncheckedtypeassertion, wgdonenotdeferred, writebytestring | ||
| func documentedAnalyzers() []docAnalyzer { |
There was a problem hiding this comment.
documentedAnalyzers() is missing 5 analyzers listed in doc.go: doc.go now documents 51 analyzers; spec_test.go has 46 entries. The 5 missing analyzers (bytescomparestring, httprespbodyclose, httpstatuscode, osgetenvlibrary, sprintfint) are never exercised by TestSpec_PublicAPI_SubpackageAnalyzers or TestSpec_DocumentedAnalyzersHaveSubpackages.
💡 Details
This PR adds 6 new bullets to doc.go but only adds 5 analyzers to documentedAnalyzers(). The gap was already 4 before this PR; it's now 5. The TestDocGo_CountMatchesBullets test added in this PR will pass (51 == 51 bullets) but the spec coverage test continues to silently under-cover these analyzers. Adding the missing 5 entries to documentedAnalyzers() would close the gap.
🤖 PR Triage
Rationale: Pure doc sync — updates pkg/linters/doc.go from 45→51 analyzers and adds drift guard test. Low risk, CI running. Auto-merge when CI passes.
|
…analyzer-count Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pkg/linters/doc.goclaimed// All 45 active analyzers:with 45 bullets whilecmd/linters/main.goregistered 51 — a recurring drift class (#40436, #45185).Changes
pkg/linters/doc.go— header updated to51; 6 missing bullets added in alphabetical order:bytesbufferstring,ioutildeprecated,logfatallibrary,mapclearloop,mapdeletecheck,stringscountcontainspkg/linters/doc_sync_test.go(new) —TestDocGo_CountMatchesBulletsparsesdoc.goat test time, extracts the// All N active analyzers:count, and asserts it equals the number of// -bullet lines. Prevents silent re-drift without requiring any imports of the registered analyzers.pkg/linters/spec_test.go— the 5 newly-tracked analyzers (bytesbufferstring,ioutildeprecated,logfatallibrary,mapclearloop,mapdeletecheck) added todocumentedAnalyzers(); count comment updated from 41 → 46. (stringscountcontainswas already present.)