standards: golangci-clean — the 33 findings the resurrected seam CI surfaced #148

Closed
opened 2026-07-27 14:13:17 +00:00 by ben · 1 comment
Owner

Parent

Standards debt, same family as #133–#142 — filed 2026-07-27 by the seam-CI resurrection. The ci/seam workflow had never actually run (no nix on the runner until today), so golangci-lint run ./... — which docs/CODING-STANDARDS.md and scripts/seam-smoke.sh claim as the standing gate — had never gated anything. First real run: 33 findings across both Go modules (errcheck ×12, revive unused-parameter ×~19, staticcheck ×1, misc).

What to do

Fix every finding below so golangci-lint run ./... is clean in both modules (root + broker/), inside nix develop (that shell's pinned golangci-lint is the gate: run bash scripts/seam-smoke.sh to verify end-to-end). Mechanical intent-preserving fixes only: handle or explicitly discard errors (errcheck), rename genuinely-unused params to _ (revive), drop dead assignments (staticcheck). Where a finding reveals a real dropped error path, handle it properly rather than silencing.

Findings (nix-shell golangci-lint, 2026-07-27)

internal/join/cli.go:137:15: Error return value of `fmt.Fprintln` is not checked (errcheck)
internal/join/cli.go:142:13: Error return value of `fmt.Fprintf` is not checked (errcheck)
internal/join/cli.go:143:14: Error return value of `fmt.Fprintln` is not checked (errcheck)
internal/join/cli.go:144:14: Error return value of `fmt.Fprintln` is not checked (errcheck)
internal/join/cli.go:148:14: Error return value of `fmt.Fprintf` is not checked (errcheck)
internal/join/cli.go:165:15: Error return value of `fmt.Fprintf` is not checked (errcheck)
internal/join/cli.go:166:14: Error return value of `fmt.Fprint` is not checked (errcheck)
internal/join/cli.go:249:13: Error return value of `fmt.Fprint` is not checked (errcheck)
internal/rescue/remotesupport_test.go:184:21: Error return value of `e.GrantSupporterKey` is not checked (errcheck)
internal/rescue/remotesupport_test.go:213:18: Error return value of `e.ShareLogBundle` is not checked (errcheck)
internal/rescue/remotesupport_test.go:214:21: Error return value of `e.GrantSupporterKey` is not checked (errcheck)
internal/rescue/remotesupport_test.go:249:21: Error return value of `e.GrantSupporterKey` is not checked (errcheck)
internal/update/history.go:10:2: exported: exported const OutcomeApplied should have comment (or a comment on this block) or be unexported (revive)
internal/join/app.go:217:43: redefines-builtin-id: redefinition of the built-in function copy (revive)
internal/join/app.go:85:6: exported: type name will be used as join.JoinResult by other packages, and that stutters; consider calling this Result (revive)
internal/member/idp.go:121:20: redefines-builtin-id: redefinition of the built-in function new (revive)
internal/clan/clan_test.go:22:32: context-as-argument: context.Context should be the first parameter of a function (revive)
internal/clan/fake.go:76:23: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
internal/clan/fake.go:83:25: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
internal/clan/fake.go:125:23: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
internal/founding/deploy.go:61:2: exported: exported const DeployStepDone should have comment (or a comment on this block) or be unexported (revive)
internal/founding/handoff.go:124:2: exported: exported const KitOffered should have comment (or a comment on this block) or be unexported (revive)
internal/breakglass/breakglass.go:271:2: exported: exported const ActionProbe should have comment (or a comment on this block) or be unexported (revive)
internal/breakglass/actions.go:30:2: exported: exported const ComponentConfigRepo should have comment (or a comment on this block) or be unexported (revive)
internal/backup/policy.go:31:1: exported: comment on exported type BackupAction should be of the form "BackupAction ..." (with optional leading article) (revive)
internal/backup/policy.go:33:6: exported: type name will be used as backup.BackupAction by other packages, and that stutters; consider calling this Action (revive)
internal/backup/restore_inplace.go:307:92: unused-parameter: parameter 'home' seems to be unused, consider removing or renaming it as _ (revive)
internal/backup/run.go:504:34: redefines-builtin-id: redefinition of the built-in function min (revive)
internal/backup/pertarget.go:596:45: unused-parameter: parameter 'decl' seems to be unused, consider removing or renaming it as _ (revive)
internal/backup/run.go:321:21: unused-parameter: parameter 'decl' seems to be unused, consider removing or renaming it as _ (revive)
internal/backup/restore_inplace.go:332:80: unused-parameter: parameter 'preRef' seems to be unused, consider removing or renaming it as _ (revive)
internal/backup/run.go:414:17: unused-parameter: parameter 'decl' seems to be unused, consider removing or renaming it as _ (revive)
internal/rescue/deviceladder_test.go:367:2: SA4006: this value of `s` is never used (staticcheck)

Acceptance criteria

  • bash scripts/seam-smoke.sh inside nix develop completes to "seam smoke OK" (both languages).
  • No //nolint added without a reason comment.
  • Behaviour unchanged: all existing tests still pass.

Blocked by

None (rebase over in-flight ports work #133/#134 if it lands mid-flight — same files).

Task manifest

task: standards:golangci-clean
implements_flow: none — engineering hygiene
implements_edge: "none"
wireframe: none
interface: "no interface changes; lint-clean the existing Go surface"
seam: "scripts/seam-smoke.sh inside nix develop reaches 'seam smoke OK'"
acceptance: "golangci-lint clean in both Go modules under the pinned dev-shell toolchain"
depends_on: []
out_of_scope: [suppressing findings wholesale via config edits, TS surfaces]
needs_human_decision: []
## Parent Standards debt, same family as #133–#142 — filed 2026-07-27 by the seam-CI resurrection. The `ci`/seam workflow had never actually run (no nix on the runner until today), so `golangci-lint run ./...` — which `docs/CODING-STANDARDS.md` and `scripts/seam-smoke.sh` claim as the standing gate — had never gated anything. First real run: **33 findings** across both Go modules (errcheck ×12, revive unused-parameter ×~19, staticcheck ×1, misc). ## What to do Fix every finding below so `golangci-lint run ./...` is clean in both modules (root + `broker/`), inside `nix develop` (that shell's pinned golangci-lint is the gate: run `bash scripts/seam-smoke.sh` to verify end-to-end). Mechanical intent-preserving fixes only: handle or explicitly discard errors (errcheck), rename genuinely-unused params to `_` (revive), drop dead assignments (staticcheck). Where a finding reveals a real dropped error path, handle it properly rather than silencing. ## Findings (nix-shell golangci-lint, 2026-07-27) ``` internal/join/cli.go:137:15: Error return value of `fmt.Fprintln` is not checked (errcheck) internal/join/cli.go:142:13: Error return value of `fmt.Fprintf` is not checked (errcheck) internal/join/cli.go:143:14: Error return value of `fmt.Fprintln` is not checked (errcheck) internal/join/cli.go:144:14: Error return value of `fmt.Fprintln` is not checked (errcheck) internal/join/cli.go:148:14: Error return value of `fmt.Fprintf` is not checked (errcheck) internal/join/cli.go:165:15: Error return value of `fmt.Fprintf` is not checked (errcheck) internal/join/cli.go:166:14: Error return value of `fmt.Fprint` is not checked (errcheck) internal/join/cli.go:249:13: Error return value of `fmt.Fprint` is not checked (errcheck) internal/rescue/remotesupport_test.go:184:21: Error return value of `e.GrantSupporterKey` is not checked (errcheck) internal/rescue/remotesupport_test.go:213:18: Error return value of `e.ShareLogBundle` is not checked (errcheck) internal/rescue/remotesupport_test.go:214:21: Error return value of `e.GrantSupporterKey` is not checked (errcheck) internal/rescue/remotesupport_test.go:249:21: Error return value of `e.GrantSupporterKey` is not checked (errcheck) internal/update/history.go:10:2: exported: exported const OutcomeApplied should have comment (or a comment on this block) or be unexported (revive) internal/join/app.go:217:43: redefines-builtin-id: redefinition of the built-in function copy (revive) internal/join/app.go:85:6: exported: type name will be used as join.JoinResult by other packages, and that stutters; consider calling this Result (revive) internal/member/idp.go:121:20: redefines-builtin-id: redefinition of the built-in function new (revive) internal/clan/clan_test.go:22:32: context-as-argument: context.Context should be the first parameter of a function (revive) internal/clan/fake.go:76:23: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive) internal/clan/fake.go:83:25: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive) internal/clan/fake.go:125:23: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive) internal/founding/deploy.go:61:2: exported: exported const DeployStepDone should have comment (or a comment on this block) or be unexported (revive) internal/founding/handoff.go:124:2: exported: exported const KitOffered should have comment (or a comment on this block) or be unexported (revive) internal/breakglass/breakglass.go:271:2: exported: exported const ActionProbe should have comment (or a comment on this block) or be unexported (revive) internal/breakglass/actions.go:30:2: exported: exported const ComponentConfigRepo should have comment (or a comment on this block) or be unexported (revive) internal/backup/policy.go:31:1: exported: comment on exported type BackupAction should be of the form "BackupAction ..." (with optional leading article) (revive) internal/backup/policy.go:33:6: exported: type name will be used as backup.BackupAction by other packages, and that stutters; consider calling this Action (revive) internal/backup/restore_inplace.go:307:92: unused-parameter: parameter 'home' seems to be unused, consider removing or renaming it as _ (revive) internal/backup/run.go:504:34: redefines-builtin-id: redefinition of the built-in function min (revive) internal/backup/pertarget.go:596:45: unused-parameter: parameter 'decl' seems to be unused, consider removing or renaming it as _ (revive) internal/backup/run.go:321:21: unused-parameter: parameter 'decl' seems to be unused, consider removing or renaming it as _ (revive) internal/backup/restore_inplace.go:332:80: unused-parameter: parameter 'preRef' seems to be unused, consider removing or renaming it as _ (revive) internal/backup/run.go:414:17: unused-parameter: parameter 'decl' seems to be unused, consider removing or renaming it as _ (revive) internal/rescue/deviceladder_test.go:367:2: SA4006: this value of `s` is never used (staticcheck) ``` ## Acceptance criteria - [ ] `bash scripts/seam-smoke.sh` inside `nix develop` completes to "seam smoke OK" (both languages). - [ ] No `//nolint` added without a reason comment. - [ ] Behaviour unchanged: all existing tests still pass. ## Blocked by None (rebase over in-flight ports work #133/#134 if it lands mid-flight — same files). ## Task manifest ```yaml task: standards:golangci-clean implements_flow: none — engineering hygiene implements_edge: "none" wireframe: none interface: "no interface changes; lint-clean the existing Go surface" seam: "scripts/seam-smoke.sh inside nix develop reaches 'seam smoke OK'" acceptance: "golangci-lint clean in both Go modules under the pinned dev-shell toolchain" depends_on: [] out_of_scope: [suppressing findings wholesale via config edits, TS surfaces] needs_human_decision: [] ```
Author
Owner

Done in f97bc48 (on origin/main).

The seam CI's reported 33 findings were the max-same-issues=3/max-issues-per-linter cap over a real 102 — capping only limits display, so fixing the 33 alone would have surfaced the hidden ones and kept the gate red. All 102 are paid, intent-preserving, no //nolint:

  • errcheck — the join CLI's fmt.Fprint* terminal writes (two-value discard _, _ =), and tests' res.Body.Close and rescue-seam GrantSupporterKey/ShareLogBundle calls, now explicitly discard.
  • revive — ~50 unused ctx/decl/home/preRef/answers params renamed to _ (revive reports one unused param per signature at a time, so this was looped to a fixpoint); the copy/new/min builtin-shadowing params renamed; join.JoinResult→Result and backup.BackupAction→Action de-stuttered (both package-local); exported-const blocks in update/founding/breakglass given block comments; the two controlapi file headers (backups.go, rescue.go) detached from the package clause so handler.go's canonical // Package controlapi … stands alone; drainToDone reordered ctx-first.
  • staticcheck (SA4006) — one dead s := assignment dropped in deviceladder_test.go.

Verification (go1.23.4 + golangci-lint v1.62.2, matching .golangci.yml): uncapped golangci-lint run ./... is clean in both modules (root + broker/); both build/vet/test green; go build -tags dev ./... still links. The only residual golangci hit is node_modules/flatted/golang/pkg/flatted/flatted.go — a gitignored raw-npm-layout artefact that is absent under CI's pnpm symlink layout (golangci does not follow symlinked dirs), which is why the seam-CI baseline never listed it; out of scope. STATUS.md header + milestone-log updated in the same commit.

Done in `f97bc48` (on `origin/main`). The seam CI's reported 33 findings were the `max-same-issues=3`/`max-issues-per-linter` cap over a real **102** — capping only limits display, so fixing the 33 alone would have surfaced the hidden ones and kept the gate red. All 102 are paid, intent-preserving, no `//nolint`: - **errcheck** — the join CLI's `fmt.Fprint*` terminal writes (two-value discard `_, _ =`), and tests' `res.Body.Close` and rescue-seam `GrantSupporterKey`/`ShareLogBundle` calls, now explicitly discard. - **revive** — ~50 unused `ctx`/`decl`/`home`/`preRef`/`answers` params renamed to `_` (revive reports one unused param per signature at a time, so this was looped to a fixpoint); the `copy`/`new`/`min` builtin-shadowing params renamed; `join.JoinResult`→`Result` and `backup.BackupAction`→`Action` de-stuttered (both package-local); exported-const blocks in `update`/`founding`/`breakglass` given block comments; the two `controlapi` file headers (`backups.go`, `rescue.go`) detached from the `package` clause so `handler.go`'s canonical `// Package controlapi …` stands alone; `drainToDone` reordered ctx-first. - **staticcheck (SA4006)** — one dead `s :=` assignment dropped in `deviceladder_test.go`. **Verification** (go1.23.4 + golangci-lint v1.62.2, matching `.golangci.yml`): uncapped `golangci-lint run ./...` is clean in **both** modules (root + `broker/`); both build/vet/test green; `go build -tags dev ./...` still links. The only residual golangci hit is `node_modules/flatted/golang/pkg/flatted/flatted.go` — a gitignored raw-npm-layout artefact that is absent under CI's pnpm symlink layout (golangci does not follow symlinked dirs), which is why the seam-CI baseline never listed it; out of scope. STATUS.md header + milestone-log updated in the same commit.
ben closed this issue 2026-07-27 14:44:48 +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#148
No description provided.