gate: staticcheck v0.8.2 bug checks as 40-staticcheck
A new CI step, .amadan/ci.d/40-staticcheck, runs `make staticcheck`: staticcheck v0.8.2 by `go run pkg@version` (no tool line in go.mod, so nothing joins the module graph the release binaries build from), with -tags rootrunner,carlos_cutover_witness. It is green only with no output at all. It is not part of make test. Its cache stays in the default user cache unless the environment sets an absolute GOCACHE, as a sandboxed runner does; then it goes inside that (rastrillo's rule). staticcheck.conf enables the SA checks only. S, ST, QF and U1000 stay off for now. Three SA families are off, each with its count and a follow-up to own it: SA1012 (177 nil contexts, 153 in internal/registry), SA1019 (70 deprecations) and SA4006 (70 values never read). The other SA findings, read one by one: - SA4000 (9): tests that call a function twice to check it is deterministic or cached. Same calls, now into two variables. - SA2001 (5): every empty critical section is a deliberate barrier (edge lbhealth, schedule hostgate, tunnelclient fence, two activator tests); each takes a //lint:ignore with its reason. - SA5000, SA1008, SA5012: the nil map write, the raw lower-case header key and the odd argument count are what their tests test; //lint:ignore. - SA6005: devboxfront_test compares with strings.EqualFold. - SA4010: apiinstances.go's local `hosts` slice was appended to and never read (a later block declares its own); removed. - SA4009: enqueueDemo's closure ignored its `life` argument and re-reads it inside the transaction; the parameter is now `_`. - SA4017/SA9003: regionalworker.go had an empty `if` whose body was a comment; the comment stays, the `if` goes. - movespolicy_test.go had a //lint:ignore SA1012 that matched nothing; now a plain comment. Census: hostbox's runHost body (no behaviour change) and staticcheck.conf as a new unit at the root; envelopes ., edge, hostbox, schedule and tunnelclient re-pinned for comment-only changes. Card: docs/superpowers/notes/census-proposal-audit-gate-vet-staticcheck.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 files changed,
+212
−26
.amadan/README.md+10 −1.amadan/ci.d/10-gate+1 −1.amadan/ci.d/40-staticcheck+19 −0.commitmsg+40 −0AGENTS.md+8 −0Makefile+38 −1docs/superpowers/notes/census-proposal-audit-gate-vet-staticcheck.md+23 −0internal/activator/hasuspect_test.go+1 −0internal/activator/rootfs_cmd_lease_test.go+2 −1internal/analytics/meter_test.go+1 −1internal/assetcache/store_test.go+1 −1internal/console/apiinstances.go+0 −2internal/console/demo_jobs.go+1 −1internal/console/jobs_test.go+2 −1internal/dbreads/admission_test.go+2 −1internal/edge/assetadmit_test.go+1 −0internal/edge/devboxfront_test.go+1 −1internal/edge/lbhealth.go+2 −1internal/grouproll/text_test.go+3 −2internal/host/mailswitch_test.go+2 −2internal/host/movespolicy_test.go+1 −1internal/hostactors/membershipread_test.go+1 −1internal/hostbox/regionalworker.go+2 −3internal/mail/smtppass_test.go+1 −1internal/provision/testdata/plan14-root-reads-audit-gate-vet-staticcheck.tsv+11 −0internal/provision/testdata/plan14-root-reads-chain.tsv+1 −0internal/release/ratchet_test.go+1 −1internal/runs/keys_test.go+1 −1internal/schedule/hostgate.go+1 −0internal/tunnelclient/upgrade.go+2 −1staticcheck.conf+32 −0
CI cancelled — superseded by a newer push — run details
diff --git a/.amadan/README.md b/.amadan/README.md| index 8d81510a1..3406166fc 100644 |
| --- a/.amadan/README.md |
| +++ b/.amadan/README.md |
| @@ -2,7 +2,7 @@ |
| `ci.d/` is this repo's gate, running on a self-hosted amadan runner. |
| **It is the only one.** `.github/workflows/ci.yml` was deleted on |
| -2026-08-24; nothing stands behind these three steps. A green run here |
| +2026-08-24; nothing stands behind these steps. A green run here |
| is the whole of what "green" means for this repo, and a red one is not |
| a discrepancy to reconcile against a more official run somewhere else. |
| @@ -33,6 +33,15 @@ no longer exists. |
| | `minio-contract` | `30-minio-contract` | MinIO on loopback, no container | |
| | `gofmt` | `10-gate` | repo-wide, via `make test` — see below | |
| +Two checks have no ancestor; the deleted workflow never ran them. They |
| +were added on 2026-11-16 after a code audit found the gate could not see |
| +them. |
| + |
| +| added | here | | |
| +|---|---|---| |
| +| tagged vet | `10-gate` | `go vet -tags rootrunner,carlos_cutover_witness ./...`, via `make test`: the root-runner tests are type-checked, not run | |
| +| `staticcheck` | `40-staticcheck` | `make staticcheck`: v0.8.2, bug checks only; `staticcheck.conf` names the families still off | |
| + |
| ## `gofmt`: ported by widening it, not by reproducing it |
| This section is the reason it was safe to delete the workflow, so it is |
diff --git a/.amadan/ci.d/10-gate b/.amadan/ci.d/10-gate| index 19a206a80..9bde76e88 100755 |
| --- a/.amadan/ci.d/10-gate |
| +++ b/.amadan/ci.d/10-gate |
| @@ -5,7 +5,7 @@ |
| # |
| # THIS IS THE GATE. Not a second home for one, not a copy kept beside a |
| # more authoritative run somewhere else: the definition of green for this |
| -# repo is what these three steps say it is. |
| +# repo is what these steps say it is. |
| # |
| # It did not start that way, and the change is recent enough to be worth |
| # writing down. Until 2026-08-24 the authority was |
diff --git a/.amadan/ci.d/40-staticcheck b/.amadan/ci.d/40-staticcheck| new file mode 100755 |
| index 000000000..f92e95c86 |
| --- /dev/null |
| +++ b/.amadan/ci.d/40-staticcheck |
| @@ -0,0 +1,19 @@ |
| +#!/bin/sh |
| +# staticcheck's bug checks (SA), pinned, over the whole module with the |
| +# rootrunner and carlos_cutover_witness tags. `make staticcheck` is the one |
| +# definition; this step only runs it, so a developer gets the same answer |
| +# with the same command. |
| +# |
| +# Its own step, not part of `make test`: a red here is a finding in the |
| +# code, and it should read as that, not as a failed test run. It also keeps |
| +# `make test` no slower for whoever did not ask for staticcheck. |
| +# |
| +# Which checks, and which families are off with a follow-up owning them, |
| +# is staticcheck.conf's business. The step is green only with no output at |
| +# all: a finding, or a //lint:ignore that no longer matches anything, fails |
| +# it. A deliberate case takes a `//lint:ignore <check> <reason>` on the |
| +# line above it. |
| +set -eu |
| +. .amadan/go-toolchain.sh |
| + |
| +make staticcheck |
diff --git a/.commitmsg b/.commitmsg| new file mode 100644 |
| index 000000000..c8459af1f |
| --- /dev/null |
| +++ b/.commitmsg |
| @@ -0,0 +1,40 @@ |
| +gate: staticcheck v0.8.2 bug checks as 40-staticcheck |
| + |
| +A new CI step, .amadan/ci.d/40-staticcheck, runs `make staticcheck`: |
| +staticcheck v0.8.2 by `go run pkg@version` (no tool line in go.mod, so |
| +nothing joins the module graph the release binaries build from), with |
| +-tags rootrunner,carlos_cutover_witness. It is green only with no output |
| +at all. It is not part of make test. Its cache stays in the default user |
| +cache unless the environment sets an absolute GOCACHE, as a sandboxed |
| +runner does; then it goes inside that (rastrillo's rule). |
| + |
| +staticcheck.conf enables the SA checks only. S, ST, QF and U1000 stay |
| +off for now. Three SA families are off, each with its count and a |
| +follow-up to own it: SA1012 (177 nil contexts, 153 in internal/registry), |
| +SA1019 (70 deprecations) and SA4006 (70 values never read). |
| + |
| +The other SA findings, read one by one: |
| +- SA4000 (9): tests that call a function twice to check it is |
| + deterministic or cached. Same calls, now into two variables. |
| +- SA2001 (5): every empty critical section is a deliberate barrier |
| + (edge lbhealth, schedule hostgate, tunnelclient fence, two activator |
| + tests); each takes a //lint:ignore with its reason. |
| +- SA5000, SA1008, SA5012: the nil map write, the raw lower-case header |
| + key and the odd argument count are what their tests test; |
| + //lint:ignore. |
| +- SA6005: devboxfront_test compares with strings.EqualFold. |
| +- SA4010: apiinstances.go's local `hosts` slice was appended to and |
| + never read (a later block declares its own); removed. |
| +- SA4009: enqueueDemo's closure ignored its `life` argument and re-reads |
| + it inside the transaction; the parameter is now `_`. |
| +- SA4017/SA9003: regionalworker.go had an empty `if` whose body was a |
| + comment; the comment stays, the `if` goes. |
| +- movespolicy_test.go had a //lint:ignore SA1012 that matched nothing; |
| + now a plain comment. |
| + |
| +Census: hostbox's runHost body (no behaviour change) and staticcheck.conf |
| +as a new unit at the root; envelopes ., edge, hostbox, schedule and |
| +tunnelclient re-pinned for comment-only changes. Card: |
| +docs/superpowers/notes/census-proposal-audit-gate-vet-staticcheck.md. |
| + |
| +Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
diff --git a/AGENTS.md b/AGENTS.md| index 77d7297c9..3ed0091e9 100644 |
| --- a/AGENTS.md |
| +++ b/AGENTS.md |
| @@ -280,6 +280,14 @@ anything. |
| - **GitHub follows amadan.** If GitHub's `main` is behind amadan's after a |
| merge, fast-forward it from amadan; never the other way round, and |
| never with anything that is not already on amadan's `main`. |
| +- `40-staticcheck` runs `make staticcheck` (v0.8.2, pinned): the `SA` |
| + bug checks, with the families still off listed in `staticcheck.conf`. |
| + It is green only with no output at all, and it is not part of |
| + `make test`. A deliberate case takes `//lint:ignore <check> <reason>` |
| + on the line above the one staticcheck reports; it ignores `//nolint`. |
| + `make test` also vets with `-tags rootrunner,carlos_cutover_witness`, |
| + so the root-runner tests must compile even though only the root runner |
| + runs them. |
| - `20-cross@5` adds `GOOS=darwin`/`windows`/`linux-arm64` compiles, one |
| per shard. **The gate is not Linux-only**: `internal/host` is linked |
| into the CLI, which people run on Macs, so a Linux-only type assumption |
diff --git a/Makefile b/Makefile| index 8abc7c913..ab4cd9be3 100644 |
| --- a/Makefile |
| +++ b/Makefile |
| @@ -7,7 +7,7 @@ LDFLAGS := -s -w -X github.com/carlosframework/platform/internal/version.Build=$ |
| GOOS ?= |
| GOARCH ?= |
| -.PHONY: test build build-console fmt census-card census-propose console-mockup-kit parity-doc |
| +.PHONY: test build build-console fmt staticcheck census-card census-propose console-mockup-kit parity-doc |
| # The build gate: vet, format, tests. `.amadan/ci.d/10-gate` runs this same |
| # target, so what CI checks and what you check are one definition. |
| @@ -32,6 +32,43 @@ build-console: |
| fmt: |
| gofmt -w . |
| +# staticcheck's bug checks, as CI runs them (.amadan/ci.d/40-staticcheck). |
| +# Not part of `make test`: it adds a few minutes of CPU that a developer |
| +# who did not ask for it should not pay. staticcheck.conf at the root says |
| +# which checks run, and which families are off until a follow-up fixes |
| +# them. |
| +# |
| +# Pinned, and fetched with `go run pkg@version` rather than a tool line in |
| +# go.mod: a tool's requirements would join the module graph the release |
| +# binaries are built from, and could move a shared dependency |
| +# (golang.org/x/tools, x/sync) under them. Bump the pin with the Go |
| +# toolchain (.amadan/go-toolchain.sh): a staticcheck older than the Go it |
| +# reads cannot decode that release's export data. |
| +# |
| +# The tags are the gate's tagged vet's (.amadan/test-gate.sh): the |
| +# root-runner tests and the cutover witnesses are read too. The one file |
| +# that drops out under rootrunner, internal/host/departure_queue_default.go, |
| +# is two one-line stubs; its rootrunner twin is read in its place. |
| +STATICCHECK := honnef.co/go/tools/cmd/staticcheck@v0.8.2 |
| +# staticcheck caches in the user cache directory (~/.cache/staticcheck), |
| +# which a sandboxed CI runner may mount read-only. Where the environment |
| +# hands make an absolute GOCACHE, staticcheck's cache goes inside it, |
| +# writable wherever Go's is and evicted with it. Otherwise (a laptop, this |
| +# repo's shared dev box) it stays in the default user cache. |
| +ifneq ($(filter /%,$(firstword $(GOCACHE))),) |
| +export STATICCHECK_CACHE ?= $(GOCACHE)/staticcheck |
| +endif |
| + |
| +# Green means no findings at all, not just a zero exit: a //lint:ignore |
| +# that no longer matches anything is reported, and the exit status alone |
| +# does not promise to count it. Findings go to stdout; go run's own |
| +# "downloading" lines go to stderr and are left alone. |
| +staticcheck: |
| + @out=$$(go run $(STATICCHECK) -tags rootrunner,carlos_cutover_witness ./...); rc=$$?; \ |
| + if [ -n "$$out" ]; then printf '%s\n' "$$out"; fi; \ |
| + if [ $$rc -ne 0 ] || [ -n "$$out" ]; then echo "staticcheck: findings above (staticcheck.conf says which checks run)" >&2; exit 1; fi; \ |
| + echo "staticcheck: clean" |
| + |
| # Regenerates docs/console-mockup-kit/shell.html: a signed-in console page |
| # from the real templates with every stylesheet inlined and an empty |
| # <main> to draw a mockup in (docs/console-mockup-kit/README.md). |
diff --git a/docs/superpowers/notes/census-proposal-audit-gate-vet-staticcheck.md b/docs/superpowers/notes/census-proposal-audit-gate-vet-staticcheck.md| new file mode 100644 |
| index 000000000..66e8a23ec |
| --- /dev/null |
| +++ b/docs/superpowers/notes/census-proposal-audit-gate-vet-staticcheck.md |
| @@ -0,0 +1,23 @@ |
| +# Census approval: audit-gate-vet-staticcheck |
| + |
| +Ruling `census-ruling-audit-gate-vet-staticcheck`. The independent reviewer approves or rejects every change below, 1 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26). |
| + |
| +| unit | change | read sites | what changed | |
| +|---|---|---|---| |
| +| `internal/hostbox/regionalworker.go` `RegionalWorker.runHost` | body | unchanged (5) | removed an empty if whose body was only a comment (staticcheck SA9003/SA4017: strings.HasPrefix result ignored); the comment stays. No behaviour change, no read added. | |
| + |
| +Envelopes re-pinned: `.`, `internal/edge`, `internal/hostbox`, `internal/schedule`, `internal/tunnelclient`. |
| + |
| +Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Reject if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner. |
| + |
| +Recorded dispositions, which each change must still satisfy: |
| + |
| +- `internal/hostbox/regionalworker.go` `RegionalWorker.runHost`: authority, task C,J2,J4. Basis: root-input |
| + |
| +New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff: |
| + |
| +- new `staticcheck.conf:external`: reads +file:external; written legacy, accepted-legacy, frozen |
| + |
| +Seal: `4eda67fee53800e2cfa4177b954c7f0fce6bdfcfbfe1aa2547ddcec3027b668b` → `61a426ea62ae3f6e842ba94f7ef15ba58c1be80bead8b74ca96269c7b8882301`. |
| + |
| +Overlay: `internal/provision/testdata/plan14-root-reads-audit-gate-vet-staticcheck.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/internal/activator/hasuspect_test.go b/internal/activator/hasuspect_test.go| index dd7e505a8..3c4df52e3 100644 |
| --- a/internal/activator/hasuspect_test.go |
| +++ b/internal/activator/hasuspect_test.go |
| @@ -497,6 +497,7 @@ func TestDepartureFailedHolderObservation(t *testing.T) { |
| s.a.OnDepartureSuspect = func(ref string) { |
| calls++ |
| s.a.mu.Lock() |
| + //lint:ignore SA2001 taking and releasing a.mu proves the callback runs off the lock |
| s.a.mu.Unlock() |
| if ref != "b" { |
| t.Fatalf("suspect %q", ref) |
diff --git a/internal/activator/rootfs_cmd_lease_test.go b/internal/activator/rootfs_cmd_lease_test.go| index 730f11aee..c76d3e9a7 100644 |
| --- a/internal/activator/rootfs_cmd_lease_test.go |
| +++ b/internal/activator/rootfs_cmd_lease_test.go |
| @@ -602,7 +602,8 @@ func TestHibernatingRootfsTickFallbackKillsItsRun(t *testing.T) { |
| case <-time.After(5 * time.Second): |
| t.Fatal("the tick asked no kill") |
| } |
| - a.mu.Lock() // the kill runs off a.mu |
| + a.mu.Lock() |
| + //lint:ignore SA2001 a barrier: taking a.mu proves the kill runs off it |
| a.mu.Unlock() |
| letGo() |
| a.rootfsTick() |
diff --git a/internal/analytics/meter_test.go b/internal/analytics/meter_test.go| index e719a13ee..4841604af 100644 |
| --- a/internal/analytics/meter_test.go |
| +++ b/internal/analytics/meter_test.go |
| @@ -241,7 +241,7 @@ func TestMeterRestartedPerAppOnStartDay(t *testing.T) { |
| func TestVisitorHashAndEventName(t *testing.T) { |
| s1, s2 := []byte("salt-a"), []byte("salt-b") |
| - if VisitorHash(s1, "h", "ip", "ua") != VisitorHash(s1, "h", "ip", "ua") { |
| + if first, again := VisitorHash(s1, "h", "ip", "ua"), VisitorHash(s1, "h", "ip", "ua"); first != again { |
| t.Fatal("deterministic") |
| } |
| if VisitorHash(s1, "h", "ip", "ua") == VisitorHash(s2, "h", "ip", "ua") { |
diff --git a/internal/assetcache/store_test.go b/internal/assetcache/store_test.go| index f46b8537a..672c2cc46 100644 |
| --- a/internal/assetcache/store_test.go |
| +++ b/internal/assetcache/store_test.go |
| @@ -114,7 +114,7 @@ func openStore(t *testing.T, dir string) *Store { |
| func TestKeyIDIsStableAndDistinct(t *testing.T) { |
| a := Key{Account: "abc", App: "shop", Gen: "g1", Host: "shop.example.com", Path: "/a.css", RawQuery: "v=1"} |
| - if a.ID() != a.ID() { |
| + if first, again := a.ID(), a.ID(); first != again { |
| t.Fatal("same key gave two ids") |
| } |
| if len(a.ID()) != 64 || strings.Trim(a.ID(), "0123456789abcdef") != "" { |
diff --git a/internal/console/apiinstances.go b/internal/console/apiinstances.go| index dd593f746..11acdc052 100644 |
| --- a/internal/console/apiinstances.go |
| +++ b/internal/console/apiinstances.go |
| @@ -451,7 +451,6 @@ func (s *Server) instanceHealth(ctx context.Context, recs []provision.Record) (h |
| // routeFor is the join reduced to the routes that ANSWER for these |
| // records, built once and used by both loops so the two can never drift. |
| routeFor := make(map[string]registry.Route, len(recs)) |
| - var hosts []string |
| unitByHost := map[string]string{} |
| for _, rec := range recs { |
| rt, ok := byHost[rec.Host] |
| @@ -475,7 +474,6 @@ func (s *Server) instanceHealth(ctx context.Context, recs []provision.Record) (h |
| continue |
| } |
| routeFor[rec.Host] = rt |
| - hosts = append(hosts, rec.Host) |
| if rt.Unit != "" { |
| unitByHost[rec.Host] = rt.Unit |
| } |
diff --git a/internal/console/demo_jobs.go b/internal/console/demo_jobs.go| index 65d259e47..2a64879ff 100644 |
| --- a/internal/console/demo_jobs.go |
| +++ b/internal/console/demo_jobs.go |
| @@ -179,7 +179,7 @@ func scanDemoJob(row interface{ Scan(...any) error }) (demoJobRow, error) { |
| // under the app lock. A failed object write leaves the same durable outbox row. |
| func (s *Server) enqueueDemo(ctx context.Context, d DemoRow, src demobuild.Source) (demobuild.Job, error) { |
| var job demobuild.Job |
| - err := s.withDemoLocked(ctx, d.ID, func(current DemoRow, life AppLife) error { |
| + err := s.withDemoLocked(ctx, d.ID, func(current DemoRow, _ AppLife) error { |
| if current.Generation != d.Generation { |
| return errDemoJob |
| } |
diff --git a/internal/console/jobs_test.go b/internal/console/jobs_test.go| index 75dd0f63c..b2106f8b7 100644 |
| --- a/internal/console/jobs_test.go |
| +++ b/internal/console/jobs_test.go |
| @@ -181,7 +181,8 @@ func TestPanickingPassIsRecordedAndTheJobRunsAgain(t *testing.T) { |
| go func() { |
| errc <- fx.srv.jobs.Run(context.Background(), "StartAlertEngine", func(context.Context) error { |
| var m map[string]int |
| - m["boom"]++ // a nil map write: a runtime panic |
| + //lint:ignore SA5000 the nil map write is the runtime panic under test |
| + m["boom"]++ |
| return nil |
| }) |
| }() |
diff --git a/internal/dbreads/admission_test.go b/internal/dbreads/admission_test.go| index d6ac5f332..6aaa695cb 100644 |
| --- a/internal/dbreads/admission_test.go |
| +++ b/internal/dbreads/admission_test.go |
| @@ -30,7 +30,8 @@ func TestAdmissionTwoReadsThenBusy(t *testing.T) { |
| t.Fatalf("a third read: %v", err) |
| } |
| // The probe still has its connection (spec §7.1, codex 9). |
| - if !a.opened() || !a.opened() || !a.admitProbe(ctx) || !a.opened() { |
| + read1, read2, probe := a.opened(), a.opened(), a.admitProbe(ctx) |
| + if !read1 || !read2 || !probe || !a.opened() { |
| t.Fatal("two reads and a probe do not fit three connections") |
| } |
| if a.opened() { |
diff --git a/internal/edge/assetadmit_test.go b/internal/edge/assetadmit_test.go| index 4641ab14d..bc93ad4b3 100644 |
| --- a/internal/edge/assetadmit_test.go |
| +++ b/internal/edge/assetadmit_test.go |
| @@ -331,6 +331,7 @@ func TestStoredHeaderDropsHopAndPlatformHeaders(t *testing.T) { |
| t.Errorf("%s survived: %v", name, got[name]) |
| } |
| } |
| + //lint:ignore SA1008 the raw lower-case key set on the input above is what must not survive |
| if _, ok := got["x-carlos-lower"]; ok { |
| t.Error("a non-canonical x-carlos-* key survived") |
| } |
diff --git a/internal/edge/devboxfront_test.go b/internal/edge/devboxfront_test.go| index 6743ee9dc..6276fa827 100644 |
| --- a/internal/edge/devboxfront_test.go |
| +++ b/internal/edge/devboxfront_test.go |
| @@ -39,7 +39,7 @@ func assertNoVisitorHeaders(t *testing.T, h http.Header) { |
| t.Helper() |
| for k := range h { |
| for _, name := range []string{"Carlos-Visitor-Login", "Carlos-Visitor-Name", "Carlos-Visitor-Node"} { |
| - if strings.ToUpper(strings.ReplaceAll(k, "-", "_")) == strings.ToUpper(strings.ReplaceAll(name, "-", "_")) { |
| + if strings.EqualFold(strings.ReplaceAll(k, "-", "_"), strings.ReplaceAll(name, "-", "_")) { |
| t.Errorf("visitor header remains: %q = %q", k, h[k]) |
| } |
| } |
diff --git a/internal/edge/lbhealth.go b/internal/edge/lbhealth.go| index fcc58612c..3e84c0523 100644 |
| --- a/internal/edge/lbhealth.go |
| +++ b/internal/edge/lbhealth.go |
| @@ -70,7 +70,8 @@ func (e *Edge) servingPathLive() bool { |
| done := make(chan struct{}) |
| go func() { |
| c.mu.Lock() |
| - c.mu.Unlock() //nolint:staticcheck // take and release is the probe |
| + //lint:ignore SA2001 take and release is the probe |
| + c.mu.Unlock() |
| e.probing.Store(false) |
| close(done) |
| }() |
diff --git a/internal/grouproll/text_test.go b/internal/grouproll/text_test.go| index 37b8617c3..cab9b7478 100644 |
| --- a/internal/grouproll/text_test.go |
| +++ b/internal/grouproll/text_test.go |
| @@ -47,8 +47,9 @@ func TestTextRefusesProgrammingErrors(t *testing.T) { |
| for name, call := range map[string]func(){ |
| "unknown key": func() { Text("no_such_key") }, |
| "missing placeholder": func() { Text("journal") }, |
| - "odd args": func() { Text("journal", "path") }, |
| - "unused arg": func() { Text("journal", "path", "/p", "extra", "x") }, |
| + //lint:ignore SA5012 an odd argument count is the programming error under test |
| + "odd args": func() { Text("journal", "path") }, |
| + "unused arg": func() { Text("journal", "path", "/p", "extra", "x") }, |
| } { |
| t.Run(name, func(t *testing.T) { |
| defer func() { |
diff --git a/internal/host/mailswitch_test.go b/internal/host/mailswitch_test.go| index 4df301a10..cea10ed6a 100644 |
| --- a/internal/host/mailswitch_test.go |
| +++ b/internal/host/mailswitch_test.go |
| @@ -79,7 +79,7 @@ func TestMailSwitchCache(t *testing.T) { |
| t.Fatalf("a hit read the store again (%d reads)", st.n()) |
| } |
| // An app with no sender record is off, and cached. |
| - if c.State("abcxyz", "sheets") != off || c.State("abcxyz", "sheets") != off || st.n() != 2 { |
| + if first, again := c.State("abcxyz", "sheets"), c.State("abcxyz", "sheets"); first != off || again != off || st.n() != 2 { |
| t.Fatalf("absent record: %d reads", st.n()) |
| } |
| // A record with no submission block, or one switched off, is off. |
| @@ -107,7 +107,7 @@ func TestMailSwitchCache(t *testing.T) { |
| // A read error with nothing cached is unknown, never off (P2-2), |
| // logged once a minute, and retried only after mailSwitchRetryErr. |
| st.fail = errors.New("store down") |
| - if c.State("abcxyz", "calendar") != unknown || c.State("abcxyz", "calendar") != unknown { |
| + if first, again := c.State("abcxyz", "calendar"), c.State("abcxyz", "calendar"); first != unknown || again != unknown { |
| t.Fatal("an unreadable switch is not unknown") |
| } |
| if len(logs) != 1 || !strings.Contains(logs[0], "abcxyz/calendar") { |
diff --git a/internal/host/movespolicy_test.go b/internal/host/movespolicy_test.go| index 9e19dfe0a..397a4321a 100644 |
| --- a/internal/host/movespolicy_test.go |
| +++ b/internal/host/movespolicy_test.go |
| @@ -293,7 +293,7 @@ func TestMovesClaimPolicyRefusesOtherRoles(t *testing.T) { |
| if err := moves(ctx, c, s, hostwrite.Identity{}); !errors.Is(err, context.Canceled) { |
| t.Fatal(err) |
| } |
| - //lint:ignore SA1012 the nil context is the case under test |
| + // The nil context is the case under test. |
| if err := moves(nil, c, s, hostwrite.Identity{}); !errors.Is(err, ErrMovesRefused) { //nolint:staticcheck |
| t.Fatal(err) |
| } |
diff --git a/internal/hostactors/membershipread_test.go b/internal/hostactors/membershipread_test.go| index beb2f38cf..ba03bfc7c 100644 |
| --- a/internal/hostactors/membershipread_test.go |
| +++ b/internal/hostactors/membershipread_test.go |
| @@ -289,7 +289,7 @@ var newRef = GroupBoxReference("123", "i-new") |
| // reference is a pseudonym of account and instance, stable, and outside |
| // the label space. |
| func TestGroupBoxReferencesDoNotCollide(t *testing.T) { |
| - if GroupBoxReference("123", "i-0a61f580df1acfa65") != GroupBoxReference("123", "i-0a61f580df1acfa65") { |
| + if first, again := GroupBoxReference("123", "i-0a61f580df1acfa65"), GroupBoxReference("123", "i-0a61f580df1acfa65"); first != again { |
| t.Fatal("not stable") |
| } |
| if GroupBoxReference("123", "i-a") == GroupBoxReference("124", "i-a") { |
diff --git a/internal/hostbox/regionalworker.go b/internal/hostbox/regionalworker.go| index a88b5f04a..6520b73be 100644 |
| --- a/internal/hostbox/regionalworker.go |
| +++ b/internal/hostbox/regionalworker.go |
| @@ -226,9 +226,8 @@ func (w RegionalWorker) runHost(ctx context.Context, host string) error { |
| } |
| o.Park = &scope |
| } |
| - if o.Kind == "park-replica" && o.Park != nil && strings.HasPrefix(o.Park.Location, "moves/"+host+"/") { |
| - // park-staging uses the existing park-replica shape and moves scope. |
| - } |
| + // park-staging uses the existing park-replica shape and moves scope: |
| + // a park-replica op under moves/<host>/ needs nothing more here. |
| if err := w.Regional.Run(ctx, park.Work{Host: host, ID: o.ID, Op: o.Op}); err != nil { |
| if errors.Is(err, park.ErrPending) { |
| pending = true |
diff --git a/internal/mail/smtppass_test.go b/internal/mail/smtppass_test.go| index 324c06b58..c9f905d98 100644 |
| --- a/internal/mail/smtppass_test.go |
| +++ b/internal/mail/smtppass_test.go |
| @@ -39,7 +39,7 @@ func TestSMTPPasswordIsRegionScoped(t *testing.T) { |
| func TestSMTPPasswordIsDeterministic(t *testing.T) { |
| secret := "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" |
| - if SMTPPassword(secret, "eu-west-1") != SMTPPassword(secret, "eu-west-1") { |
| + if first, again := SMTPPassword(secret, "eu-west-1"), SMTPPassword(secret, "eu-west-1"); first != again { |
| t.Fatal("derivation is not deterministic") |
| } |
| } |
diff --git a/internal/provision/testdata/plan14-root-reads-audit-gate-vet-staticcheck.tsv b/internal/provision/testdata/plan14-root-reads-audit-gate-vet-staticcheck.tsv| new file mode 100644 |
| index 000000000..983470112 |
| --- /dev/null |
| +++ b/internal/provision/testdata/plan14-root-reads-audit-gate-vet-staticcheck.tsv |
| @@ -0,0 +1,11 @@ |
| +# Census overlay audit-gate-vet-staticcheck, written by census-propose (#369). census-ruling-audit-gate-vet-staticcheck, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-audit-gate-vet-staticcheck.md. |
| +# 1 body, 0 sites, 5 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +# 1 new dispositions: 0 reads re-frozen at their disposition with the claim, 1 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other. |
| +@legacy 6ed96f0dc2e712f8d9b92a596f446a04acc80010c61c6b1484a911076e037dce staticcheck.conf external legacy accepted-legacy accepted-legacy;rev3=census-ruling-audit-gate-vet-staticcheck;basis=new: staticcheck configuration at the module root (which SA checks run). Read only by the staticcheck tool in CI and make staticcheck; nothing in the root binary reads it. No read added. file:external@0 d2b2d75c3f91e6751d17759fec6fc40a8bece2f47fbb31cb8e756a9c8397ccb9 |
| +internal/hostbox/regionalworker.go RegionalWorker.runHost authority C,J2,J4 root-input;rev3=census-ruling-audit-gate-vet-staticcheck;basis=removed an empty if whose body was only a comment (staticcheck SA9003/SA4017: strings.HasPrefix result ignored); the comment stays. No behaviour change, no read added. file:Exec@2438,file:Read@2221,file:Read@227,file:Read@3079,file:Read@513 a834c97e73e57e2c1c50a034492291335b30d3cb4f1e574d8f69011c57acf4ad |
| +staticcheck.conf external legacy accepted-legacy accepted-legacy;rev3=census-ruling-audit-gate-vet-staticcheck;basis=new: staticcheck configuration at the module root (which SA checks run). Read only by the staticcheck tool in CI and make staticcheck; nothing in the root binary reads it. No read added. file:external@0 d2b2d75c3f91e6751d17759fec6fc40a8bece2f47fbb31cb8e756a9c8397ccb9 |
| +@coverage . 8ffa200e1e12d845e51d43acc487d5e3a699498cc39a63e54e796b55f510fcaa |
| +@coverage internal/edge 8983926022b8550b4b0f083263597d33b8125f4ac8db2fb9defb7d1d9a84ce7a |
| +@coverage internal/hostbox 077232c23a8d98b294e456c7196b466249ffb6614ec14e1901283880a5781459 |
| +@coverage internal/schedule e450d3b6c9becdca0324dacc4a90010c62813f74667dc35183a63b6c1648fc96 |
| +@coverage internal/tunnelclient edef6df2f9f7cb71991afde19db500b95f46e2dd5ea7accf1bc4b0290e6bb7ad |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index cf4ca8783..8b804f8ab 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -233,3 +233,4 @@ plan14-root-reads-fleet-first-reconcile-speed.tsv 9206205b2a3bf27b8b85310f4a44f9 |
| plan14-root-reads-free-storage-250.tsv 9206205b2a3bf27b8b85310f4a44f94ef0c5886d85d6e55dbf2f22e073a8af11 |
| plan14-root-reads-fleet-first-reconcile-speed-4.tsv 4eda67fee53800e2cfa4177b954c7f0fce6bdfcfbfe1aa2547ddcec3027b668b |
| plan14-root-reads-sec-edge-redirect-linklocal.tsv 4eda67fee53800e2cfa4177b954c7f0fce6bdfcfbfe1aa2547ddcec3027b668b |
| +plan14-root-reads-audit-gate-vet-staticcheck.tsv 61a426ea62ae3f6e842ba94f7ef15ba58c1be80bead8b74ca96269c7b8882301 |
diff --git a/internal/release/ratchet_test.go b/internal/release/ratchet_test.go| index cea6cf622..f456ce188 100644 |
| --- a/internal/release/ratchet_test.go |
| +++ b/internal/release/ratchet_test.go |
| @@ -125,7 +125,7 @@ func TestRatchetDirs(t *testing.T) { |
| func TestSharedRatchetIsOnePerDirectory(t *testing.T) { |
| d := t.TempDir() |
| - if SharedDigestRatchet(d, nil, false) != SharedDigestRatchet(d, nil, false) { |
| + if first, again := SharedDigestRatchet(d, nil, false), SharedDigestRatchet(d, nil, false); first != again { |
| t.Fatal("two calls for the same directory built two ratchets") |
| } |
| } |
diff --git a/internal/runs/keys_test.go b/internal/runs/keys_test.go| index 120991aef..92e524220 100644 |
| --- a/internal/runs/keys_test.go |
| +++ b/internal/runs/keys_test.go |
| @@ -114,7 +114,7 @@ func TestValidFileHash(t *testing.T) { |
| } |
| func TestCallerOfSeparatesCallers(t *testing.T) { |
| - if CallerOf("svc:a") == CallerOf("user:a") || CallerOf("svc:a") != CallerOf("svc:a") || len(CallerOf("x")) != 64 { |
| + if first, again := CallerOf("svc:a"), CallerOf("svc:a"); first == CallerOf("user:a") || first != again || len(CallerOf("x")) != 64 { |
| t.Fatal("CallerOf does not name callers apart") |
| } |
| if CallerOf("svc:a") == ScopedKey("svc:a", "") { |
diff --git a/internal/schedule/hostgate.go b/internal/schedule/hostgate.go| index 9ed8cea0d..2008eeea0 100644 |
| --- a/internal/schedule/hostgate.go |
| +++ b/internal/schedule/hostgate.go |
| @@ -74,6 +74,7 @@ func (g *HostGate) Drain(ctx context.Context, host string) error { |
| go func() { |
| // The barrier is the acquisition itself: nothing runs inside it. |
| l.Lock() |
| + //lint:ignore SA2001 an empty critical section is the barrier |
| l.Unlock() |
| close(done) |
| }() |
diff --git a/internal/tunnelclient/upgrade.go b/internal/tunnelclient/upgrade.go| index c071ec79c..d5630e8ed 100644 |
| --- a/internal/tunnelclient/upgrade.go |
| +++ b/internal/tunnelclient/upgrade.go |
| @@ -388,7 +388,8 @@ func (c *upgradedConn) fence() { |
| if c.hookFence != nil { |
| c.hookFence() |
| } |
| - c.life.Lock() // an empty critical section: a barrier, not a guard |
| + c.life.Lock() |
| + //lint:ignore SA2001 an empty critical section: a barrier, not a guard |
| c.life.Unlock() |
| } |
diff --git a/staticcheck.conf b/staticcheck.conf| new file mode 100644 |
| index 000000000..a66272fd2 |
| --- /dev/null |
| +++ b/staticcheck.conf |
| @@ -0,0 +1,32 @@ |
| +# staticcheck's bug checks (SA) and nothing else, for now. `make |
| +# staticcheck` reads this, and so does CI's 40-staticcheck step. |
| +# |
| +# Off for now, on purpose: S (simplifications), ST (style), QF (quick |
| +# fixes) and U1000 (unused code). They are not bugs, and the audit's run |
| +# of staticcheck v0.8.2 (on 5b6d5374, 2026-11-16) found about 270 of |
| +# them: ST1005 118, U1000 68, ST1013 35, S1038 26. Turning one on is its |
| +# own branch, with the tree cleaned first, so the gate stays green. |
| +# |
| +# Three SA checks are off too, each a family too large to fix safely in |
| +# the branch that added this file. Counts are from that branch's run on |
| +# 15b1ee6b, with -tags rootrunner,carlos_cutover_witness. A follow-up owns each one: |
| +# fix the sites, then delete the line here. |
| +# |
| +# SA1012 177 sites: a nil context.Context passed to a function. 153 are |
| +# internal/registry production code (registry.go alone has 84), |
| +# which is in the root binary's graph, so a fix is a census |
| +# change; 20 more in internal/activator (3 outside tests). |
| +# SA1019 70 sites (20 outside tests): deprecated APIs, mostly |
| +# golang.org/x/net/http2's ClientConn, Transport and Server |
| +# (moved into net/http), then go/parser.ParseDir, |
| +# httputil.ReverseProxy's Director and ecdsa's raw key |
| +# coordinates. Each needs a real migration, not a rename. |
| +# SA4006 70 sites (10 outside tests): a value assigned and never |
| +# read. Most are test leftovers, but some outside tests hide a |
| +# real error that is never looked at, so each wants reading, |
| +# not deleting. |
| +# |
| +# Deliberate cases of an enabled check carry a `//lint:ignore <check> |
| +# <reason>` on the line above them (the empty critical sections that are |
| +# barriers, for instance). staticcheck ignores `//nolint` comments. |
| +checks = ["SA*", "-SA1012", "-SA1019", "-SA4006"] |