[sergo] Sergo Report: Registry Delta 35→36 — New httpstatuscode Linter Fresh Audit - 2026-06-28
#42005
Closed
Replies: 1 comment
-
|
This discussion has been marked as outdated by Sergo - Serena Go Expert. A newer discussion is available at Discussion #42175. |
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.
-
Executive Summary
Run R50 detected a registry delta (35 → 36 analyzers): a brand-new 36th linter,
httpstatuscode, was registered atcmd/linters/main.go:72and had never been audited. A fresh deep audit found a precision flaw in its HTTP-context detection: it gates on hardcoded identifier/field spellings rather than type/domain, yielding both false negatives and false positives. One high-quality issue was filed. R49's two issues were reconciled as landed-but-open.Tool & Registry Updates
grep -c Analyzer main.go)httpstatuscodedoc.goheader30 active30 activeThe 36th linter was identified via the registry-delta detector (analyzer count vs cache) cross-checked against the never-referenced-in-cache set.
Strategy (50/50 split)
syntactic_matchfamily lens: Applied the provengh api sergo issues + grep CODEreconcile loop and the recurring syntactic/name-match → FP+FN pattern (cf. 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, errstringmatch coverage gap: only strings.Contains(err.Error(), ...) is flagged — HasPrefix/HasSuffix/EqualFold/Index on err.Err [Content truncated due to length] #40244, lenstringzero coverage gap: len(s) != 0 is flagged but the identical idiom len(s) > 0 (and len(s) < 1 / <= 0) escapes — relation [Content truncated due to length] #40581) as the audit lens.httpstatuscode(never previously audited), validated against real production call sites inpkg/cli/.Run targets: ≥1 evidence-backed finding on the new linter · ≤2 high-quality, non-duplicate issues · cache + registry delta recorded. All met.
Findings
Finding 1 (filed, #42004) — `httpstatuscode` context detection is spelling-gated, not type-gated
isHTTPStatusContext(pkg/linters/httpstatuscode/httpstatuscode.go:173-195) accepts exactly three spellings — identifierstatus/statusCodeand field.StatusCode— and the two branches are inconsistent::175-176): name-only (e.Name == "status" || e.Name == "statusCode"), no type check.:177-193): only.StatusCode, but rigorously type-resolved to an integer field (correct).False negatives (proven in-repo):
pkg/cli/firewall_policy.go:56,65declareStatus int(HTTP status). A directentry.Status == 200is not flagged because the selector branch rejects.Status; the code only lints because the author copies it into a local namedstatusfirst (firewall_policy.go:236-241).pkg/cli/gateway_logs_timeline.go:99declaresHTTPStatus int // HTTP response status code— unmatchable.code,httpStatus,respStatus,sc) are all missed.False positives: any non-HTTP integer named
status/statusCodein 100–599 (exit status, job-state enum, custom protocol code) is flagged with a hard-asserting HTTP message and wrong fix. TestdatacompareNonHTTP(:49-54) stays silent only because its operand is namedbuildNumber.Confirmed clean:
httpstatuscodewires bothinternal/nolint(:97,152) andfilecheck.IsTestFile(:149) — no nolint/test-skip parity gap (so it is not part of the #41844 cluster). Call-argument scope (e.g.w.WriteHeader(404)) is intentionally excluded by the analyzer's own doc ("used in comparisons") — not a bug.Reconciliation — prior open issues (grepped, still open)
#aw_sg49a1(nolint-parity 5-linter cluster) — LANDED, OPEN.#aw_sg49a2(fmterrorfnoverbs escaped-%%FN) — LANDED, OPEN.json.Unmarshal(data, &v)(ExprStmt) discards the error but is never inspected — only As [Content truncated due to length] #39982, sprintferrdot precision: verb handling {s,v} is wrong in both directions — %#v false positive, %q/%x/%X false negative #40434, lenstringzero coverage gap: len(s) != 0 is flagged but the identical idiom len(s) > 0 (and len(s) < 1 / <= 0) escapes — relation [Content truncated due to length] #40581, seenmapbool: duplicate diagnostics for set-maps declared inside function literals (double AST traversal) #40733, Threshold linters: excessivefuncparams lints test files (every sibling FuncDecl linter skips them); largefunc & excessivefuncpar [Content truncated due to length] #40734) remain open.Generated Task
httpstatuscodecontext detection — replace spelling allow-lists with type/domain checks: add the integer-type check to the Ident branch and widen accepted field names toStatus/HTTPStatuson the selector branch; add testdata forentry.Status == 200, anHTTPStatusfield, a non-HTTPstatus intenum (must stay silent), and an HTTP code in a non-status-named local. (Effort: small–medium, single file + testdata.)Metrics
#42004)httpstatuscodeissue)Historical Context
This is the third registry delta caught by the analyzer-count detector (R46 → lenstringsplit, R47 → stringreplaceminusone, R50 → httpstatuscode). Each new linter has surfaced an audit target on first inspection. The spelling-gate flaw here is the same
syntactic_match/pattern_set_too_narrowfamily that recurs across this linter suite — the selector branch even demonstrates the correct type-resolved approach the ident branch omits.Recommendations & Next-Run Focus (R51)
#42004).grep -c Analyzer main.govs 36 plus doc-omitted-minus-known (httpstatuscode now a known linter).doc.godrift (doc-sync: pkg/linters/doc.go says "29 active analyzers" but 30 are registered — list omits hardcodedfilepath and sprintferrdot #40436) widens to 30-vs-36 — worth a maintainer nudge.References:
Beta Was this translation helpful? Give feedback.
All reactions