gate: vet the rootrunner tests; staticcheck bug checks in CI
From the Go audit (#1123), first batch item 4: - test-gate.sh gains a vet-tags job (go vet -tags rootrunner,carlos_cutover_witness ./...) beside the plain vet, so the 131 linux && rootrunner test files are type-checked by the gate. - staticcheck v0.8.2, pinned via go run, as .amadan/ci.d/40-staticcheck and make staticcheck. staticcheck.conf enables the SA (bug) checks; SA1012, SA1019 and SA4006 are excluded with counts for follow-ups. - Current SA findings fixed (tests: SA4000, SA6005) or suppressed with a stated reason (deliberate lock barriers). Production edits remove dead code only; no behaviour change. Reviewed by Astra (round 1, READY). Census approved on #280. A real bug SA4006 surfaced is filed as #1141. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Squashed from audit-gate-vet-staticcheck into main.
33 files changed,
+305
−27
.amadan/README.md+10 −1.amadan/ci.d/10-gate+1 −1.amadan/ci.d/40-staticcheck+19 −0.amadan/test-gate.sh+12 −1AGENTS.md+8 −0Makefile+41 −1docs/superpowers/notes/census-proposal-audit-gate-vet-staticcheck.md+23 −0docs/superpowers/reviews/FINDINGS-audit-gate-vet-staticcheck-R1.md+48 −0docs/superpowers/reviews/REVIEW-BRIEF-audit-gate-vet-staticcheck.md+70 −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 passed — 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..359991236 |
| --- /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 tag (the Makefile says why not the cutover witnesses' tag |
| +# too). `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/.amadan/test-gate.sh b/.amadan/test-gate.sh| index aca787753..f3eb2b69b 100755 |
| --- a/.amadan/test-gate.sh |
| +++ b/.amadan/test-gate.sh |
| @@ -4,7 +4,9 @@ |
| # |
| # What it checks is what `make test` always checked: launchctx's vet and |
| # tests, `go vet ./...`, a repo-wide `gofmt -l .`, and every test in every |
| -# package with -count=1. What changed is the shape of the run. |
| +# package with -count=1, plus a second vet with the rootrunner and |
| +# carlos_cutover_witness tags (see vet-tags below). What changed is the |
| +# shape of the run. |
| # |
| # The gate's wall clock was the slowest single package, because Go runs |
| # packages side by side but a package's own tests one after another. |
| @@ -167,6 +169,15 @@ discover() { |
| start launchctx sh -c 'cd launchctx && go vet ./... && go test ./... -count=1' |
| start vet go vet ./... |
| +# The tagged tests: about 130 test files behind `linux && rootrunner` (the |
| +# root runner's fixtures, nearly all in internal/host) and the cutover |
| +# witnesses. Only the root runner and the cutover-witness job below ever |
| +# compiled them, so a refactor could break a root-runner test and stay |
| +# green. Its own job rather than tags on the line above, because one file, |
| +# internal/host/departure_queue_default.go, is `!rootrunner` and would |
| +# drop out of the plain vet. Nothing here runs those tests: they need |
| +# root. |
| +start vet-tags go vet -tags rootrunner,carlos_cutover_witness ./... |
| start gofmt sh -c 'fmt_out=$(gofmt -l .); if [ -n "$fmt_out" ]; then echo "gofmt needed:"; echo "$fmt_out"; exit 1; fi; echo "gofmt -l .: clean"' |
| # The split packages' test lists, all at once. `go test -list` compiles the |
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..cd6258f01 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,46 @@ 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. |
| +# |
| +# -tags rootrunner, so the root-runner tests are read too. The one file |
| +# that drops out under it, internal/host/departure_queue_default.go, is two |
| +# one-line stubs; its rootrunner twin is read in its place. The cutover |
| +# witnesses' tag is not named here: TestCutoverWitnessControlsAreTagged |
| +# allows it only in .amadan/test-gate.sh and the files it builds, so no |
| +# Makefile target can ever build with it. Its two files are vetted by the |
| +# gate's vet-tags job and compiled by its cutover-witness job instead. |
| +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 ./...); 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..7b668b3e4 |
| --- /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: `3f7dc37d114377b168c6bc1ae48e7bf815dbc1f5a569274af642e00e7d08ca2a` → `d4d3f367ca135da40d2c392d22b51669281d2d8268c0a5aa22ebf738cbe65080`. |
| + |
| +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/docs/superpowers/reviews/FINDINGS-audit-gate-vet-staticcheck-R1.md b/docs/superpowers/reviews/FINDINGS-audit-gate-vet-staticcheck-R1.md| new file mode 100644 |
| index 000000000..b3d2781ef |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/FINDINGS-audit-gate-vet-staticcheck-R1.md |
| @@ -0,0 +1,48 @@ |
| +Reviewed round 1 at `4d5862b0470a6f55477cadfd438bb8c9a87fc1cc` against base `15b1ee6b6a65a52b82075003d8d6c2bcbb100ca5`. The difference from the brief’s implementation commit, `11602a45`, is the brief itself. |
| + |
| +**Findings:** no P1, P2, or P3 findings against this change. |
| + |
| +1. **Tagged vet covers the intended files.** The separate plain and tagged invocations at [.amadan/test-gate.sh:171](/home/paulca/amadan.net/carlos/platform-audit-gate-vet-staticcheck/.amadan/test-gate.sh:171) preserve coverage of `departure_queue_default.go` while type-checking the Linux root-runner tests and cutover witnesses. I counted 131 test files with `linux && rootrunner`, plus three supporting non-test files. Vet does not execute their tests. |
| + |
| + Coverage is still incomplete outside this slice: 14 non-Linux test files and the two `race_on_test.go` files remain outside these CI configurations. For example, `devbox_envfile_darwin_test.go` is excluded on Linux, and [.amadan/ci.d/20-cross@5:56](/home/paulca/amadan.net/carlos/platform-audit-gate-vet-staticcheck/.amadan/ci.d/20-cross@5:56) uses `go build`, which excludes tests. These are pre-existing gaps; handle cross-platform test compilation and race coverage separately. |
| + |
| +2. **Staticcheck’s pin, failure handling, and cache arrangement are sound.** [Makefile:55](/home/paulca/amadan.net/carlos/platform-audit-gate-vet-staticcheck/Makefile:55) pins v0.8.2 without adding its dependencies to the application module. The recipe rejects either nonempty diagnostic output or a nonzero exit. I exercised those cases with a stubbed `go` command, including output accompanied by exit status zero. |
| + |
| + Staticcheck is independent of `make test`. The Makefile leaves `GOCACHE` unchanged, creates no per-task Go cache, and places staticcheck’s cache beneath an explicitly supplied absolute `GOCACHE`. Otherwise it retains staticcheck’s default user cache. The locally available amadan runner source supplies writable repository caches and permits module-proxy access; that supports the implementation, but does not establish the live runner’s result. |
| + |
| +3. **The exclusions are an acceptable staged adoption.** [staticcheck.conf:15](/home/paulca/amadan.net/carlos/platform-audit-gate-vet-staticcheck/staticcheck.conf:15) names SA1012, SA1019, and SA4006 with historical counts and enables the remaining SA checks. I could not reproduce those counts in this sandbox. |
| + |
| + The two named production cases deserve different treatment: |
| + |
| + - At [apisubdomain.go:468](/home/paulca/amadan.net/carlos/platform-audit-gate-vet-staticcheck/internal/console/apisubdomain.go:468), the short declaration inside the missing-claim branch shadows `err`. After losing a create race, the reread updates the inner error, while the subsequent check sees the original `os.ErrNotExist`. A successful reread therefore still produces an unreadable refusal. This is a real, pre-existing correctness bug. Fix it in a focused follow-up by avoiding the shadow and testing the lost-create-race path. Its fault family is **error propagation across namespace claim retries**. |
| + - At [replicaplacement.go:126](/home/paulca/amadan.net/carlos/platform-audit-gate-vet-staticcheck/internal/host/replicaplacement.go:126), the publication error is discarded, but publication failures return `done=false`; lines 132–139 retain the work and schedule a retry. I found no lost-retry bug. Error reporting can be considered in the SA4006 follow-up. |
| + |
| + Neither requires expanding this gate-enablement branch into production behavior changes. |
| + |
| +4. **Every added suppression has a truthful reason.** The three production SA2001 suppressions preserve deliberate synchronization: the edge probes cache-lock availability, the scheduler waits for active readers, and the tunnel connection waits for writer users after closure. Their census verdicts appear below. |
| + |
| + The test suppressions likewise preserve their witnesses: callback execution outside `a.mu` at [hasuspect_test.go:497](/home/paulca/amadan.net/carlos/platform-audit-gate-vet-staticcheck/internal/activator/hasuspect_test.go:497); lock availability while a kill is held at [rootfs_cmd_lease_test.go:590](/home/paulca/amadan.net/carlos/platform-audit-gate-vet-staticcheck/internal/activator/rootfs_cmd_lease_test.go:590); the intentional nil-map panic at [jobs_test.go:183](/home/paulca/amadan.net/carlos/platform-audit-gate-vet-staticcheck/internal/console/jobs_test.go:183); raw lowercase header removal at [assetadmit_test.go:323](/home/paulca/amadan.net/carlos/platform-audit-gate-vet-staticcheck/internal/edge/assetadmit_test.go:323); and odd-argument rejection at [text_test.go:50](/home/paulca/amadan.net/carlos/platform-audit-gate-vet-staticcheck/internal/grouproll/text_test.go:50). |
| + |
| +5. **Production behavior is unchanged.** The removed `hosts` slice in [apiinstances.go:453](/home/paulca/amadan.net/carlos/platform-audit-gate-vet-staticcheck/internal/console/apiinstances.go:453) had no consumer. The renamed callback parameter in [demo_jobs.go:182](/home/paulca/amadan.net/carlos/platform-audit-gate-vet-staticcheck/internal/console/demo_jobs.go:182) was overwritten before use; the transaction still obtains and passes its own `life`. The regional-worker condition had an empty body and a side-effect-free predicate. |
| + |
| +6. **The edited tests retain their assertions.** The determinism and shared-instance tests still make two independent calls. Mail-switch tests retain repeated lookups and read-count checks. Admission still checks two read connections, one probe connection, and refusal of a fourth connection. `EqualFold` preserves the visitor-header comparison for the ASCII header names under test. No assertion was removed. |
| + |
| +7. **The documentation matches the implementation.** The README additions, AGENTS additions, and revised `10-gate` header accurately describe the separate tagged-vet and staticcheck jobs. The Makefile correctly explains why staticcheck omits the cutover tag: the existing guard restricts where that tag may appear. |
| + |
| +**Census verdicts** |
| + |
| +| Unit or envelope | Verdict and evidence | |
| +|---|---| |
| +| `RegionalWorker.runHost` | **Approve**, retaining `authority`, `C,J2,J4`, basis `root-input`. Read [regionalworker.go:171](/home/paulca/amadan.net/carlos/platform-audit-gate-vet-staticcheck/internal/hostbox/regionalworker.go:171) through line 286 and [park.go:17](/home/paulca/amadan.net/carlos/platform-audit-gate-vet-staticcheck/internal/hostbox/park.go:17) through line 49. Removing the empty condition changes no enrollment, ownership, evidence, request-limit, revision, or execution check. No new read or authority is introduced. | |
| +| `staticcheck.conf:external` | **Approve** `legacy` / `accepted-legacy`. Read [staticcheck.conf:1](/home/paulca/amadan.net/carlos/platform-audit-gate-vet-staticcheck/staticcheck.conf:1) through line 32 and its Makefile invocation. This is analysis-tool configuration, with no added root-runtime read. | |
| +| `.` envelope | **Approve.** Reviewed the root-level diff, including Makefile lines 35–73 and `staticcheck.conf`. No root Go implementation or application dependency change. | |
| +| `internal/edge` envelope | **Approve.** Read [lbhealth.go:53](/home/paulca/amadan.net/carlos/platform-audit-gate-vet-staticcheck/internal/edge/lbhealth.go:53) through line 86 and both changed tests. The production change only replaces the suppression comment; lock acquisition, timeout, and probe completion remain unchanged. | |
| +| `internal/hostbox` envelope | **Approve.** The only changed implementation is `runHost`, approved above. Its downstream ownership checks remain intact. | |
| +| `internal/schedule` envelope | **Approve.** Read [hostgate.go:44](/home/paulca/amadan.net/carlos/platform-audit-gate-vet-staticcheck/internal/schedule/hostgate.go:44) through line 87. The exclusive acquisition waits for existing readers; only a suppression comment was added. | |
| +| `internal/tunnelclient` envelope | **Approve.** Read [upgrade.go:276](/home/paulca/amadan.net/carlos/platform-audit-gate-vet-staticcheck/internal/tunnelclient/upgrade.go:276) through line 430. `finish` closes before fencing; writer and deadline operations retain their read locks and closed checks. The change is comment-only. | |
| + |
| +Validation completed: shell syntax, diff whitespace, formatting of every changed Go file, and the staticcheck recipe’s three exit/output cases. Tagged vet and real staticcheck execution were blocked by the read-only filesystem. Census tests were not run. Network restrictions prevented checking amadan CI; the census verdict has not been posted to #280. No files were edited, no subagents were spawned, and no full suites were run. |
| + |
| +Round 1 has no P1; the stopping rule ends this review. Exact-tip green CI and recording the census approval remain merge prerequisites. |
| + |
| +**READY** |
| \ No newline at end of file |
diff --git a/docs/superpowers/reviews/REVIEW-BRIEF-audit-gate-vet-staticcheck.md b/docs/superpowers/reviews/REVIEW-BRIEF-audit-gate-vet-staticcheck.md| new file mode 100644 |
| index 000000000..20a0d22ae |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/REVIEW-BRIEF-audit-gate-vet-staticcheck.md |
| @@ -0,0 +1,70 @@ |
| +# Review brief: branch audit-gate-vet-staticcheck, round 1 of 3 |
| + |
| +Repo carlos/platform, branch `audit-gate-vet-staticcheck`, commit 11602a453adbac58d12eed62df40e25e921a9c4e. |
| +Under review: the diff `origin/main...11602a453adbac58d12eed62df40e25e921a9c4e` (base 15b1ee6b). |
| +Authorities: AGENTS.md on main ("Build & test", "The census", "Stopping |
| +rules"), .amadan/README.md. Context: amadan discussion #1123 (Go audit |
| +backlog, first batch item 4). |
| + |
| +You are an independent reviewer and the census reviewer. Card: |
| +`docs/superpowers/notes/census-proposal-audit-gate-vet-staticcheck.md`. |
| +Give a verdict for every unit and envelope it lists, citing the lines you |
| +read, per AGENTS.md "Getting a change approved" step 4. |
| + |
| +## What to check |
| + |
| +1. The new `vet-tags` job in .amadan/test-gate.sh (`go vet -tags |
| + rootrunner,carlos_cutover_witness ./...`): does it really compile every |
| + tagged test file, and does the plain vet still cover the `!rootrunner` |
| + files? Any file with a build tag that is still never compiled by any |
| + gate job? |
| +2. `.amadan/ci.d/40-staticcheck` and `make staticcheck`: pinned, fails on |
| + any output, works on the CI runner (module fetch, cache location), does |
| + not slow `make test`. Does the GOCACHE rule match the machine policy |
| + (default user cache; never a per-task cache)? |
| +3. `staticcheck.conf`: SA only; the three excluded families (SA1012, |
| + SA1019, SA4006) are named with counts. Is any excluded check hiding a |
| + real bug that should be fixed here instead? (The implementer reports |
| + one: internal/console/apisubdomain.go ~467, a shadowed err; and |
| + internal/host/replicaplacement.go:126 ignored errors. Judge whether |
| + they belong in this branch or a follow-up.) |
| +4. Every `//lint:ignore` added: is the reason true? In particular the |
| + three production empty critical sections (internal/edge/lbhealth.go, |
| + internal/schedule/hostgate.go, internal/tunnelclient/upgrade.go): are |
| + they really deliberate barriers? |
| +5. Production edits (console/apiinstances.go dead slice, demo_jobs.go |
| + ignored parameter, hostbox/regionalworker.go empty if): behaviour |
| + unchanged? |
| +6. Test edits for SA4000 etc.: does each test still test what it did? |
| +7. Docs (.amadan/README.md tables, AGENTS.md, 10-gate header) true to |
| + the scripts. |
| + |
| +## Severity |
| + |
| +- **P1**: unsafe, would not compile, a test fails, or it would not work. |
| + Blocks merge. |
| +- **P2**: wrong or missing. Fixed without reopening this review. (The |
| + census, and review of any newly changed security, root, termination |
| + or production-storage behaviour, still check the fix; see AGENTS.md, |
| + "Stopping rules".) |
| +- **P3**: clarity or polish. Goes on a follow-up list; never a reason for |
| + another round. |
| + |
| +A P1 states its failure scenario and the evidence (file:line). Do not |
| +raise a P2 to P1 to keep the review open. |
| + |
| +## Output |
| + |
| +Findings ranked P1, P2, P3. Each gives the section or task, the problem, |
| +the evidence (file:line, verified), the failure scenario, a concrete |
| +fix and the invariant or trust boundary it breaks (that is its fault |
| +family). Then the census verdict per unit and envelope. End with exactly |
| +one verdict: |
| + |
| +- **READY**: no P1 and no P2. |
| +- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another |
| + round. |
| +- **NOT READY**: one or more P1s, listed. |
| + |
| +Do not edit files. Do not spawn Anthropic-model reviewers or subagents of |
| +your own. Do not run the full test suites. |
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..185d52764 |
| --- /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 d5fef8000a7fe08d0d75ef925033a192fa6682834c83b8e0c173bb78282289fd |
| +@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 164b0856c..a5ff51703 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -235,3 +235,4 @@ plan14-root-reads-fleet-first-reconcile-speed-4.tsv 4eda67fee53800e2cfa4177b954c |
| plan14-root-reads-sec-edge-redirect-linklocal.tsv 4eda67fee53800e2cfa4177b954c7f0fce6bdfcfbfe1aa2547ddcec3027b668b |
| plan14-root-reads-sec-unit-app-demobuild.tsv fea6bec1f00dace47aa6006bf8606602efda4cecfa4fe3c3890136c0fb27720c |
| plan14-root-reads-audit-request-path.tsv 3f7dc37d114377b168c6bc1ae48e7bf815dbc1f5a569274af642e00e7d08ca2a |
| +plan14-root-reads-audit-gate-vet-staticcheck.tsv d4d3f367ca135da40d2c392d22b51669281d2d8268c0a5aa22ebf738cbe65080 |
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"] |