[sergo] Sergo Report: 35th-Linter Delta (stringreplaceminusone CLEAN) + manualmutexunlock Object-Identity FN - 2026-06-25 #41378
Replies: 0 comments
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
R47 detected the 34→35 analyzer registry delta — a new linter,
stringreplaceminusone, was added. Fresh-audited it (came back clean and well-built), then applied cached precision patterns to never-deep-audited CI-enforced linters and uncovered a genuine soundness hole inmanualmutexunlock. 2 issues filed, both novel (no duplicates in open or closedsergohistory).stringreplaceminusone(35th) — audited CLEAN#41376,#41377)Tool & Registry Updates
grep -c Analyzer cmd/linters/main.go= 35 (was 34). The 35th,stringreplaceminusone, flagsstrings.Replace(s, old, new, -1)in favor of the idiomaticstrings.ReplaceAll.Strategy Split (50 cached / 50 new)
New exploration (50%) — fresh audit of the 35th linter + two never-deep-audited linters (
sortslice,execcommandwithoutcontext,manualmutexunlock).Cached reuse (50%) — applied
pattern_set_too_narrow,syntactic_stdlib_match,scope_boundary_funclit, andsuppression_enforce_gappatterns; reconciled R46 landings against live issue state.Findings
1. stringreplaceminusone (35th linter) — AUDITED CLEAN ✅
Notably well-built: type-resolved package identity via
astutil.IsPkgSelector, constant-folding viapass.TypesInfo(correctly catches named constants, not just literal-1), propernolint+ test-file skipping, and a correct autofix. Zero productionstrings.Replace(...,-1)sites and zerobytes.Replaceusages — so the only theoretical gap (abytes.Replacesibling) is low-value and was deliberately not filed.2. manualmutexunlock — object-identity collapse → masking false negative (FILED #41376)
This CI-enforced linter keys per-mutex state by
types.Object. For a field-selector receiver (a.mu), it usesSelections[r].Obj(), which returns the field declaration (guarded.mu) — shared by every instance of that struct type. Two distinct instancesa.mu/b.mucollapse to one map key; the second lock overwrites the first's state, and the second'sdefermasks the first's genuine non-deferred unlock. The violation silently passes CI. Order-dependent: when the manual unlock precedes the second lock, the re-lock report path coincidentally fires. Testdata only ever exercises a single instance (g.mu).3. nolint parity gap — 4 non-enforced context-family linters (FILED #41377)
execcommandwithoutcontext,ctxbackground,contextcancelnotdeferred, andtimesleepnocontexthave nointernal/nolintwiring — no inline//nolint:escape hatch for legitimate exceptions. Their family siblinghttpnoctxhas it. The prior parity sweeps (#37061/#37251) were explicitly scoped to CI-enforced linters, leaving this non-enforced set uncovered; distinct from #40734 (threshold linters).4–6. Cached reconcile
#41163(lenstringsplit FP) and#41164(ctxbackground FuncLit-scope FN) — both still open.sortslice— audited clean (type-resolvedObjectOf→PkgName.Imported().Path()=="sort", nolint + test-skip).execcommandwithoutcontext— correctly usesEnclosing(FuncDecl, FuncLit)(thescope_boundary_funclitlesson applied right) and type-resolvedos/exec; only defect is the missing nolint (folded into finding 3).syntactic_stdlib_matchholdouts (Linter precision: migrate the 3 remaining CI-enforced linters that match stdlib packages by identifier name to astutil.IsPkgSele [Content truncated due to length] #40243/Linter precision: two newest linters (fileclosenotdeferred, contextcancelnotdeferred) match stdlib packages by identifier name — [Content truncated due to length] #40435) remain open and unfixed.Generated Tasks
#41376) — composite key(ObjectOf(baseIdent), fieldObj)for selector receivers; add two-instance testdata. Effort: small.#41377) — mirrorhttpnoctxacross 4 packages. Effort: small–moderate.Metrics & Historical Context
object_identity_collapse—Selections[r].Obj()returns the field declaration (shared across instances), not the receiver instance; probe any linter keying state bytypes.Objectfrom aSelectorExprreceiver.Next-Run Focus (R48)
#41376/#41377.grep -c Analyzervs 35 + doc-omitted detector).panicinlibrarycode,regexpcompileinfunction,seenmapboolinternals,hardcodedfilepathrecheck.object_identity_collapseprobe to other selector-keyed linters.References:
Beta Was this translation helpful? Give feedback.
All reactions