[sergo] Sergo Report: Stale-Memory Resync + Detector Repair + Newest-Linter Audit (stringbytesroundtrip) - 2026-07-24 #47705
Closed
Replies: 1 comment
|
This discussion has been marked as outdated by Sergo - Serena Go Expert. A newer discussion is available at Discussion #47917. |
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
R61. This run recovered from stale local memory and repaired a broken registry detector, then audited the newest un-analyzed custom linter. Net: 1 high-quality issue filed (#47704) against
stringbytesroundtrip, plus two durable infrastructure corrections for future runs.gh api ...issues?labels=sergois the ground truth; the localsergo-strategies.jsonlwas not.grep -c Analyzer cmd/linters/main.gonow returns0—main.gowas refactored tomultichecker.Main(linters.All()...). New detector installed:grep -c '.Analyzer,' pkg/linters/registry.go.Tool updates
cmd/linters/main.gotopkg/linters/registry.go(linters.All()), which is now the canonical importable list driving multichecker, tests, and doc-completeness.pkg/linters/doc.goheader reads "57 active analyzers" and matches the registry — the recurring doc-sync drift finding (e.g. doc-sync guard is incomplete: {registry, spec_test} and {doc.go, README} are two disconnected clusters — a linter present in cod [Content truncated due to length] #47190, doc-sync: pkg/linters/doc.go says "53 active analyzers" but 54 are registered — timenowsub is omitted #46707, doc-sync: pkg/linters/doc.go says "52 active analyzers" but 53 are registered — trimleftright is omitted #46527) is currently closed; not re-filed.Strategy (50/50 split)
Cached component — reconcile + doc-sync/enforce audit (proven veins).
gh apireconcile first: zero open sergo issues (team closes fast). Confirmed doc.go/registry count parity (57 = 57) → skipped the doc-sync issue as non-actionable this run.cgo.yml:1217): 26 analyzers enforced; the newest linters (including the audit target) are not.New exploration — audit the newest, never-analyzed linter.
stringbytesroundtrip(line 113 ofregistry.go) as the only recent linter with no corresponding sergo issue in the fullstate=allhistory.Run targets: ≥1 concrete, evidence-backed finding on the newest linter; 0 duplicates; repair the detector so R62 doesn't mis-read the registry. All met.
Findings
stringbytesroundtrip — asymmetric round-trip semantics (filed #47704)
The linter flags both directions of a string/[]byte round-trip with identical "redundant round-trip / wasteful intermediate copy" wording, but they are not symmetric:
string([]byte(s)), s strings(strings immutable)[]byte(string(b)), b []byteb[]byte(string(b))is the canonical pre-slices.Clonedeep-copy idiom; the result deliberately does not aliasb. Labeling it "redundant" (doc: "leave the caller with the same underlying type as the input") is wrong — acting on it by rewriting tobintroduces an aliasing bug.testdata/.../stringbytesroundtrip.go:27,36encode this direction as intended (// want ...redundant round-trip), so the golden test locks in the false-positive framing.Underlying()+IsType()gating) is otherwise alias/named-type safe.[]byte(string(b))arm to recommendslices.Clone(b)/bytes.Clone(b)(single copy) instead of implying removal, or drop that arm and keep the provably-redundantstring([]byte(s))half.Generated task
T1 — Correct the
[]byte(string(b))diagnostic in stringbytesroundtrip.stringbytesroundtrip.go:118-125(message),:1-5/:23(doc),testdata/.../stringbytesroundtrip.go:27,36(goldenwant).slices.Clone/bytes.Clonesuggestion, or drop the arm.string([]byte(s))arm unchanged; byte-slice message no longer implies value-equality withb; doc/golden updated; re-confirm enforce-safety before any cgo.yml addition.Metrics
string([]byte(s))arm verified correct, type analysis verified alias-safe).Historical context
Continues the new-linter-audit vein that has landed repeatedly (writebytestring #44187, bytescomparestring #44484, sprintfbool #46978, stringsjoinone #47467). The recurring doc-sync vein was skipped this run because the registry and doc.go are already in sync at 57.
Recommendations & next-run focus (R62)
grep -c '.Analyzer,' pkg/linters/registry.go(watch for the 58th analyzer).gh apireconcile first — local jsonl memory can silently freeze while runs continue.References: §30067684687
All reactions