[sergo] Sergo Report: Reverify + uncheckedtypeassertion Self-Consistency Enforce Audit - 2026-05-31 #36061
Closed
Replies: 1 comment
-
|
This discussion has been marked as outdated by Sergo - Serena Go Expert. A newer discussion is available at Discussion #36185. |
Beta Was this translation helpful? Give feedback.
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.
-
🔬 Sergo Report: Reverify + uncheckedtypeassertion Enforce Audit
Date: 2026-05-31 · Run: R24 · Success Score: 9/10
Executive Summary
This run reverified last round's finding and audited the next unenforced linter for enforcement-readiness. sg23a1 landed: the maintainer enforced
jsonmarshalignoredeerror(appended-jsonmarshalignoredeerrortocgo.yml:1040) and triaged all 19 sites with//nolintreasons — the third consecutive run where an "audit registered-but-unenforced linter → enforce" finding shipped within the week. Enforced linter count is now 9 of 18.For new exploration, I audited
uncheckedtypeassertion(registered, never filed). A comprehensive scan of the entirepkg/+cmd/tree found exactly 2 single-value type-assertion violations — and, notably, both are inside the linter framework itself, in the two newest analyzers (jsonmarshalignoredeerror.go:26,strconvparseignorederror.go:34). All 16 sibling analyzers already use the safe two-value form. This is a near-zero-violation, trivially-triageable, self-consistency finding filed as sg24a1.Overall code-quality assessment: excellent and improving. The custom linter suite keeps tightening (5→8→9 enforced over three rounds), and product code is uniformly disciplined on type assertions — the only violations left are a 2-line regression in the framework's own newest code.
🛠️ Serena Tools Update
Tools Snapshot
The registered codebase linter count is unchanged at 18 (
cmd/linters/main.go:41-58). CI enforcement advanced from 8→9 flags.Capabilities used today
Grep(ripgrep) — primary AST-pattern hunting (single-value vs two-value assertions, chained/return/argument forms)Read— analyzer source inspection (exemption logic, canonical sibling idiom)gh api search/issues— sergo tracker reconciliationserena --help) for tool-list change detection📊 Strategy Selection
Cached Reuse Component (50%) — Reverify
Adapted strategy:
reverify-plus-unenforced-linter-zero-violation-audit(R20/R22/R23 lineage, avg score 9).jsonmarshalignoredeerror) confirmed ENFORCED & RESOLVED —-jsonmarshalignoredeerrorpresent incgo.yml:1040; the 19 sites carry//nolint:jsonmarshalignoredeerrorreasons (impossible-fail string/slice marshals) or proper error handling. Issue Triage & enforce jsonmarshalignoredeerror: 19 prod sites discard json.Marshal errors (silent corruption in code-gen) #35859 closed.New Exploration Component (50%) — Self-Consistency Enforce Audit
Novel approach: read the
uncheckedtypeassertionanalyzer's actual exemption rules, then exhaustively classify every.(T)in prod by AST form.Combined Rationale
Reverify protects against regressions and confirms the enforce-pipeline still flows; the new audit feeds it the next candidate. Together they form a self-reinforcing loop: each run enforces the previous finding and files the next near-zero-violation linter.
🔍 Analysis Execution
Codebase Context
pkg/linters/*(18 analyzers),pkg/workflow(frontmatter/expression parsing),cmd/linters/main.go,.github/workflows/cgo.ymlFindings Summary
📋 Detailed Findings
High Priority — sg24a1 (filed)
uncheckedtypeassertionis registered but unenforced. Exactly 2 prod single-value assertions remain, bothinsp := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector):pkg/linters/jsonmarshalignoredeerror/jsonmarshalignoredeerror.go:26pkg/linters/strconvparseignorederror/strconvparseignorederror.go:34The analyzer exempts only the two-value form, type-switch guards, and test files — so these are genuine violations. All 16 sibling analyzers use the safe form (
insp, ok := ...; if !ok { return nil, fmt.Errorf(...) }, e.g.ctxbackground.go:29-32). Fix the 2 lines → zero violations → enforce.Scan completeness evidence (why "exactly 2")
x.(T).method()panics: 0return x.(T)single-value forms: 0f(x.(T))/ composite forms: 0pkg/workflowfrontmatter assertions (filters.go,expression_*.go,trigger_parser.go,strict_mode_steps_validation.go,runtime_deduplication.go): all two-value with named bools (isOnMap,isPRMap,isString,isMap) — exempt vialen(Lhs)==2..(grep hits inflated by regex string literals (secrets\\.(...),MustCompile) — excluded as non-assertions.pkg/+cmd/: 2 (plus 2 doc-comment lines in the analyzer's own header).Info — Reverify confirmations
osexit/rawlog(R21),regexp/fprintln/strconv(R23),jsonmarshal(R24) all enforced — pattern holds.Low Priority — deferred / do-not-refile
largefunc(>60 lines) andexcessivefuncparams(>8 params): still unenforced with known violations from R5-6 (~17fn / ~11fn). Deferred — refactor-heavy, low historical landability (Tracking: 14 production functions inpkg/are >400 lines (function-length hot-spots) #31300 never acted upon).ctxbackground(~28 prod sites): real refactor, never filed; candidate for a scoped defensibility-tiering proposal in a future run.ossetenvlibrary(10 sites),contextcancelnotdeferred(6 sites),fileclosenotdeferred(zero-prod, dismissed solo).✅ Improvement Task Generated
Task 1: Fix 2 self-inconsistent assertions and enforce
uncheckedtypeassertionjsonmarshalignoredeerror.go:26andstrconvparseignorederror.go:34to the two-value form used by the 16 siblings, then append-uncheckedtypeassertiontocgo.yml:1040LINTER_FLAGS.make golint-custom.📈 Success Metrics
Reasoning: precise, fully-verified high-ROI finding aligned with the proven enforce-landing pattern; reverify confirmed prior win; comprehensive scan eliminates false positives. Not a 10 — only one actionable new issue, and the deferred metric/refactor linters were not deeply re-quantified this run.
📊 Historical Context
🎯 Recommendations
Immediate: merge sg24a1 — 2-line fix + 1 CI flag closes out the last near-zero-violation analyzer.
Long-term: after
uncheckedtypeassertionlands, the clean enforce candidates are exhausted. Remaining unenforced linters are refactor-heavy (ctxbackground,largefunc,excessivefuncparams), opt-in (errormessage), non-Go (ssljson), or maintainer-dismissed. Future value shifts toward scoped refactor proposals or watching for the next registered analyzer.🔄 Next Run Preview
errormessageopt-in scope audit, (b) deepctxbackground28-site defensibility tiering for a scoped refactor, (c) detect any newly-registered 19th linter (registry has grown ~1 analyzer every few runs).Generated by Sergo — The Serena Go Expert · Run ID: 26703919548 · Strategy: reverify-plus-uncheckedtypeassertion-self-consistency-enforce-audit
Beta Was this translation helpful? Give feedback.
All reactions