carlos / platform Public

staticcheck: switch SA1012 on; replace nil contexts with Background

staticcheck.conf excluded SA1012 (a nil context passed to a function).
This clears the sites and turns the check on.

Nil context replaced by context.Background(), behaviour unchanged:

- internal/registry (151 sites): remoteClient.call and acquire treat
  Background as they treated nil. Its Done channel is nil, so waiting for
  the request slot still blocks until the slot is free; it has no
  deadline, so q.Deadline stays 0; it never ends, so the AfterFunc that
  closes the pipe never fires. No site had a ctx in scope, so no registry
  write became cancellable. The nil handling in remote.go stays.
- internal/activator/swaphold.go (3 sites): classifyStep only reads
  lifecycle.Err(), which is nil for Background. holdResult has sctx in
  scope and keeps Background on purpose, with a comment: passing sctx
  would turn a refused wake into a stop once the hold ended.
- Tests in internal/activator, internal/registry and the root package.

Eight test sites pass nil on purpose and now carry //lint:ignore SA1012:
the requestCtxDB recorder, where nil marks a call with no context, and
the refusal tests in internal/cgroup, internal/hostguard and
internal/stopevidence.

The ratchet is unchanged: host-context 187, db-no-context 897. The
root-read census overlay staticcheck-sa1012 re-freezes the changed units.
The record-write and group-name censuses needed no re-pin.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 83c7c2f56a49a4ee82c7160b01453d641f9fdee6 parent 5048247
34 files changed, +830 −183
  • deploywatch_test.go +1 −1
  • docs/superpowers/notes/census-proposal-staticcheck-sa1012.md +321 −0
  • internal/activator/beforeexec_test.go +1 −1
  • internal/activator/claimgen_test.go +1 −1
  • internal/activator/exec_gate_test.go +2 −2
  • internal/activator/logsink_test.go +2 −2
  • internal/activator/rootfs_invariants_test.go +1 −1
  • internal/activator/rootfs_resident_lease_test.go +1 −1
  • internal/activator/rootfs_staged_test.go +1 −1
  • internal/activator/rootfs_test.go +2 −2
  • internal/activator/stateless_fix1_test.go +1 −1
  • internal/activator/swaphold.go +5 −3
  • internal/activator/wakeplan_test.go +3 −3
  • internal/cgroup/cleanup_linux_test.go +1 −0
  • internal/console/requestctx_test.go +5 −0
  • internal/hostguard/flock_unix_test.go +1 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −0
  • internal/provision/testdata/plan14-root-reads-staticcheck-sa1012.tsv +303 −0
  • internal/registry/artifacthosts.go +5 −2
  • internal/registry/claimtimers.go +4 −3
  • internal/registry/fleets.go +15 −15
  • internal/registry/forward.go +4 −3
  • internal/registry/forward_test.go +3 −2
  • internal/registry/ha_duties.go +1 −1
  • internal/registry/homelink.go +13 −12
  • internal/registry/importjournal.go +1 −1
  • internal/registry/links.go +10 −9
  • internal/registry/registry.go +84 −84
  • internal/registry/remote.go +1 −1
  • internal/registry/replicas.go +5 −4
  • internal/registry/timer_materialization.go +3 −2
  • internal/registry/timers.go +15 −15
  • internal/stopevidence/reconstruct_linux_test.go +2 −1
  • staticcheck.conf +11 −9

CI cancelled — superseded by a newer push — run details

deploywatch_test.go

Loading diff…

docs/superpowers/notes/census-proposal-staticcheck-sa1012.md

Loading diff…

internal/activator/beforeexec_test.go

Loading diff…

internal/activator/claimgen_test.go

Loading diff…

internal/activator/exec_gate_test.go

Loading diff…

internal/activator/logsink_test.go

Loading diff…

internal/activator/rootfs_invariants_test.go

Loading diff…

internal/activator/rootfs_resident_lease_test.go

Loading diff…

internal/activator/rootfs_staged_test.go

Loading diff…

internal/activator/rootfs_test.go

Loading diff…

internal/activator/stateless_fix1_test.go

Loading diff…

internal/activator/swaphold.go

Loading diff…

internal/activator/wakeplan_test.go

Loading diff…

internal/cgroup/cleanup_linux_test.go

Loading diff…

internal/console/requestctx_test.go

Loading diff…

internal/hostguard/flock_unix_test.go

Loading diff…

internal/provision/testdata/plan14-root-reads-chain.tsv

Loading diff…

internal/provision/testdata/plan14-root-reads-staticcheck-sa1012.tsv

Loading diff…

internal/registry/artifacthosts.go

Loading diff…

internal/registry/claimtimers.go

Loading diff…

internal/registry/fleets.go

Loading diff…

internal/registry/forward.go

Loading diff…

internal/registry/forward_test.go

Loading diff…

internal/registry/ha_duties.go

Loading diff…

internal/registry/homelink.go

Loading diff…

internal/registry/importjournal.go

Loading diff…

internal/registry/links.go

Loading diff…

internal/registry/registry.go

Loading diff…

internal/registry/remote.go

Loading diff…

internal/registry/replicas.go

Loading diff…

internal/registry/timer_materialization.go

Loading diff…

internal/registry/timers.go

Loading diff…

internal/stopevidence/reconstruct_linux_test.go

Loading diff…

staticcheck.conf

Loading diff…