swarm: Go toolchain in the Sandcastle sandbox + pre-push lint gate — no more un-linted Go slices #198

Closed
opened 2026-07-30 23:17:55 +00:00 by ben · 2 comments
Owner

What happened (2026-07-30 evening)

The swarm drained #191–#195 impressively, but both post-burst seam reds trace to one cause: the Sandcastle sandbox has no Go toolchain, so Go-heavy slices ship verified by "careful review" only (#195's closing note says exactly this). Two lint defects reached main un-linted — #193's staticcheck SA4010 dead store and #195's revive shadowed-builtin — each costing a red seam cycle and a human-pushed fix (8fb0b96, 64afe3b).

What to build

Close the gap so a Go-touching slice cannot ship un-linted. Two complementary options — implement (1); (2) is the belt-and-braces backstop:

  1. Go toolchain in the Sandcastle sandbox: the worker environment gets the same pinned go + golangci-lint the seam runs (ideally by entering nix develop, ADR 0040 — CI, Sandcastle and humans in the same shell is already the stated rule; the sandbox is the one place it doesn't hold). Workers can then run go build/vet/test + golangci-lint on what they touched before pushing.
  2. Pre-push gate in the swarm harness: before a worker's commit is pushed, run the seam-smoke stages scoped to changed languages; a red gate turns the push into a worker-visible failure instead of a red main.

Mind the constraints that shaped the current sandbox (offline-safe --frozen-lockfile installs, the electron-binary denial) — the Go toolchain must come from the pinned dev shell, not ad-hoc downloads.

Acceptance criteria

  • Given a worker slice introducing a Go lint defect, When the worker finishes, Then the defect is caught before the push (worker fails or fixes), and main's seam stays green
  • Given a TypeScript-only slice, When the gate runs, Then the Go stages are skipped and the run isn't slower than today
  • Given the sandbox toolchain, When a worker enters it, Then versions match the seam's nix develop pins exactly (no version-drift findings like local golangci v1.64.8 vs the CI pin)

Task manifest

task: swarm:sandbox-go-toolchain
implements_seam: "ADR 0040 (one dev shell for CI, Sandcastle, humans) — extend it to the worker sandbox; scripts/seam-smoke.sh stages as the gate"
interface: ".sandcastle worker environment + pre-push gate"
seam: "a deliberate red-lint test slice caught pre-push"
acceptance:
  - given: a Go lint defect in a worker's change; when: the worker completes; then: caught pre-push, main stays green
depends_on: []
out_of_scope: [changing the seam-smoke stages themselves, real-hardware/KVM in the sandbox]
needs_human_decision: []
## What happened (2026-07-30 evening) The swarm drained #191–#195 impressively, but both post-burst seam reds trace to one cause: **the Sandcastle sandbox has no Go toolchain**, so Go-heavy slices ship verified by "careful review" only (#195's closing note says exactly this). Two lint defects reached main un-linted — #193's staticcheck SA4010 dead store and #195's revive shadowed-builtin — each costing a red seam cycle and a human-pushed fix (`8fb0b96`, `64afe3b`). ## What to build Close the gap so a Go-touching slice cannot ship un-linted. Two complementary options — implement (1); (2) is the belt-and-braces backstop: 1. **Go toolchain in the Sandcastle sandbox**: the worker environment gets the same pinned `go` + `golangci-lint` the seam runs (ideally by entering `nix develop`, ADR 0040 — CI, Sandcastle and humans in the same shell is already the stated rule; the sandbox is the one place it doesn't hold). Workers can then run `go build/vet/test` + `golangci-lint` on what they touched before pushing. 2. **Pre-push gate in the swarm harness**: before a worker's commit is pushed, run the seam-smoke stages scoped to changed languages; a red gate turns the push into a worker-visible failure instead of a red main. Mind the constraints that shaped the current sandbox (offline-safe `--frozen-lockfile` installs, the electron-binary denial) — the Go toolchain must come from the pinned dev shell, not ad-hoc downloads. ## Acceptance criteria - [ ] Given a worker slice introducing a Go lint defect, When the worker finishes, Then the defect is caught before the push (worker fails or fixes), and main's seam stays green - [ ] Given a TypeScript-only slice, When the gate runs, Then the Go stages are skipped and the run isn't slower than today - [ ] Given the sandbox toolchain, When a worker enters it, Then versions match the seam's `nix develop` pins exactly (no version-drift findings like local golangci v1.64.8 vs the CI pin) ## Task manifest ```yaml task: swarm:sandbox-go-toolchain implements_seam: "ADR 0040 (one dev shell for CI, Sandcastle, humans) — extend it to the worker sandbox; scripts/seam-smoke.sh stages as the gate" interface: ".sandcastle worker environment + pre-push gate" seam: "a deliberate red-lint test slice caught pre-push" acceptance: - given: a Go lint defect in a worker's change; when: the worker completes; then: caught pre-push, main stays green depends_on: [] out_of_scope: [changing the seam-smoke stages themselves, real-hardware/KVM in the sandbox] needs_human_decision: [] ```
Author
Owner

This was generated by AI during triage.

Triage

Category: enhancement (already applied)
State: → ready-for-agent

Redundancy check: searched .sandcastle/Dockerfile and the rest of .sandcastle/ for an existing Go toolchain / golangci-lint / nix develop invocation in the worker sandbox — none found. The gap the issue describes is real and unaddressed.

Prior rejection check: no .out-of-scope/ directory exists in this repo yet, so nothing to check against.

Design gate: not applicable — this is sandbox/CI tooling, no UX flow or wireframe involved.

Human-decision gate: the issue's task manifest carries an empty needs_human_decision — no judgement call blocks an agent from picking this up.

The issue body already contains a complete task manifest (implements_seam, interface, seam, acceptance, out_of_scope) and Given/When/Then acceptance criteria, which satisfies this repo's agent-brief bar. Treating the issue body as the authoritative brief; no separate brief comment needed.

> *This was generated by AI during triage.* ## Triage **Category:** enhancement (already applied) **State:** → `ready-for-agent` **Redundancy check:** searched `.sandcastle/Dockerfile` and the rest of `.sandcastle/` for an existing Go toolchain / `golangci-lint` / `nix develop` invocation in the worker sandbox — none found. The gap the issue describes is real and unaddressed. **Prior rejection check:** no `.out-of-scope/` directory exists in this repo yet, so nothing to check against. **Design gate:** not applicable — this is sandbox/CI tooling, no UX flow or wireframe involved. **Human-decision gate:** the issue's task manifest carries an empty `needs_human_decision` — no judgement call blocks an agent from picking this up. The issue body already contains a complete task manifest (implements_seam, interface, seam, acceptance, out_of_scope) and Given/When/Then acceptance criteria, which satisfies this repo's agent-brief bar. Treating the issue body as the authoritative brief; no separate brief comment needed.
Author
Owner

Done in b37ac0a (on origin/main).

Both fronts the issue names:

  1. Go toolchain in the sandbox — the .sandcastle/Dockerfile installs single-user Nix; the gate enters a new lean devShells.go-ci (go_1_23 + golangci-lint, no clan-cli) in flake.nix, so nix develop .#go-ci -c <stages> resolves the exact flake.lock-pinned versions the seam runs (ADR 0040 — no ad-hoc download, no version drift; AC #3). The Nix install is non-fatal so a hiccup never halts the swarm.
  2. Pre-push gate — .sandcastle/git-hooks/pre-push (wired via git config core.hooksPath in main.mts onSandboxReady, active only under OURCLOUD_SANDBOX=1 so a human/host push is never gated) runs the Go seam stages (go build/vet/test + golangci-lint, main module + broker + dev-tag build) over any change touching *.go/go.*/.golangci.yml. A red stage blocks the push (worker-visible), main stays green. A TS-only change skips the Go stages entirely (AC #2). A Go change with no toolchain present fails closed (AC #1 held even before the image warms).

Evidence: .sandcastle/gate-lib.sh holds the pure logic, driven offline by .sandcastle/tests/gate-lib-test.sh — 15 checks (lang detection, a deliberate red-lint slice caught pre-push, a TS-only slice skipped, pre-push range parsing), all passing. Plus a manual end-to-end hook run over a throwaway repo confirmed host-skip / red-blocks / green-allows / docs-skip.

Note for the first Go-touching swarm run: the Nix install + .#go-ci shell can only be proven on a real host image build (not available inside the worker sandbox). If it reports a warm/pin issue, check nix develop .#go-ci -c go version matches the seam pin; until then a Go push fails closed (blocked, not red-on-main) — the intended degrade.

Done in `b37ac0a` (on origin/main). **Both fronts the issue names:** 1. **Go toolchain in the sandbox** — the `.sandcastle/Dockerfile` installs single-user Nix; the gate enters a new lean `devShells.go-ci` (go_1_23 + golangci-lint, no clan-cli) in `flake.nix`, so `nix develop .#go-ci -c <stages>` resolves the **exact flake.lock-pinned** versions the seam runs (ADR 0040 — no ad-hoc download, no version drift; AC #3). The Nix install is non-fatal so a hiccup never halts the swarm. 2. **Pre-push gate** — `.sandcastle/git-hooks/pre-push` (wired via `git config core.hooksPath` in `main.mts` onSandboxReady, active only under `OURCLOUD_SANDBOX=1` so a human/host push is never gated) runs the Go seam stages (`go build/vet/test` + `golangci-lint`, main module + broker + dev-tag build) over any change touching `*.go`/`go.*`/`.golangci.yml`. A red stage blocks the push (worker-visible), main stays green. A TS-only change skips the Go stages entirely (AC #2). A Go change with no toolchain present **fails closed** (AC #1 held even before the image warms). **Evidence:** `.sandcastle/gate-lib.sh` holds the pure logic, driven offline by `.sandcastle/tests/gate-lib-test.sh` — 15 checks (lang detection, a deliberate red-lint slice caught pre-push, a TS-only slice skipped, pre-push range parsing), all passing. Plus a manual end-to-end hook run over a throwaway repo confirmed host-skip / red-blocks / green-allows / docs-skip. **Note for the first Go-touching swarm run:** the Nix install + `.#go-ci` shell can only be proven on a real host image build (not available inside the worker sandbox). If it reports a warm/pin issue, check `nix develop .#go-ci -c go version` matches the seam pin; until then a Go push fails closed (blocked, not red-on-main) — the intended degrade.
ben closed this issue 2026-07-31 08:27:43 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#198
No description provided.