Skip to content

refactor(linters): hoist duplicated analyzer helpers into astutil/analyzerutil - #53564

Merged
pelikhan merged 10 commits into
mainfrom
copilot/refactor-semantic-clustering
Aug 18, 2026
Merged

refactor(linters): hoist duplicated analyzer helpers into astutil/analyzerutil#53564
pelikhan merged 10 commits into
mainfrom
copilot/refactor-semantic-clustering

Conversation

CopilotAI commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Semantic clustering of pkg/linters found 8 clusters of duplicated helper logic re-implemented per analyzer package, despite internal/astutil and internal/analyzerutil already existing for exactly this purpose. One of the duplicates had silently diverged.

Changes

analyzerutil.Indexes

Every one of the 63 analyzers opened run with the same ten lines. Now:

noLintIndex, generatedFiles, err:=analyzerutil.Indexes(pass)
iferr!=nil {
returnnil, err
}

Both indexes are a guaranteed consequence of the Requires list already declared by analyzerutil.NewAtPath. Also applied to internal/resourcetracker.

New astutil helpers

HelperReplaces
IsRegexpCompileCall(pass, call, names...)2 copies of isRegexpCompileCall
HasConstantStringArg(pass, call, argIdx)2 copies of hasConstantStringPattern
UniverseErrorInterface()sprintferrdot, errorfwrapv
StringLitValue(expr)trimleftright, tolowerequalfold
IsInInitFunction(cur)packagelevelmutableslicemap, panic-in-library-code
NormalizeComparisonOperands(pass, expr, method)3 copies of normalizeOperands
SwapPkgImportEdits(...)shared body of buildImportEdits in sprintfbool/sprintfint

HasConstantStringArg takes an explicit index and guards out-of-range values; SwapPkgImportEdits leaves the orphan-fmt determination (which genuinely differs between the two callers) at the call site.

Behavioral changes worth reviewing

  • regexpcompileinfunction now covers MustCompilePOSIX/CompilePOSIX. This was the divergence: regexpdynamicpattern matched four names, regexpcompileinfunction only two, so the package-level-hoisting rationale silently didn't apply to POSIX compiles. Each linter now passes its name set explicitly. Package doc, analyzer description, README.md and testdata updated.
  • NormalizeComparisonOperands unwraps redundant parentheses for all three callers. Previously only stringsindexhasprefix did; stringsindexcontains and stringscountcontains now match (strings.Index(s, sub)) != -1 and gain testdata + .golden cases.

Tests

Unit tests for each new helper in astutil_test.go / analyzerutil_test.go, plus new analyzer testdata for the newly covered patterns. All existing pkg/linters testdata suites pass unchanged.


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 22.6 AIC · ⌖ 7.79 AIC · ⊞ 6.4K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 10.6 AIC · ⌖ 7.87 AIC · ⊞ 6.4K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 18 AIC · ⌖ 7.81 AIC · ⊞ 6.4K ·
Comment /souschef to run again


Caution

agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.

Details

Potential security threats were detected in the agent output.

Review the workflow run logs for details.

Run: https://github.com/github/gh-aw/actions/runs/32109331559> Generated by 👨‍🍳 PR Sous Chef · gpt54 · 30 AIC · ⌖ 11.4 AIC · ⊞ 8.8K ·

Comment /souschef to run again

CopilotAIand others added 3 commits August 18, 2026 03:03
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
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] Refactor duplicate helper clusters in pkg/lintersrefactor(linters): hoist duplicated analyzer helpers into astutil/analyzerutilAug 18, 2026
CopilotAI requested a review from pelikhanAugust 18, 2026 03:19
@pelikhan
pelikhan marked this pull request as ready for review August 18, 2026 04:04
CopilotAI balanced review requested due to automatic review settings August 18, 2026 04:04
@github-actions

github-actionsBot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actionsBot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actionsBot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

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

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actionsBot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Ponytail Reviewer completed successfully!

Ponytail review: this PR is itself a de-duplication refactor (hoisting repeated analyzer boilerplate into analyzerutil.Indexes and shared astutil helpers). Checked the new shared helpers (Indexes, IsRegexpCompileCall, HasConstantStringArg, NormalizeComparisonOperands, SwapPkgImportEdits, StringLitValue, UniverseErrorInterface, IsInInitFunction) against their call sites -- each has 2+ real callers immediately, no speculative generality or unused flexibility introduced. The regexpcompileinfunction/regexpdynamicpattern POSIX-variant fix is a correctness alignment, not scope creep.

Lean already. Ship.

net: -0 lines possible.

Generated by Ponytail Reviewer for #53564

@github-actions

github-actionsBot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

reviewed_at: 2026-08-18T00:00:00Z
review_event: REQUEST_CHANGES
top_themes:
- sprintferrdot false positive on fmt.Fscanf
files_reviewed:
- .github/workflows/daily-team-evolution-insights.lock.yml
- .github/workflows/mcp-inspector.lock.yml
- pkg/linters/internal/analyzerutil/analyzerutil.go
- pkg/linters/internal/astutil/astutil.go
- pkg/linters/sprintferrdot/sprintferrdot.go
- pkg/linters/regexpcompileinfunction/regexpcompileinfunction.go
- pkg/linters/regexpdynamicpattern/regexpdynamicpattern.go
- pkg/linters/stringsindexcontains/stringsindexcontains.go
- pkg/linters/stringscountcontains/stringscountcontains.go
- pkg/linters/stringsindexhasprefix/stringsindexhasprefix.go
- pkg/linters/sprintfbool/sprintfbool.go
- pkg/linters/sprintfint/sprintfint.go
- pkg/linters/panic-in-library-code/panic-in-library-code.go
- pkg/linters/packagelevelmutableslicemap/packagelevelmutableslicemap.go
- pkg/linters/tolowerequalfold/tolowerequalfold.go
- pkg/linters/trimleftright/trimleftright.go
comment_count: 1

Note

This comment is managed by comment memory.

It stores persistent context for this thread in the code block at the top of this comment.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · gpt54 · 14 AIC · ⌖ 6.94 AIC · ⊞ 7K ·
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.

Request changes

This refactor introduced at least one real regression: sprintferrdot now misclassifies fmt.Fscanf as a formatting API and will report bogus .Error() diagnostics on scan destinations.

Blocking theme
  • pkg/linters/sprintferrdot: scan functions were folded into formatting analysis, which changes analyzer behavior and creates false positives.

The rest of the helper extractions look mostly mechanical, but this regression is enough to block because it makes the linter incorrect.

🔎 Code quality review by PR Code Quality Reviewer · gpt54 · 14 AIC · ⌖ 6.94 AIC · ⊞ 7K
Comment /review to run again

Comments that could not be inline-anchored

pkg/linters/sprintferrdot/sprintferrdot.go:101

This refactor accidentally widens sprintferrdot from format functions to scan functions by treating fmt.Fscanf as if its variadic arguments were values being formatted, so fmt.Fscanf(r, &quot;%s&quot;, err.Error()) will now be flagged even though %s is consuming input rather than formatting an error.

<details><summary>💡 Why this blocks</summary>

The old helper extraction looked mechanical, but fmtFormatCallInfo now classifies Fscanf alongside Fprintf/Sprintf:

case&quot;Fprintf&quot;, &quot;Fs</details>

@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: refactor(linters) — hoist duplicated analyzer helpers into astutil/analyzerutil

The refactoring is clean and well-motivated. All linters consistently adopt analyzerutil.Indexes(), the new helper functions in astutil are well-documented, and the tests provide good coverage.

One blocking issue found:

HasConstantStringArg dereferences pass.TypesInfo without a nil guard, which will panic at runtime if TypesInfo is nil. The adjacent IsRegexpCompileCall function (added in the same commit) correctly guards with if !ok || pass.TypesInfo == nil { return false }. The same pattern should be applied here.

Non-blocking observations
  • SwapPkgImportEdits returns (nil, true) in two branches (needAdd only and removeOrphaned only) when the underlying edit helper returns (_, false). This is consistent with the existing AddImportEdit/RemoveImportEdit contracts, but callers should be aware that needed == true does not guarantee a non-empty edit slice.
  • The IsInInitFunction cursor loop is clear, but the comment "A node whose innermost enclosing function is a literal ... is not considered to be in init" could note that this applies transitively (any depth of nesting inside a func literal resets the answer to false).

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 50 AIC · ⌖ 8.96 AIC · ⊞ 5.7K

Comment threadpkg/linters/internal/astutil/astutil.go

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

Centralizes duplicated linter logic in shared analyzer/AST utilities, while expanding regexp and parenthesized-comparison coverage. Two unrelated workflow lock changes also disable strict compilation.

Changes:

  • Added shared analyzer indexes and AST helpers with unit tests.
  • Migrated analyzers and expanded regexp/comparison test coverage.
  • Regenerated two workflow locks with unrelated strict-mode changes.
Show a summary per file
FileDescription
pkg/linters/writebytestring/writebytestring.goUses shared index setup.
pkg/linters/wgdonenotdeferred/wgdonenotdeferred.goUses shared index setup.
pkg/linters/walkfuncerrshadow/walkfuncerrshadow.goUses shared index setup.
pkg/linters/uncheckedtypeassertion/uncheckedtypeassertion.goUses shared index setup.
pkg/linters/uncheckedflushreturn/uncheckedflushreturn.goUses shared index setup.
pkg/linters/trimleftright/trimleftright.goReuses string-literal helper.
pkg/linters/tolowerequalfold/tolowerequalfold.goReuses string-literal helper.
pkg/linters/timesleepnocontext/timesleepnocontext.goUses shared index setup.
pkg/linters/timenowsub/timenowsub.goUses shared index setup.
pkg/linters/timeafterleak/timeafterleak.goUses shared index setup.
pkg/linters/stringsjoinone/stringsjoinone.goUses shared index setup.
pkg/linters/stringsindexhasprefix/stringsindexhasprefix.goReuses comparison normalization.
pkg/linters/stringsindexcontains/testdata/src/stringsindexcontains/stringsindexcontains.go.goldenAdds expected parenthesized fixes.
pkg/linters/stringsindexcontains/testdata/src/stringsindexcontains/stringsindexcontains.goTests parenthesized comparisons.
pkg/linters/stringsindexcontains/stringsindexcontains.goReuses comparison normalization.
pkg/linters/stringscountcontains/testdata/src/stringscountcontains/stringscountcontains.go.goldenAdds expected parenthesized fixes.
pkg/linters/stringscountcontains/testdata/src/stringscountcontains/stringscountcontains.goTests parenthesized comparisons.
pkg/linters/stringscountcontains/stringscountcontains.goReuses comparison normalization.
pkg/linters/stringsconcatloop/stringsconcatloop.goUses shared index setup.
pkg/linters/stringreplaceminusone/stringreplaceminusone.goUses shared index setup.
pkg/linters/stringbytesroundtrip/stringbytesroundtrip.goUses shared index setup.
pkg/linters/strconvparseignorederror/strconvparseignorederror.goUses shared index setup.
pkg/linters/sprintfint/sprintfint.goReuses package-import edits.
pkg/linters/sprintferrorsnew/sprintferrorsnew.goUses shared index setup.
pkg/linters/sprintferrdot/sprintferrdot.goReuses built-in error helper.
pkg/linters/sprintfbool/sprintfbool.goReuses package-import edits.
pkg/linters/sortslice/sortslice.goUses shared index setup.
pkg/linters/seenmapbool/seenmapbool.goUses shared index setup.
pkg/linters/regexpdynamicpattern/regexpdynamicpattern.goReuses regexp and constant helpers.
pkg/linters/regexpcompileinfunction/testdata/src/regexpcompileinfunction/regexpcompileinfunction.goTests POSIX regexp detection.
pkg/linters/regexpcompileinfunction/testdata/src/regexpcompileinfunction/dot_import.goUpdates helper reference.
pkg/linters/regexpcompileinfunction/regexpcompileinfunction.goAdds POSIX coverage via shared helpers.
pkg/linters/README.mdDocuments POSIX regexp coverage.
pkg/linters/rawloginlib/rawloginlib.goUses shared index setup.
pkg/linters/panic-in-library-code/panic-in-library-code.goReuses init-function detection.
pkg/linters/packagelevelmutableslicemap/packagelevelmutableslicemap.goReuses init-function detection.
pkg/linters/ossetenvlibrary/ossetenvlibrary.goUses shared index setup.
pkg/linters/osgetenvlibrary/osgetenvlibrary.goUses shared index setup.
pkg/linters/osexitinlibrary/osexitinlibrary.goUses shared index setup.
pkg/linters/nilctxpassed/nilctxpassed.goUses shared index setup.
pkg/linters/mapdeletecheck/mapdeletecheck.goUses shared index setup.
pkg/linters/mapclearloop/mapclearloop.goUses shared index setup.
pkg/linters/logfatallibrary/logfatallibrary.goUses shared index setup.
pkg/linters/lenstringzero/lenstringzero.goUses shared index setup.
pkg/linters/lenstringsplit/lenstringsplit.goUses shared index setup.
pkg/linters/largefunc/largefunc.goUses shared index setup.
pkg/linters/jsonmarshalignoredeerror/jsonmarshalignoredeerror.goUses shared index setup.
pkg/linters/ioutildeprecated/ioutildeprecated.goUses shared index setup.
pkg/linters/internal/resourcetracker/resourcetracker.goUses shared index setup.
pkg/linters/internal/astutil/astutil.goAdds shared AST/type helpers.
pkg/linters/internal/astutil/astutil_test.goTests the new AST helpers.
pkg/linters/internal/analyzerutil/analyzerutil.goAdds shared index retrieval.
pkg/linters/internal/analyzerutil/analyzerutil_test.goTests shared index retrieval.
pkg/linters/httpstatuscode/httpstatuscode.goUses shared index setup.
pkg/linters/httprespbodyclose/httprespbodyclose.goUses shared index setup.
pkg/linters/httpnoctx/httpnoctx.goUses shared index setup.
pkg/linters/hardcodedfilepath/hardcodedfilepath.goUses shared index setup.
pkg/linters/goroutinemissingrecover/goroutinemissingrecover.goUses shared index setup.
pkg/linters/globwalkignorederror/globwalkignorederror.goUses shared index setup.
pkg/linters/generatedyamlheredoc/generatedyamlheredoc.goUses shared index setup.
pkg/linters/fprintlnsprintf/fprintlnsprintf.goUses shared index setup.
pkg/linters/fmterrorfnoverbs/fmterrorfnoverbs.goUses shared index setup.
pkg/linters/execcommandwithoutcontext/execcommandwithoutcontext.goUses shared index setup.
pkg/linters/excessivefuncparams/excessivefuncparams.goUses shared index setup.
pkg/linters/errstringmatch/errstringmatch.goUses shared index setup.
pkg/linters/errortypeassertion/errortypeassertion.goUses shared index setup.
pkg/linters/errormessage/errormessage.goUses shared index setup.
pkg/linters/errorfwrapv/errorfwrapv.goReuses built-in error helper.
pkg/linters/deferinloop/deferinloop.goUses shared index setup.
pkg/linters/ctxbackground/ctxbackground.goUses shared index setup.
pkg/linters/bytescomparestring/bytescomparestring.goUses shared index setup.
pkg/linters/bytesbufferstring/bytesbufferstring.goUses shared index setup.
pkg/linters/appendoneelement/appendoneelement.goUses shared index setup.
pkg/linters/appendbytestring/appendbytestring.goUses shared index setup.
.github/workflows/mcp-inspector.lock.ymlDisables strict compilation.
.github/workflows/daily-team-evolution-insights.lock.ymlDisables strict compilation.

Review details

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 76/76 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread.github/workflows/daily-team-evolution-insights.lock.yml
Comment thread.github/workflows/mcp-inspector.lock.yml
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (682 new lines in pkg/linters/internal/astutil, pkg/linters/internal/analyzerutil, and 63 analyzer packages) but did not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/53564-hoist-duplicated-analyzer-helpers-into-shared-packages.md — review and complete it before merging.

🔒 This PR cannot merge until an ADR is linked in the PR body.

📋 What to do next
  1. Review the draft ADR committed to your branch — it was generated from the PR diff
  2. Complete the missing sections — add context the AI couldn't infer, refine the decision rationale, and list real alternatives you considered
  3. Commit the finalized ADR to docs/adr/ on your branch
  4. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-53564: Hoist Duplicated Analyzer Helpers into Shared Packages

Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision.

❓ Why ADRs Matter

"AI made me procrastinate on key design decisions. Because refactoring was cheap, I could always say 'I'll deal with this later.' Deferring decisions corroded my ability to think clearly."

ADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors (and your future self) will thank you.

📋 Michael Nygard ADR Format Reference

An ADR must contain these four sections to be considered complete:

  • Context — What is the problem? What forces are at play?
  • Decision — What did you decide? Why?
  • Alternatives Considered — What else could have been done?
  • Consequences — What are the trade-offs (positive and negative)?

All ADRs are stored in docs/adr/ as Markdown files numbered by PR number (e.g., 0042-use-postgresql.md for PR #42).

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · sonnet46 · 91.5 AIC · ⌖ 21.7 AIC · ⊞ 9.1K ·
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor

PR #53564 Review Summary

Applied /codebase-design and /tdd (refactor_cleanup heuristic). Requesting changes on 4 test-coverage gaps and 1 interface-clarity issue.

📋 Issues found (6 inline comments)
FileIssue
astutil_test.go:1228TestIsInInitFunction missing case: FuncLit insideinit (should return false)
astutil_test.go:1133TestHasConstantStringArg missing case: constant-concat arg a + b
analyzerutil_test.go:104TestIndexesError missing case: malformed filecheck result
astutil.go:779NormalizeComparisonOperands returns flipped=true when no strings call found — ambiguous contract
regexpcompileinfunction.go:14Still imports internal filecheck directly for ShouldSkipFilename; analyzerutil.Indexes encapsulation is incomplete
astutil.go:743IsRegexpCompileCall nil-TypesInfo guard has no test

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 115.8 AIC · ⌖ 12 AIC · ⊞ 7.8K ·
Comment /matt to run again

github-actions[bot]
github-actionsBot previously requested changes Aug 18, 2026

@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 /codebase-design and /tdd — requesting changes on test-coverage gaps and one interface-clarity issue.

📋 Key Themes & Highlights

Key Themes

  • Test coverage gaps — Several new helpers lack tests for their documented edge cases: constant-concat args in HasConstantStringArg, nil-TypesInfo guard in IsRegexpCompileCall, FuncLit-inside-init in IsInInitFunction, and the malformed-filecheck error path in Indexes.
  • Interface contract ambiguityNormalizeComparisonOperands returns flipped=true even when no strings call is found; callers must independently guard with AsStringsMethodCall, but the signature doesn't make this mandatory.
  • Encapsulation leaksregexpcompileinfunction (and likely other callers of filecheck.ShouldSkipFilename) still imports the internal filecheck package despite analyzerutil.Indexes being introduced to hide it. The abstraction is incomplete.

Positive Highlights

  • ✅ Excellent mechanical consistency — the analyzerutil.Indexes one-liner refactors across 63 analyzers are clean and risk-free.
  • ✅ Behavioral fix for the MustCompilePOSIX/CompilePOSIX divergence is well-scoped and the testdata is updated.
  • HasConstantStringArg(argIdx) takes an explicit index and guards out-of-range cleanly.
  • SwapPkgImportEdits has thorough table-driven test coverage.
  • NormalizeComparisonOperands now applies paren-unwrapping to all three callers — good consistency win.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 115.8 AIC · ⌖ 12 AIC · ⊞ 7.8K
Comment /matt to run again

Comments that could not be inline-anchored

pkg/linters/internal/astutil/astutil_test.go:1228

[/tdd]TestIsInInitFunction doesn't cover a goroutine started frominit() — the spec comment says it should return false, but there's no test case for it.

<details>
<summary>💡 Suggested additional test case</summary>

The function initWithLit in the current test is not named init, so it doesn't exercise the documented invariant. The uncovered case is a FuncLit insideinit itself:

funcinit() {
gofunc() {
println(&quot;ingoroutineinsideinit&quot;) // should be …</details><details><summary>pkg/linters/internal/astutil/astutil_test.go:1133</summary>**[/tdd]**`TestHasConstantStringArg`doesn&#39;ttestaconcatenationoftwostringconstantswhichthedocsaysshouldreturn`true`. Missingthisedgecaseleavesagapbetweenthespecandthetests.
&lt;details&gt;
&lt;summary&gt;💡 Suggestedaddition&lt;/summary&gt;
```go
const a = &quot;x&quot;
const b = &quot;y&quot;
sink(a + b) // compile-time constant concat — should return true

This is the classic "expression built entirely from constants" case mentioned in the doc comment. Without it, a future refactor that breaks …

pkg/linters/internal/analyzerutil/analyzerutil_test.go:104

[/tdd]TestIndexesError only tests a malformed nolint result; there's no error-path test for a malformed filecheck result. If filecheck.Index is ever refactored to return a different type, the second error branch would silently regress.

<details>
<summary>💡 Suggested additional case</summary>

funcTestIndexesErrorFilecheck(t*testing.T) {
pass:=&amp;analysis.Pass{
ResultOf: map[*analysis.Analyzer]any{
nolint.Analyzer: nolint.DirectiveIndex{},
…
</details><details><summary>pkg/linters/internal/astutil/astutil.go:779</summary>**[/codebase-design]**`NormalizeComparisonOperands`swapsoperandswhenthestringsmethodisontheright, returning`(y, x, true)`. Butwhen*neither*operandisthestringscall, itreturns`(y, x, true)`meaning`left`isnotthestringscalland`flipped`ismisleadingly`true`. Callersthatrelyon`flipped`toreconstructtheoperatordirectionwillgetanincorrectresult.
&lt;details&gt;
&lt;summary&gt;💡 Detailandfixsuggestion&lt;/summary&gt;
Thetestatline1181confirmsthis: whenneitherop</details><details><summary>pkg/linters/regexpcompileinfunction/regexpcompileinfunction.go:14</summary>**[/codebase-design]**Thelinterstillimports`filecheck`and`nolint`directlyeventhough`analyzerutil.Indexes`nowwraps them. Theseimportsareonlyneededbecause`filecheck.ShouldSkipFilename`iscalleddirectlyonline50.Considerwhether`ShouldSkipFilename`shouldalsobesurfacedthrough`analyzerutil` (or`astutil`) tocompletetheencapsulationotherwisecallersstillneedtoknowabouttheinternalpackages.
&lt;details&gt;
&lt;summary&gt;💡 Whythismatters&lt;/summary&gt;
Thegoalof`anal…</details><details><summary>pkg/linters/internal/astutil/astutil.go:743</summary>**[/tdd]** `IsRegexpCompileCall` falls through silently when `pass.TypesInfo` is `nil` (the `!ok||pass.TypesInfo==nil` branch returns `false`). This is a correctness guard, but there&#39;s no test asserting the nil-TypesInfo path returns `false` without panicking.&lt;details&gt;&lt;summary&gt;💡 Suggested test&lt;/summary&gt;```go
// nil TypesInfo must not panic
call := &amp;ast.CallExpr{
Fun: &amp;ast.SelectorExpr{
X: ast.NewIdent(&quot;regexp&quot;),
Sel: ast.NewIdent(&quot;MustCompile&quot;),
},
}
passNilInf…
</details>

CopilotAI commented Aug 18, 2026

Copy link
Copy Markdown
ContributorAuthor

@copilot Please review the remaining blockers on this PR, refresh the branch if needed, then run the pr-finisher skill and report back with the current validation status.

  • Remaining unresolved fol...

PR finisher pass completed on 41e6fec.

  • Reviews: the remaining visible threads are either already fixed/replied (HasConstantStringArg nil TypesInfo, fixed in e6ffc3a) or outdated lock-file drift threads that were removed from the PR diff. I don’t have a thread-resolve API/tool in this sandbox, so those can be resolved in the UI.
  • Branch: refreshed; origin/main is 21b4067 and is an ancestor of HEAD.
  • Prior CI: inspected failing CGO job 95601696713; root cause was the stale Copilot SDK driver install-step test, fixed in a9ff4cf and included in HEAD.
  • Latest CI: current CGO/CWI/docs runs on 41e6fec are action_required with zero jobs, so they need a maintainer re-trigger.
  • Local validation: make test-unit, make test, and make recompile pass on the final clean tree. make fmt passes but produces unrelated formatter drift in files outside this PR; after reverting that drift, make lint fails only on pre-existing Prettier formatting in actions/setup/js/copilot_harness.test.cjs, actions/setup/js/detect_agent_errors.cjs, and actions/setup/js/detect_agent_errors.test.cjs, none of which are in this PR diff.

Hand-off: maintainer needs to re-trigger CI, resolve the already-addressed/outdated review threads, and decide whether to handle the unrelated JS Prettier drift separately before merge.

@github-actions

Copy link
Copy Markdown
Contributor

Triage

Category: refactor | Risk: medium | Priority: medium | Score: 55/100 (impact:25, urgency:10, quality:20)
Action: defer
Notes: Large internal refactor (+771/-606, 77 files) hoisting duplicated analyzer helpers into shared astutil/analyzerutil packages. Ready (not draft), 5 reviews / 14 comments, CHANGES_REQUESTED (github-actions bot, since dismissed once). Purely internal tooling refactor — no user-facing impact, so lower urgency; defer until CI/lint fully green and outstanding review comments addressed.

Generated by 🔧 PR Triage Agent · auto · 54.9 AIC · ⌖ 2.16 AIC · ⊞ 8.3K ·

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Please address the blocking review feedback below, refresh the branch if needed, then run the pr-finisher skill and report back with validation results and any remaining blockers.

Run: https://github.com/github/gh-aw/actions/runs/32107642621

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 18 AIC · ⌖ 7.81 AIC · ⊞ 6.4K ·
Comment /souschef to run again

CopilotAI commented Aug 18, 2026

Copy link
Copy Markdown
ContributorAuthor

@copilot Please address the blocking review feedback below, refresh the branch if needed, then run the pr-finisher skill and report back with validation results and any remaining blockers.

  • Unreso...

PR finisher pass completed on 41e6fec with no additional code changes needed.

  • Reviews: the three referenced threads are already addressed: nil TypesInfo was fixed/replied in e6ffc3a; the two workflow lock-file threads are outdated because the unrelated lock drift was removed from the PR diff. I don’t have an authenticated thread-resolve API in this sandbox, so they still need UI resolution if GitHub keeps them listed.
  • Branch: refreshed; origin/main (21b4067) is an ancestor of HEAD.
  • Prior CI: inspected job 95601696713; failure was the stale Copilot SDK driver install-step expectation, fixed in a9ff4cf. Later check runs on this head show those unit jobs passing.
  • Local validation: make fmt passed but produced unrelated formatter drift that I reverted; make lint still fails only on pre-existing Prettier formatting in unrelated JS files. make test-unit, make test, make recompile, and make agent-report-progress passed on the clean tree. Automated code review/CodeQL found no uncommitted analyzable changes in this pass.

Hand-off: maintainers should resolve the already-addressed/outdated review threads in the UI and re-trigger CI if a fresh run is required for merge.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

Caution

agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.

Details

Potential security threats were detected in the agent output.

Review the workflow run logs for details.

@copilot Please address the blocking review feedback below, refresh the branch if needed, then run the pr-finisher skill and report back with validation results and any remaining blockers.

  • Unresolved review threads (newest first):
  • No failed checks were listed in the compact queue for this run.
  • Branch refresh was requested for this PR.
  • Your latest reply indicates no further code changes are needed; please confirm whether these threads can now be resolved and whether CI only needs a maintainer re-trigger.

Run: https://github.com/github/gh-aw/actions/runs/32109331559

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 30 AIC · ⌖ 11.4 AIC · ⊞ 8.8K ·
Comment /souschef to run again

CopilotAI commented Aug 18, 2026

Copy link
Copy Markdown
ContributorAuthor

[!CAUTION]
agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation....

Confirmed on 41e6fec: no additional code changes are needed.

  • The three listed threads can be resolved: HasConstantStringArg nil TypesInfo was fixed/replied in e6ffc3a; the two workflow lock-file threads are outdated because the unrelated lock drift is no longer in the PR diff.
  • Branch is refreshed: the clone was unshallowed, origin/main is fetched, and origin/main is an ancestor of HEAD.
  • CI: no current failed checks were found. The prior failing job 95601696713 was inspected again; its Copilot SDK driver expectation failure is fixed in a9ff4cf, and later check runs show the main build/lint/test jobs passing. The latest agent job is still in progress, so any final CI freshness still requires maintainer confirmation/re-trigger if required.
  • Local validation: make agent-report-progress passed on the clean tree; automated code review had no changed files to review in this pass, and CodeQL skipped because this pass made no file changes.

Remaining blocker: I do not have a thread-resolve API in this sandbox, so maintainers need to resolve the already-addressed/outdated threads in the UI.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Please confirm the current state of the addressed review feedback on this PR, identify which remaining threads can now be resolved in the UI, and run the pr-finisher skill only if further edits are still needed.

  • Recent follow-up indicates no additional code changes are needed.
  • No failed checks were listed in the compact queue for this run.
  • Branch refresh was requested for this PR.
  • Please confirm whether the remaining work is limited to maintainer thread resolution / review cleanup / CI confirmation.

Run: https://github.com/github/gh-aw/actions/runs/32115672254

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 20 AIC · ⌖ 7.91 AIC · ⊞ 8.8K ·
Comment /souschef to run again

CopilotAI commented Aug 18, 2026

Copy link
Copy Markdown
ContributorAuthor

@copilot Please confirm the current state of the addressed review feedback on this PR, identify which remaining threads can now be resolved in the UI, and run the pr-finisher skill only if further e...

Confirmed on 41e6fec: no further edits are needed, so I did not run pr-finisher again.

Remaining UI cleanup can resolve these already-addressed threads:

  • HasConstantStringArg nil TypesInfo/helper coverage: fixed in e6ffc3a.
  • daily-team-evolution-insights.lock.yml drift: outdated; unrelated lock-file changes were removed from the PR diff.
  • mcp-inspector.lock.yml drift: outdated; unrelated lock-file changes were removed from the PR diff.

Branch status: refreshed locally; origin/main (21b4067) is an ancestor of HEAD. CI status: no current failed checks found; the prior job 95601696713 failed on the stale Copilot SDK driver “expected 3 steps, got 2” assertion, fixed in a9ff4cf. Current PR check runs show the main CI jobs passing, with only the latest Copilot comment-handling job still in progress. Local validation: make agent-report-progress passed on a clean tree.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Please confirm the current state of the addressed review feedback on this PR, refresh the branch if needed, then run the pr-finisher skill only if further edits are actually required.

  • No failed checks were listed in the compact queue for this run.
  • make fmt could not run in this sandbox, so no formatter push was attempted here.
  • Prior follow-up indicates the remaining work may be limited to maintainer thread resolution, stale review cleanup, and CI confirmation; please verify.

Run: https://github.com/github/gh-aw/actions/runs/32120796211

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 21.2 AIC · ⌖ 7.92 AIC · ⊞ 8.8K ·
Comment /souschef to run again

CopilotAI commented Aug 18, 2026

Copy link
Copy Markdown
ContributorAuthor

@copilot Please confirm the current state of the addressed review feedback on this PR, refresh the branch if needed, then run the pr-finisher skill only if further edits are actually required.

  • No...

Confirmed on 41e6fec: no further edits are required, so I did not run pr-finisher again.

Current state:

  • Review feedback is addressed. The remaining resolvable UI threads are the already-fixed HasConstantStringArg nil TypesInfo/helper coverage thread (e6ffc3a) and the two outdated workflow lock-file drift threads, since the unrelated lock drift is no longer in the PR diff.
  • Branch is refreshed enough for this verification: origin/main (21b4067) is fetched and is an ancestor of HEAD.
  • CI: no current failed PR checks found. The earlier job 95601696713 failed on the stale Copilot SDK driver “expected 3 steps, got 2” assertion, fixed in a9ff4cf; current main CI jobs on 41e6fec are passing, with only the latest Copilot comment-handling job still in progress.
  • Formatter: make fmt runs in this sandbox. It only produced unrelated formatter drift in .squad/*.json and actions/setup/js/*.cjs, which I reverted; the working tree is clean.

Remaining work appears limited to maintainer thread resolution / stale review cleanup / final CI confirmation.

@pelikhan
pelikhan merged commit 96d6fdb into mainAug 18, 2026
36 checks passed
@pelikhan
pelikhan deleted the copilot/refactor-semantic-clustering branch August 18, 2026 11:14
CopilotAI added a commit that referenced this pull request Aug 18, 2026
…lyzerutil (#53564)
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.87.1

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.

[refactor] Semantic clustering: 8 duplicate helper clusters in pkg/linters

4 participants

@gh-aw-bot@pelikhan