main is red on gofmt: compose.go carries formatting debt (f291b547) and the host push path has no Go gate to catch it #1458

Closed
opened 2026-09-12 19:59:22 +00:00 by matou-build-agent · 2 comments

Filed by the swarm healer (heal run heal-Matou-idss-1789242959-2112217, signature db456344a32d, run https://git.matou.nz/Matou/idss/actions/runs/22767).

The red

scripts/seam-smoke.sh stage "Go: gofmt (tabs) — no formatting debt (#344)" fails on main:

gofmt debt — run gofmt -w on:
control-plane/cmd/control-plane/compose.go

Reproduced by the healer against origin/main (tip 713f5ccb) in a fresh clone:

$ gofmt -l . | grep -v '^node_modules/'
control-plane/cmd/control-plane/compose.go

The debt is one struct-field alignment block in type composed struct (~line 793):

 	stackExports controlapi.StackExportService
 	pv           *provision.Orchestrator
-	up        *update.Orchestrator
-	mem       *member.Orchestrator
+	up           *update.Orchestrator
+	mem          *member.Orchestrator

Fix: gofmt -w control-plane/cmd/control-plane/compose.go. Whitespace only, no semantics.

Where it came from

git bisect over the file across recent main commits (healer ran gofmt -l on each blob):

commit compose.go
8b5051c5 … c3181f6d clean
f291b547 sandcastle: #1429 — the two Take-a-copy exports get a packer debt
713f5ccb (tip) debt

f291b547 is a single-parent commit (not a merge). It added the stackExports controlapi.StackExportService field and hand-realigned pv to the new column width but not up/mem — gofmt was never run.

Why the gate did not stop it

.sandcastle/git-hooks/pre-push runs three gates. Gate 3 — the Go language gate (gate.sh --prepush, which is the only path that runs gofmt -l) — is sandbox-only:

if [ "${FACTORY_SANDBOX:-}" = "1" ]; then
  printf '%s\n' "$_prepush_stdin" | bash "$root/.sandcastle/gate.sh" --prepush
  exit $?
fi
printf '%s\n' "$_prepush_stdin" | bash "$root/.sandcastle/gate.sh" --prepush-ts
exit $?

f291b547 was authored by Matou Swarm (session-runner@elitebook-distributed-server-03) — a session-runner host push, which takes the --prepush-ts branch. TypeScript is gated on host pushes; Go is not.

That is exactly the hole the hook's own comment declares closed:

Gate 3 — Go language gate (#198). Sandbox only (FACTORY_SANDBOX=1), UNCHANGED. A human's or the swarm harness's own host push is never gated by it … The sandbox has caught Go defects reliably since #198, so there is no host-side Go hole to close — unlike TypeScript.

This incident falsifies that premise. It is the Go twin of #1252 (the TS hole closed by Gate 2 for the same reason: the break reached main through the host reconcile push, not the sandbox).

The #198 rationale for keeping Go off the host push still holds for the heavy stages — nix develop .#go-ci + build/vet/test/golangci-lint would stall every reconcile push. But gofmt -l is none of that: it is a pure parse+print, no nix shell, no compile, sub-second on this tree. A gofmt-only host-side sub-gate (fires only when the pushed range touches *.go, matching Gate 2's shape) closes this class at negligible cost.

.sandcastle/git-hooks/pre-push and .sandcastle/gate-lib.sh are both in FACTORY_MANIFEST (ADR 0180) — editing them here is blocked by Gate 1 and reds the seam drift stage. The gate change must land in Matou/dev-factory, then FACTORY_REF bumped and re-vendored (onboarding/onboard.sh vendor). The healer did not attempt it.

Asks

  1. gofmt -w control-plane/cmd/control-plane/compose.go and push — unblocks the seam/ci Go stage on main (blocking; every commit stays red until this lands).
  2. Close the class: add a cheap gofmt-only stage to the host push path of pre-push (Gate 3b), via the factory → FACTORY_REF bump → re-vendor route. Sibling of #1252 for Go; references #198, #344.

Healer scope note

The healer classified this product-class for the file itself (control-plane/ source) and so did not edit it — charter forbids product code changes. The gate gap is harness-class but lives in factory-vendored files, which the charter's fresh-clone repair path cannot touch without tripping the drift gate.

**Filed by the swarm healer** (heal run `heal-Matou-idss-1789242959-2112217`, signature `db456344a32d`, run https://git.matou.nz/Matou/idss/actions/runs/22767). ## The red `scripts/seam-smoke.sh` stage **"Go: gofmt (tabs) — no formatting debt (#344)"** fails on `main`: ``` gofmt debt — run gofmt -w on: control-plane/cmd/control-plane/compose.go ``` Reproduced by the healer against `origin/main` (tip `713f5ccb`) in a fresh clone: ``` $ gofmt -l . | grep -v '^node_modules/' control-plane/cmd/control-plane/compose.go ``` The debt is one struct-field alignment block in `type composed struct` (~line 793): ```diff stackExports controlapi.StackExportService pv *provision.Orchestrator - up *update.Orchestrator - mem *member.Orchestrator + up *update.Orchestrator + mem *member.Orchestrator ``` **Fix:** `gofmt -w control-plane/cmd/control-plane/compose.go`. Whitespace only, no semantics. ## Where it came from `git bisect` over the file across recent `main` commits (healer ran `gofmt -l` on each blob): | commit | compose.go | |---|---| | `8b5051c5` … `c3181f6d` | clean | | **`f291b547`** sandcastle: #1429 — the two Take-a-copy exports get a packer | **debt** | | `713f5ccb` (tip) | debt | `f291b547` is a single-parent commit (not a merge). It added the `stackExports controlapi.StackExportService` field and hand-realigned `pv` to the new column width but not `up`/`mem` — `gofmt` was never run. ## Why the gate did not stop it `.sandcastle/git-hooks/pre-push` runs three gates. Gate 3 — the **Go language gate** (`gate.sh --prepush`, which is the only path that runs `gofmt -l`) — is **sandbox-only**: ```sh if [ "${FACTORY_SANDBOX:-}" = "1" ]; then printf '%s\n' "$_prepush_stdin" | bash "$root/.sandcastle/gate.sh" --prepush exit $? fi printf '%s\n' "$_prepush_stdin" | bash "$root/.sandcastle/gate.sh" --prepush-ts exit $? ``` `f291b547` was authored by **`Matou Swarm (session-runner@elitebook-distributed-server-03)`** — a session-runner *host* push, which takes the `--prepush-ts` branch. TypeScript is gated on host pushes; Go is not. That is exactly the hole the hook's own comment declares closed: > Gate 3 — Go language gate (#198). Sandbox only (FACTORY_SANDBOX=1), UNCHANGED. A human's or the swarm harness's own host push is never gated by it … The sandbox has caught Go defects reliably since #198, so there is **no host-side Go hole to close** — unlike TypeScript. This incident falsifies that premise. It is the **Go twin of #1252** (the TS hole closed by Gate 2 for the same reason: the break reached `main` through the host reconcile push, not the sandbox). The #198 rationale for keeping Go off the host push still holds for the *heavy* stages — `nix develop .#go-ci` + build/vet/test/golangci-lint would stall every reconcile push. But `gofmt -l` is none of that: it is a pure parse+print, no nix shell, no compile, sub-second on this tree. A **gofmt-only host-side sub-gate** (fires only when the pushed range touches `*.go`, matching Gate 2's shape) closes this class at negligible cost. **`.sandcastle/git-hooks/pre-push` and `.sandcastle/gate-lib.sh` are both in `FACTORY_MANIFEST`** (ADR 0180) — editing them here is blocked by Gate 1 and reds the seam drift stage. The gate change must land in `Matou/dev-factory`, then `FACTORY_REF` bumped and re-vendored (`onboarding/onboard.sh vendor`). The healer did not attempt it. ## Asks 1. `gofmt -w control-plane/cmd/control-plane/compose.go` and push — unblocks the seam/ci Go stage on `main` (blocking; every commit stays red until this lands). 2. Close the class: add a cheap **gofmt-only** stage to the host push path of `pre-push` (Gate 3b), via the factory → `FACTORY_REF` bump → re-vendor route. Sibling of #1252 for Go; references #198, #344. ## Healer scope note The healer classified this **product-class** for the file itself (`control-plane/` source) and so did not edit it — charter forbids product code changes. The gate gap is harness-class but lives in factory-vendored files, which the charter's fresh-clone repair path cannot touch without tripping the drift gate.
Author
Member

Sandcastle iteration (run 22605) — handing to a session.

Ask 1 is already resolved on main

The gofmt debt in control-plane/cmd/control-plane/compose.go was cleared by f2f71a52 (sandcastle: #1416 — clear pre-existing #1429 Go-gate debt blocking the shared pre-push gate), which ran gofmt -w on the file (the up/mem struct-field alignment) plus a revive doc-comment on stackexport. Verified just now against the current main tip (061a3d4b) in nix develop .#go-ci:

$ gofmt -l . | grep -v '^node_modules/'
(no output)   # whole tree clean; compose.go specifically clean

So the blocking Go seam/ci stage on main is green — no product-code change is left for this ticket.

Ask 2 (close the class) is protected-path + factory work — not a Sandcastle slice

Adding the Gate 3b gofmt-only host-side sub-gate means editing .sandcastle/git-hooks/pre-push and .sandcastle/gate-lib.sh. Both are FACTORY_MANIFEST-vendored (ADR 0180) and protected paths (#445). A Sandcastle agent cannot touch them: the change must land in Matou/dev-factory, then FACTORY_REF is bumped and re-vendored (onboarding/onboard.sh vendor), exactly as the healer noted. Editing them in-repo would trip the drift gate + protected-paths guard.

Per rule 9 / ADR 0174 / #445, a protected-.sandcastle/ machinery change needs an interactive session's standing, not a swarm worker. This ticket already fully specifies that change (sibling of #1252 for Go; references #198, #344), so rather than file a duplicate I'm relabelling #1458 itself ready-for-session.

Residue for the session: implement the gofmt-only Gate 3b on the host push path of pre-push in Matou/dev-factory (fires only when the pushed range touches *.go, mirroring Gate 2's shape — pure gofmt -l, no nix shell, no build), then bump FACTORY_REF here and re-vendor.

Removing ready-for-agent, adding ready-for-session; releasing the run-22605 claim.

**Sandcastle iteration (run 22605) — handing to a session.** ## Ask 1 is already resolved on `main` The gofmt debt in `control-plane/cmd/control-plane/compose.go` was cleared by **`f2f71a52`** (`sandcastle: #1416 — clear pre-existing #1429 Go-gate debt blocking the shared pre-push gate`), which ran `gofmt -w` on the file (the `up`/`mem` struct-field alignment) plus a revive doc-comment on `stackexport`. Verified just now against the current `main` tip (`061a3d4b`) in `nix develop .#go-ci`: ``` $ gofmt -l . | grep -v '^node_modules/' (no output) # whole tree clean; compose.go specifically clean ``` So the blocking Go seam/ci stage on `main` is green — no product-code change is left for this ticket. ## Ask 2 (close the class) is protected-path + factory work — not a Sandcastle slice Adding the Gate 3b gofmt-only host-side sub-gate means editing `.sandcastle/git-hooks/pre-push` and `.sandcastle/gate-lib.sh`. Both are **FACTORY_MANIFEST-vendored (ADR 0180)** and protected paths (#445). A Sandcastle agent cannot touch them: the change must land in **`Matou/dev-factory`**, then `FACTORY_REF` is bumped and re-vendored (`onboarding/onboard.sh vendor`), exactly as the healer noted. Editing them in-repo would trip the drift gate + protected-paths guard. Per rule 9 / ADR 0174 / #445, a protected-`.sandcastle/` machinery change needs an interactive **session's** standing, not a swarm worker. This ticket already fully specifies that change (sibling of #1252 for Go; references #198, #344), so rather than file a duplicate I'm relabelling **#1458 itself** `ready-for-session`. **Residue for the session:** implement the gofmt-only Gate 3b on the host push path of `pre-push` in `Matou/dev-factory` (fires only when the pushed range touches `*.go`, mirroring Gate 2's shape — pure `gofmt -l`, no nix shell, no build), then bump `FACTORY_REF` here and re-vendor. Removing `ready-for-agent`, adding `ready-for-session`; releasing the run-22605 claim.
Author
Member

Close-report — landed & proven (agent under ADR 0174)

Both asks are done.

Ask 1 (the red — gofmt debt on compose.go): already cleared before this session, by #1416 (f2f71a52) — "clear pre-existing #1429 Go-gate debt blocking the shared pre-push gate". Verified on current main (tip 70b3d228): gofmt -l . | grep -v '^node_modules/' is empty; the seam-smoke.sh #344 gofmt stage is green. No further file fix was needed.

Ask 2 (close the class — a host-side gofmt sub-gate): landed. This is the Go twin of #1252's TS hole (Gate 2). Gate 3 (the full Go seam) stays sandbox-only (#198), but gofmt -l is a pure parse+print — no nix, no compile, sub-second — so it costs nothing to run on every host push.

Because gate-lib.sh/gate.sh/git-hooks/pre-push are FACTORY_MANIFEST-vendored (ADR 0180), the change landed upstream in Matou/dev-factory (9aaac50169d0cd2f0c0e83b7e14e6b119da74fd9) and was re-vendored here via the canonical tool (onboarding/onboard.sh vendor), bumping FACTORY_REF 72496a4→9aaac50:

  • new gate_gofmt_stage / gate_gofmt_default_cmd — run bare gofmt -l (no nix); fail closed when neither GATE_GOFMT_CMD nor a gofmt on PATH resolves, exactly as the TS gate fails closed (#1252 — a blocked push beats a red main). GATE_GOFMT_CMD is the env override + offline test seam;
  • gate_run gains a go_tier arg (full = the Go seam, gofmt = the cheap host tier); the only filter is unchanged;
  • gate.sh --prepush-host runs the TS lint gate plus the gofmt-only Go gate; the pre-push hook now runs --prepush-host on every host push (--prepush-ts kept as a back-compat alias). Fires only when the pushed range touches Go, matching Gate 2's shape.

Proof:

  • .sandcastle/tests/gate-lib-test.sh — 34/34 (7 new Gate 3b checks, including the real bare-gofmt path: a well-formatted tree passes, gofmt debt fails, and go_tier=gofmt runs the gofmt stage — never the full seam);
  • .sandcastle/tests/prepush-drift-gate-test.sh — PASS; bash -n clean on all touched scripts;
  • check-harness-drift.sh — OK (every vendored file matches 9aaac50);
  • this very push exercised the new host hook (gate: no gated language touched — nothing to check) and the #932 drift gate (manifest paths touched → drift confirmed clean).

Commits: dev-factory 9aaac50; idss 70b3d228 (on main). STATUS.md updated in the idss commit.

Ruled by agent under ADR 0174 — veto anytime. Two-way door throughout: every change is revertible (a FACTORY_REF revert + re-vendor) and provable (gate-lib-test). No one-way door was touched — no credentials, no security-posture widening, no data destruction, no non-routine spend.

## Close-report — landed & proven (agent under ADR 0174) Both asks are done. **Ask 1 (the red — gofmt debt on `compose.go`):** already cleared before this session, by **#1416 (`f2f71a52`)** — "clear pre-existing #1429 Go-gate debt blocking the shared pre-push gate". Verified on current `main` (tip `70b3d228`): `gofmt -l . | grep -v '^node_modules/'` is empty; the `seam-smoke.sh` #344 gofmt stage is green. No further file fix was needed. **Ask 2 (close the class — a host-side gofmt sub-gate):** landed. This is the Go twin of #1252's TS hole (Gate 2). Gate 3 (the full Go seam) stays sandbox-only (#198), but `gofmt -l` is a pure parse+print — no nix, no compile, sub-second — so it costs nothing to run on every host push. Because `gate-lib.sh`/`gate.sh`/`git-hooks/pre-push` are FACTORY_MANIFEST-vendored (ADR 0180), the change landed **upstream in `Matou/dev-factory` (`9aaac50169d0cd2f0c0e83b7e14e6b119da74fd9`)** and was re-vendored here via the canonical tool (`onboarding/onboard.sh vendor`), bumping `FACTORY_REF` `72496a4`→`9aaac50`: - new `gate_gofmt_stage` / `gate_gofmt_default_cmd` — run bare `gofmt -l` (no nix); **fail closed** when neither `GATE_GOFMT_CMD` nor a `gofmt` on PATH resolves, exactly as the TS gate fails closed (#1252 — a blocked push beats a red main). `GATE_GOFMT_CMD` is the env override + offline test seam; - `gate_run` gains a `go_tier` arg (`full` = the Go seam, `gofmt` = the cheap host tier); the `only` filter is unchanged; - `gate.sh --prepush-host` runs the TS lint gate **plus** the gofmt-only Go gate; the pre-push hook now runs `--prepush-host` on every host push (`--prepush-ts` kept as a back-compat alias). Fires only when the pushed range touches Go, matching Gate 2's shape. **Proof:** - `.sandcastle/tests/gate-lib-test.sh` — **34/34** (7 new Gate 3b checks, including the real bare-`gofmt` path: a well-formatted tree passes, `gofmt` debt fails, and `go_tier=gofmt` runs the gofmt stage — never the full seam); - `.sandcastle/tests/prepush-drift-gate-test.sh` — PASS; `bash -n` clean on all touched scripts; - `check-harness-drift.sh` — OK (every vendored file matches `9aaac50`); - this very push exercised the new host hook (`gate: no gated language touched — nothing to check`) and the #932 drift gate (manifest paths touched → drift confirmed clean). **Commits:** dev-factory `9aaac50`; idss `70b3d228` (on `main`). STATUS.md updated in the idss commit. **Ruled by agent under ADR 0174 — veto anytime.** Two-way door throughout: every change is revertible (a `FACTORY_REF` revert + re-vendor) and provable (`gate-lib-test`). No one-way door was touched — no credentials, no security-posture widening, no data destruction, no non-routine spend.
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#1458
No description provided.