Skip to content

fix: sync pkg/linters/doc.go to 51 analyzers and add drift guard test - #46138

Merged
pelikhan merged 5 commits into
mainfrom
copilot/doc-sync-fix-analyzer-count
Jul 17, 2026
Merged

fix: sync pkg/linters/doc.go to 51 analyzers and add drift guard test#46138
pelikhan merged 5 commits into
mainfrom
copilot/doc-sync-fix-analyzer-count

Conversation

CopilotAI commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

pkg/linters/doc.go claimed // All 45 active analyzers: with 45 bullets while cmd/linters/main.go registered 51 — a recurring drift class (#40436, #45185).

Changes

  • pkg/linters/doc.go — header updated to 51; 6 missing bullets added in alphabetical order: bytesbufferstring, ioutildeprecated, logfatallibrary, mapclearloop, mapdeletecheck, stringscountcontains

  • pkg/linters/doc_sync_test.go (new) — TestDocGo_CountMatchesBullets parses doc.go at 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 to documentedAnalyzers(); count comment updated from 41 → 46. (stringscountcontains was already present.)

CopilotAIand others added 2 commits July 17, 2026 06:13
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
CopilotAI changed the title [WIP] Fix doc.go to match registered analyzers countfix: sync pkg/linters/doc.go to 51 analyzers and add drift guard testJul 17, 2026
CopilotAI requested a review from pelikhanJuly 17, 2026 06:28
@pelikhan
pelikhan marked this pull request as ready for review July 17, 2026 06:55
CopilotAI review requested due to automatic review settings July 17, 2026 06:55
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot merge main and recompile

@github-actions

github-actionsBot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

@github-actions

github-actionsBot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

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).

@github-actions

github-actionsBot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

@github-actions

github-actionsBot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

CopilotAI 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.

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
FileDescription
pkg/linters/doc.goUpdates analyzer inventory to 51.
pkg/linters/doc_sync_test.goAdds documentation count validation.
pkg/linters/spec_test.goExpands tracked analyzers.
.github/workflows/skillet.lock.ymlRegenerates action metadata.
.github/workflows/release.lock.ymlRegenerates action metadata.
.github/workflows/hourly-ci-cleaner.lock.ymlRegenerates action metadata.
.github/workflows/avenger.lock.ymlRegenerates action metadata.
.github/workflows/agentic-auto-upgrade.ymlChanges 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

Comment on lines +47 to +50
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)
Comment on lines 74 to 77
// 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).
Comment thread.github/workflows/skillet.lock.yml Outdated
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
Comment thread.github/workflows/avenger.lock.yml Outdated
echo "GH_HOST=${GH_HOST}" >> "$GITHUB_ENV"
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # 9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
Comment thread.github/workflows/release.lock.yml Outdated
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)

@github-actionsgithub-actionsBot 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.

Skills-Based Review 🧠

Applied /tdd — one fixable issue found; otherwise solid work.

📋 Key Themes & Highlights

Issue

  • assert.Equal arg order in doc_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_CountMatchesBullets is a clean, import-free drift guard — exactly the right level of abstraction.
  • ✅ Six missing analyzers correctly backfilled in alphabetical order in both doc.go and spec_test.go.
  • spec_test.go uses require.NoError appropriately 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,

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.

[/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.

@github-actionsgithub-actionsBot 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.

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

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.

test


// 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

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.

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():

  • bytescomparestring
  • httprespbodyclose
  • httpstatuscode
  • osgetenvlibrary
  • sprintfint

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.

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

⚠️Test Quality Score: 77/100 — Acceptable

Analyzed 9 test(s): 8 design, 1 implementation, 0 violation(s).

📊 Metrics (9 tests)
MetricValue
Analyzed9 (Go: 9, JS: 0)
✅ Design8 (89%)
⚠️ Implementation1 (11%)
Edge/error coverage5 (56%)
Duplicate clusters1
InflationNO
🚨 Violations0
TestFileClassificationIssues
TestDocGo_CountMatchesBulletsdoc_sync_test.godesign_test / behavioral_contract / high_valueNone
TestSpec_PublicAPI_SubpackageAnalyzersspec_test.godesign_test / behavioral_contract / high_valueNone
TestSpec_NamespaceExports_ErrorMessageAnalyzerspec_test.godesign_test / behavioral_contract / high_valueNone
TestSpec_Constants_DefaultMaxParamsspec_test.godesign_test / behavioral_contract / high_valueNone
TestSpec_Constants_DefaultMaxLinesspec_test.godesign_test / behavioral_contract / high_valueNone
TestSpec_DesignDecision_MaxParamsFlagspec_test.godesign_test / behavioral_contract / high_valueNone
TestSpec_DesignDecision_MaxLinesFlagspec_test.godesign_test / behavioral_contract / high_valueNone
TestSpec_UsageExample_AnalyzersUsablespec_test.goimplementation_test / duplicated / low_valuePartially duplicates TestSpec_PublicAPI_SubpackageAnalyzers
TestSpec_DesignDecision_UniqueAnalyzerNamesspec_test.godesign_test / behavioral_contract / high_valueNone
⚠️ Flagged Tests (1)

TestSpec_UsageExample_AnalyzersUsable (spec_test.go) — implementation_test, partially duplicated. This test iterates documentedAnalyzers() and asserts non-nil, which is already checked in TestSpec_PublicAPI_SubpackageAnalyzers. The "usage example" intent is documented in comments but the assertion body overlaps. Consider removing or converting to a compile-only check.

Verdict

Passed. 11% implementation tests (threshold: 30%). Both new test files have //go:build !integration build tags. No mock library violations. TestDocGo_CountMatchesBullets is a high-value drift guard enforcing an invariant that previously caused silent doc rot. TestSpec_PublicAPI_SubpackageAnalyzers is a well-structured table-driven spec test covering 46 subpackages.

References:§29561445385

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
allowed:
- defaults
- "awmgmcpg"

See Network Configuration for more information.

🧪 Test quality analysis by Test Quality Sentinel · 28.1 AIC · ⌖ 13.7 AIC · ⊞ 6.8K ·
Comment /review to run again

@github-actionsgithub-actionsBot 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.

✅ Test Quality Sentinel: 77/100. 11% implementation tests (threshold: 30%). No violations.

@github-actionsgithub-actionsBot 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.

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:`)

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.

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 {

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.

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.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 PR Triage

FieldValue
Categorychore
Risklow
Score35/100 (impact:10, urgency:10, quality:15)
Actionauto_merge

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.

Generated by 🔧 PR Triage Agent · 166.4 AIC · ⌖ 6.15 AIC · ⊞ 5.6K ·

CopilotAIand others added 2 commits July 17, 2026 07:13
…analyzer-count
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

CopilotAI commented Jul 17, 2026

Copy link
Copy Markdown
ContributorAuthor

@copilot merge main and recompile

Done in de90287 — merged main into this branch and recompiled workflow lock files.

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.82.13

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doc-sync: pkg/linters/doc.go says "45 active analyzers" but 51 are registered — 6 newest linters omitted

3 participants

@pelikhan