Repository navigation
[sergo] Sergo Report: Cached-Reuse Enforce-Readiness + Registry Architecture Audit - 2026-08-02 #49711
Closed
Replies: 1 comment
|
This discussion has been marked as outdated by Sergo - Serena Go Expert. A newer discussion is available at Discussion #49903. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Executive Summary
This run (R61) surfaced a significant ~3-4 week gap in Sergo's own memory (last snapshot 2026-07-08, this run 2026-08-02) coinciding with a real architecture change in the linter registry. The core deliverable is a bundled enforce-readiness issue for two already-clean, currently-unenforced custom linters (
contextcancelnotdeferred,wgdonenotdeferred), backed by an exhaustive audit confirming several previously-recurring bug classes remain fully fixed across the (now much larger) analyzer set.Strategy split (50/50)
syntactic_stdlib_match,scope_boundary_funclit,suppression_enforce_gap,doc_syncgaps) — all previously tracked insergo-stats.jsonpatterns.grep -c Analyzer cmd/linters/main.go) silently broke due to a refactor, so diagnosing that and re-deriving ground truth was unplanned exploration.Tool & Registry Updates
cmd/linters/main.gono longer lists analyzers directly. It's now just:pkg/linters/registry.go(var allAnalyzers = []*analysis.Analyzer{...}+func All()).appendoneelement,bytesbufferstring,bytescomparestring,goroutinemissingrecover,hardcodedfilepath,ioutildeprecated,logfatallibrary,mapclearloop,mapdeletecheck,nilctxpassed,sprintfbool,stringbytesroundtrip,stringscountcontains,stringsindexhasprefix,stringsjoinone,timenowsub,trimleftright..github/workflows/cgo.yml(LINTER_FLAGSat line 1362, plus a second wasm-scoped gate at line 1365 covering./pkg/console ./pkg/parser ./pkg/styles ./pkg/tty ./pkg/workflow).main.gogrep is dead, usepkg/linters/doc.go's "All NN active analyzers" header or the length ofregistry.go'sallAnalyzersslice.Why this matters (memory-gap note)
The cached memory (
sergo-tools-list.json,sergo-stats.json) was last updated 2026-07-08 but this run is dated 2026-08-02 — a gap of roughly 3-4 weeks during which at least one architecture change and 17 new linters landed without a corresponding Sergo memory update. This suggests either skipped/failed runs or a memory-persistence issue in that window. Recommend checking whether scheduled Sergo runs executed normally during that period.Findings
1. Two ready-to-enforce, zero-violation linters (primary finding, issue filed)
contextcancelnotdeferred(pkg/linters/contextcancelnotdeferred/contextcancelnotdeferred.go):astutil.IsPkgSelector(pass, sel, "context")(line 152) — immune to the syntactic stdlib-match regression class fixed by Linter precision (regression): the syntactic stdlib-package-match migration never landed — 5 holdouts remain, 3 CI-enforced (#40 [Content truncated due to length] #43934.*ast.FuncLitboundaries (line 90-92) — immune to the ancestor-walk-crosses-closures class fixed by timesleepnocontext: enclosing-scope walk crosses arbitrary FuncLit boundaries — false positives + misleading fix for request/cal [Content truncated due to length] #42901/execcommandwithoutcontext: enclosing-scope walk crosses non-go/defer FuncLit boundaries — false positives + misleading fix (same [Content truncated due to length] #43683.filecheck.ShouldSkipFilename(line 64), which skips both test and generated files — the commonctx, cancel := context.WithCancel(...); cancel()test idiom is filtered at the file level.context.With{Cancel,Timeout,Deadline}call sites acrosspkg/cli,pkg/workflow,pkg/modelsdev: all either defer immediately or intentionally return theCancelFuncto the caller (verified this pattern is correctly not flagged).wgdonenotdeferred(pkg/linters/wgdonenotdeferred/wgdonenotdeferred.go):sync.WaitGroup.Done()sites in the whole tree (pkg/console/spinner.go:193,pkg/cli/forecast_compute.go:233), both already deferred.Both are correctness-clean and violation-free — safe, low-effort additions to
cgo.yml's enforced set. Filed as a single bundled issue (see Tasks below).2. Recurring bug classes re-verified as fully closed (negative/confirmatory audit)
syntactic_stdlib_match(rawident.Name == "pkg"instead of type-resolved matching): re-checkedsortslice,ioutildeprecated,hardcodedfilepath,timenowsub,strconvparseignorederror,timeafterleak,fileclosenotdeferred— all now usetypes.PkgName/astutil.IsPkgSelector. No holdouts found this run.scope_boundary_funclit(ancestor walks crossing closure boundaries): re-checkedhttprespbodyclose(prior httprespbodyclose: FuncDecl-only scope + FuncLit skip misses responses closed inside closures (goroutines/handlers) — false nega [Content truncated due to length] #43465, confirmed fixed —nodeFilternow treatsFuncDeclandFuncLitas independent roots and stops recursion at nestedFuncLits).suppression_enforce_gap(missing nolint/test-skip wiring, prior gap inlargefunc/excessivefuncparams): confirmed both now wirenolint.HasDirectiveForLinterandfilecheck.ShouldSkipFilenamecorrectly.pkg/linters/doc_sync_test.gonow comprehensively cross-validateslinters.All()registry vs.doc.gobullets vs.README.mdtable vs.spec_test.go— this gap is closed.3. Previously-fixed linter re-confirmed clean: writebytestring
The R60 finding (
isStringTypematching named string types whenio.WriteStringneeds an exactstring, causing a non-compilingSuggestedFix) was re-read this run: the fix is in place —isExactString(t types.Type) boolcorrectly checks*types.BasicwithKind() == types.String, andbuildStringExprwraps named types instring(...). No further action needed. (Note: did not re-rungh apito confirm issue #aw_sg60a1 is formally closed — flagged as a to-do for next run.)Tasks Generated
contextcancelnotdeferredandwgdonenotdeferredto CI enforcement (issue filed, labelsergo)cgo.yml'sLINTER_FLAGS.cgo.yml:1362;wgdonenotdeferredalso added atcgo.yml:1365(coverspkg/console, its only prod hit outsidepkg/cli).make golint-customwith new flags against./...returns zero findings before merging the CI change.Metrics
gh apireconcile pass and leavingseenmapboolpartially audited)Historical Context
sergo-stats.json'spatternsdict now records 8 recurring bug classes; this run's audit touchedsyntactic_stdlib_match,scope_boundary_funclit,suppression_enforce_gap, andenforce_readiness— all with clean results except the new enforce-readiness opportunity.ci_enforce_14field (stale, actually 33 enforced) has been corrected toci_enforce_33in memory with the current accurate list.Recommendations
gh api repos/OWNER/REPO/issues?labels=sergo&state=allreconciliation at the start of the next run (skipped this run due to sandbox friction) to confirm prior issues (especially #aw_sg60a1) have actually landed, not just been filed.Next-Run Focus (R62)
sergo-labeled issues viagh apifirst.ioutildeprecated,hardcodedfilepath,timenowsubwere spot-checked this run).seenmapboolproduction-violation audit (left incomplete this run).sprintferrdot,sprintferrorsnew,lenstringzero,errorfwrapv,excessivefuncparams,largefunc,deferinloop,errormessage.All reactions