main is red: errcheck refuses the bare defer res.Body.Close() in internal/controlapi/updates_i18n_seam_test.go:47 (from #2129/6caf5c25) #2153

Closed
opened 2026-11-04 09:08:13 +00:00 by matou-build-agent · 28 comments

What

main's seam is red: the Go: go.work resolves both modules; build, vet, test, lint each
stage of scripts/seam-smoke.sh exits 1 on a single errcheck finding — the
only lint finding in the whole run:

internal/controlapi/updates_i18n_seam_test.go:47:22: Error return value of `res.Body.Close` is not checked (errcheck)
	defer res.Body.Close()
	                    ^
1 issues:
* errcheck: 1

Build, vet and the full Go test suite all pass (every internal/* package ok
in the same job log) — this is purely the lint stage, one line.

Where it came from

6caf5c25 (sandcastle: #2129 — i18n Go seam) added
internal/controlapi/updates_i18n_seam_test.go. Its problemAt helper closes the
response body with a bare defer res.Body.Close(), which errcheck (enabled in
.golangci.yml) refuses. That commit's own message records go vet + go test ./internal/controlapi/ + gofmt clean — golangci-lint was not among the checks
it ran.

It is the only bare defer <x>.Body.Close() in the repo. The established
idiom everywhere else (≈60 sites: control-plane/cmd/control-plane/*.go,
broker/internal/broker/selfprobe_test.go, every *_wiring_test.go) is the
discarded-error form.

The fix

internal/controlapi/updates_i18n_seam_test.go:47 — adopt the repo idiom:

defer func() { _ = res.Body.Close() }()

Then prove the stage green the way CI runs it:

nix develop .#go-ci --command golangci-lint run ./...

Why priority

main is red at f32d6599, so the seam stays red for every commit landing on
top of it until this one line is fixed.

Systemic note (not part of this fix)

The pre-push gate did not catch it because the full Go seam (gate_go_stage,
which runs golangci-lint run ./...) is sandbox-only by #198; the HOST
reconcile/heal push path runs only the cheap gofmt tier (gate_gofmt_stage,
Gate 3b/#1458), and defer res.Body.Close() is gofmt-clean. 6caf5c25 reached
main over that host path (it was the commit the #1458 gofmt-gate break had
stranded, per f32d6599), so no golangci-lint ever ran on it before main.
Closing that gap is a design decision for a human — tracked here only as
context, and in the heal report for run 59608.


Filed by the swarm healer for run
https://git.matou.nz/Matou/idss/actions/runs/59608 (signature e1fdd105c5b4).
Evidence: run-verdict.txt, job-log.txt in that run's heal bundle.

## What `main`'s seam is **red**: the `Go: go.work resolves both modules; build, vet, test, lint each` stage of `scripts/seam-smoke.sh` exits 1 on a single `errcheck` finding — the only lint finding in the whole run: ``` internal/controlapi/updates_i18n_seam_test.go:47:22: Error return value of `res.Body.Close` is not checked (errcheck) defer res.Body.Close() ^ 1 issues: * errcheck: 1 ``` Build, vet and the full Go test suite all pass (every `internal/*` package `ok` in the same job log) — this is purely the lint stage, one line. ## Where it came from `6caf5c25` (`sandcastle: #2129 — i18n Go seam`) added `internal/controlapi/updates_i18n_seam_test.go`. Its `problemAt` helper closes the response body with a bare `defer res.Body.Close()`, which `errcheck` (enabled in `.golangci.yml`) refuses. That commit's own message records `go vet + go test ./internal/controlapi/ + gofmt clean` — `golangci-lint` was not among the checks it ran. It is the **only** bare `defer <x>.Body.Close()` in the repo. The established idiom everywhere else (≈60 sites: `control-plane/cmd/control-plane/*.go`, `broker/internal/broker/selfprobe_test.go`, every `*_wiring_test.go`) is the discarded-error form. ## The fix `internal/controlapi/updates_i18n_seam_test.go:47` — adopt the repo idiom: ```go defer func() { _ = res.Body.Close() }() ``` Then prove the stage green the way CI runs it: ``` nix develop .#go-ci --command golangci-lint run ./... ``` ## Why `priority` `main` is red at `f32d6599`, so the seam stays red for every commit landing on top of it until this one line is fixed. ## Systemic note (not part of this fix) The pre-push gate did not catch it because the full Go seam (`gate_go_stage`, which runs `golangci-lint run ./...`) is sandbox-only by #198; the HOST reconcile/heal push path runs only the cheap gofmt tier (`gate_gofmt_stage`, Gate 3b/#1458), and `defer res.Body.Close()` is gofmt-clean. `6caf5c25` reached `main` over that host path (it was the commit the #1458 gofmt-gate break had stranded, per `f32d6599`), so no `golangci-lint` ever ran on it before `main`. Closing that gap is a design decision for a human — tracked here only as context, and in the heal report for run 59608. --- Filed by the swarm healer for run <https://git.matou.nz/Matou/idss/actions/runs/59608> (signature `e1fdd105c5b4`). Evidence: `run-verdict.txt`, `job-log.txt` in that run's heal bundle.
Author
Member

swarm-claim host=bens-mac-04 run=59614
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=59614 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=elitebook-distributed-server-03 run=59320
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=59320 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=matou-dev-server-01 run=59635
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=59635 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=elitebook-distributed-server-03 run=59328
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=59328 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=bens-mac-04 run=59628
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=59628 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=elitebook-distributed-server-03 run=59338
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=59338 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=bens-mac-04 run=59647
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=59647 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=bens-mac-04 run=59666
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=59666 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=matou-dev-server-01 run=59647
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=59647 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=matou-dev-server-01 run=59649
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=59649 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=bens-mac-04 run=59672
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=59672 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=elitebook-distributed-server-03 run=59362
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=59362 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=elitebook-distributed-server-03 run=59376
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=59376 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=matou-dev-server-01 run=59666
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=59666 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=elitebook-distributed-server-03 run=59385
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=59385 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=bens-mac-04 run=59720
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=59720 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=matou-dev-server-01 run=59669
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=59669 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=elitebook-distributed-server-03 run=59395
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=59395 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=bens-mac-04 run=59743
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=59743 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=matou-dev-server-01 run=59693
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=59693 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=matou-dev-server-01 run=59697
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=59697 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=elitebook-distributed-server-03 run=59402
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=59402 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=elitebook-distributed-server-03 run=59405
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=59405 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=bens-mac-04 run=59786
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=59786 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

⏩ independent reviewer for #2153 — verdict unauthenticated

review JSON
{
  "verdict": "unauthenticated",
  "findings": []
}
:fast_forward: **independent reviewer** for #2153 — verdict `unauthenticated` <details><summary>review JSON</summary> ```json { "verdict": "unauthenticated", "findings": [] } ``` </details>
Author
Member

close-report for #2153 — status success

✅ close-report gates passed — every claim verified against the pushed worker branch sandcastle/worker/20261104-063724-1d3519 (pre-land — the host promotes it to main only after its post-run verify, #193/#283); issue closed.

envelope
{
  "issue": 2153,
  "status": "success",
  "commits": [
    "2a521c4cfc2ee14d712595a3610f0f28049506a4"
  ],
  "changed_files": [
    "internal/controlapi/updates_i18n_seam_test.go"
  ],
  "tests": [
    {
      "command": "nix develop .#go-ci --command golangci-lint run ./internal/controlapi/...",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci --command go test ./internal/controlapi/",
      "exit_code": 0
    }
  ],
  "criteria": {
    "The only errcheck finding on main's Go seam is cleared": "internal/controlapi/updates_i18n_seam_test.go:47 now uses `defer func() { _ = res.Body.Close() }()`; golangci-lint run reports 0 issues (test command 1)",
    "Build, vet and the controlapi test suite stay green": "go test ./internal/controlapi/ → ok (test command 2); pre-push full Go seam reported 0 issues"
  },
  "summary": "Replaced the repo's only bare defer res.Body.Close() with the discarded-error idiom, clearing the lone errcheck finding reddening main's Go seam.",
  "blockers": []
}
**close-report** for #2153 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against the pushed worker branch `sandcastle/worker/20261104-063724-1d3519` (pre-land — the host promotes it to `main` only after its post-run verify, #193/#283); issue closed. <details><summary>envelope</summary> ```json { "issue": 2153, "status": "success", "commits": [ "2a521c4cfc2ee14d712595a3610f0f28049506a4" ], "changed_files": [ "internal/controlapi/updates_i18n_seam_test.go" ], "tests": [ { "command": "nix develop .#go-ci --command golangci-lint run ./internal/controlapi/...", "exit_code": 0 }, { "command": "nix develop .#go-ci --command go test ./internal/controlapi/", "exit_code": 0 } ], "criteria": { "The only errcheck finding on main's Go seam is cleared": "internal/controlapi/updates_i18n_seam_test.go:47 now uses `defer func() { _ = res.Body.Close() }()`; golangci-lint run reports 0 issues (test command 1)", "Build, vet and the controlapi test suite stay green": "go test ./internal/controlapi/ → ok (test command 2); pre-push full Go seam reported 0 issues" }, "summary": "Replaced the repo's only bare defer res.Body.Close() with the discarded-error idiom, clearing the lone errcheck finding reddening main's Go seam.", "blockers": [] } ``` </details>
Author
Member

🚨 Reopened — a push-mode close did NOT land on main (#283). close-report closed this issue against the pushed worker branch, but the host's post-run verify rolled the land back (the promote did not advance main (a no-op push to main)), so origin/main never carried the commits (2a521c4cfc2ee14d712595a3610f0f28049506a4). The gates-passed comment above is therefore NOT true of main. Reopening and relabelling ready-for-session so the work is redone where it can land; the commits are parked on a rescue branch for triage (see this run's alarm).

:rotating_light: **Reopened — a push-mode close did NOT land on `main` (#283).** close-report closed this issue against the pushed worker branch, but the host's post-run verify rolled the land back (`the promote did not advance main (a no-op push to main)`), so `origin/main` never carried the commits (`2a521c4cfc2ee14d712595a3610f0f28049506a4`). The gates-passed comment above is therefore NOT true of `main`. Reopening and relabelling `ready-for-session` so the work is redone where it can land; the commits are parked on a rescue branch for triage (see this run's alarm).
Author
Member

Close report — already fixed on main by #2130 (ADR 0174, two-way)

Outcome: resolved, no new commit needed. The exact one-line fix this ticket
specifies already landed on main; I verified it and proved the lint stage
green. Nothing left to push.

What landed, and where

Commit 351c29de (sandcastle: #2130 — i18n Go seam: the join device-end code-taxonomy …) changed the offending line in
internal/controlapi/updates_i18n_seam_test.go with the precise hunk this
ticket prescribes:

-	defer res.Body.Close()
+	defer func() { _ = res.Body.Close() }()

Its own message records the intent: it "left defer res.Body.Close() unchecked
(from 6caf5c25) … unblocks the shared Go gate." So the concurrent #2130
session picked up this stranded line while landing its own slice. Classic
session-runner ticket race — the fix reached main before this drainer opened
the ticket.

Proof the seam is green

  • origin/main is at 39c425cf; this checkout's HEAD equals it.

  • Repo-wide check for the bad idiom — grep -rn 'defer res.Body.Close()' --include='*.go' . — returns no matches. It was the only bare site.

  • The lint stage, run exactly as CI runs it:

    nix develop .#go-ci --command golangci-lint run ./...
    0 issues.
    

    (exit 0)

main is no longer red on this finding.

Systemic note (unchanged, not actioned here)

The ticket's own "Systemic note" — the HOST reconcile/heal push path runs only
the cheap gofmt tier (gate_gofmt_stage, Gate 3b/#1458), so the full Go seam's
golangci-lint run ./... (gate_go_stage, sandbox-only per #198) never ran on
6caf5c25 before it reached main — remains a human design decision about the
host-path gate and is out of scope for this two-way fix. It is recorded here
and in the heal report for run 59608; no change made to it.

Ruled by agent under ADR 0174 — veto anytime. Two-way door (the fix was a
revertible one-line edit, and it is already in main via #2130; proof is the
existing lint run above). Closing as resolved.

## Close report — already fixed on `main` by #2130 (ADR 0174, two-way) **Outcome: resolved, no new commit needed.** The exact one-line fix this ticket specifies already landed on `main`; I verified it and proved the lint stage green. Nothing left to push. ### What landed, and where Commit `351c29de` (`sandcastle: #2130 — i18n Go seam: the join device-end code-taxonomy …`) changed the offending line in `internal/controlapi/updates_i18n_seam_test.go` with the precise hunk this ticket prescribes: ```diff - defer res.Body.Close() + defer func() { _ = res.Body.Close() }() ``` Its own message records the intent: it "left `defer res.Body.Close()` unchecked (from `6caf5c25`) … unblocks the shared Go gate." So the concurrent #2130 session picked up this stranded line while landing its own slice. Classic session-runner ticket race — the fix reached `main` before this drainer opened the ticket. ### Proof the seam is green - `origin/main` is at `39c425cf`; this checkout's HEAD equals it. - Repo-wide check for the bad idiom — `grep -rn 'defer res.Body.Close()' --include='*.go' .` — returns **no matches**. It was the only bare site. - The lint stage, run exactly as CI runs it: ``` nix develop .#go-ci --command golangci-lint run ./... 0 issues. ``` (exit 0) `main` is no longer red on this finding. ### Systemic note (unchanged, not actioned here) The ticket's own "Systemic note" — the HOST reconcile/heal push path runs only the cheap gofmt tier (`gate_gofmt_stage`, Gate 3b/#1458), so the full Go seam's `golangci-lint run ./...` (`gate_go_stage`, sandbox-only per #198) never ran on `6caf5c25` before it reached `main` — remains a human design decision about the host-path gate and is **out of scope** for this two-way fix. It is recorded here and in the heal report for run 59608; no change made to it. Ruled by agent under ADR 0174 — veto anytime. Two-way door (the fix was a revertible one-line edit, and it is already in `main` via #2130; proof is the existing lint run above). Closing as resolved.
matou-build-agent 2026-11-04 13:45:29 +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#2153
No description provided.