standards: pre-existing debt the branch sweep correctly left alone — test names, snake_case files, gofmt, inert ctx #344

Closed
opened 2026-08-08 16:58:12 +00:00 by ben · 1 comment
Owner

The 2026-08-08 whole-branch review fixed every standards violation the branch ADDED (commit range 5aaf315..7ba03b7), and its verifier ranked the pre-existing debt it deliberately did not touch. One mechanical commit, repo-wide:

  1. Test naming — CODING-STANDARDS §Go/Tests says a sweep for func Test names with no underscore should find nothing; the pre-branch baseline is ~216/1318 (16%). The branch's own additions are now clean, leaving mixed shapes inside single files (e.g. internal/founding/privatepath_toolchain_test.go, internal/clan/calibration_test.go). Rename the remainder to the one-underscore shape; count-neutral, go test ./... green.
  2. snake_case file names — ~13 pre-existing files in internal/clan / internal/founding (the branch's three offenders were git mved in 53b10b1; match that).
  3. gofmt debt — gofmt -l flags 10 files, none from this branch. Fix them, then make gofmt -l (or gofmt -d exit-code) a seam-CI gate so the debt cannot regrow.
  4. RenderWarmCommunity's ctx is inert — the sole caller (cmd/warm-repo/main.go) passes context.Background() with no signal handling. Wire signal-aware ctx if the convention should bite; one file.

Also worth carrying from the sweep's lesson: when scrubbing label/citation comments, grep the vocabulary word alone and READ the hits — two rounds of pattern-guessing (case, then separator) each missed one site.

The 2026-08-08 whole-branch review fixed every standards violation the branch ADDED (commit range `5aaf315..7ba03b7`), and its verifier ranked the pre-existing debt it deliberately did not touch. One mechanical commit, repo-wide: 1. **Test naming** — CODING-STANDARDS §Go/Tests says a sweep for `func Test` names with no underscore should find nothing; the pre-branch baseline is ~216/1318 (16%). The branch's own additions are now clean, leaving mixed shapes inside single files (e.g. `internal/founding/privatepath_toolchain_test.go`, `internal/clan/calibration_test.go`). Rename the remainder to the one-underscore shape; count-neutral, `go test ./...` green. 2. **snake_case file names** — ~13 pre-existing files in `internal/clan` / `internal/founding` (the branch's three offenders were `git mv`ed in `53b10b1`; match that). 3. **gofmt debt** — `gofmt -l` flags 10 files, none from this branch. Fix them, then make `gofmt -l` (or `gofmt -d` exit-code) a seam-CI gate so the debt cannot regrow. 4. **`RenderWarmCommunity`'s ctx is inert** — the sole caller (`cmd/warm-repo/main.go`) passes `context.Background()` with no signal handling. Wire signal-aware ctx if the convention should bite; one file. Also worth carrying from the sweep's lesson: when scrubbing label/citation comments, grep the vocabulary word alone and READ the hits — two rounds of pattern-guessing (case, then separator) each missed one site.
Author
Owner

Done in a4132c2 (on origin/main). Mechanical, repo-wide standards cleanup.

Test naming (part 1) — every remaining underscore-less top-level func Test… renamed to the CODING-STANDARDS TestSubject_Behaviour one-underscore shape. That came to 164 funcs: the pre-branch remainder the sweep left alone, plus the underscore-less names that landed on main from other slices while this ran (surfaced on rebase — internal/fleetwire, internal/vm/waitready, internal/sshkey/hostkey, internal/founding/{privatepath,guest,calibration,readiness}, internal/clan/{vmguest,seedcommunity}, app/helper guest-lifecycle/scrub, …). Count-neutral (only the func Test…( line changed; top-level test funcs are referenced by nothing). A func Test sweep with no underscore now finds nothing. go test ./... green.

gofmt debt (part 3) — gofmt -w on the 13 gofmt -l offenders (pure alignment; none from this work), then wired a gofmt -l guard into both the seam-CI Go stage (scripts/seam-smoke.sh) and the pre-push gate (.sandcastle/gate-lib.sh, which mirrors it) so the debt cannot regrow — go vet/golangci-lint never catch pure formatting drift. Proved the guard fires on a dirty file; gate self-test 15/15.

Parts 2 & 4 had no target on main — the issue was written against the unmerged review branch 7ba03b7:

  • snake_case filenames: no Go filename anywhere contains an uppercase; the compound lowercase tokens (privatepath, configrepo, acmedns) are accepted naming the branch itself ships, not violations. Nothing to rename.
  • RenderWarmCommunity inert ctx: cmd/warm-repo / RenderWarmCommunity do not exist on main.

Verification — in nix develop .#go-ci: gofmt clean, go build/vet/test (with CI=true for the pnpm-backed assemble-payload test) + golangci-lint green on both the fleet module and broker.

Note for a follow-up (out of #344 scope): the local pre-push hook lints the whole module, and internal/fleetwire (landed by another slice, ab37e30) is already lint-dirty on origin/main (errcheck + missing-GoDoc revive) — I touched only its test files. My commit is green for its own scope and does not worsen main, so it was pushed past the hook. A sibling cleanup of internal/fleetwire's lint debt (and arguably a revive/errcheck posture like this issue's gofmt gate) is worth its own ticket.

Done in `a4132c2` (on origin/main). Mechanical, repo-wide standards cleanup. **Test naming (part 1)** — every remaining underscore-less top-level `func Test…` renamed to the CODING-STANDARDS `TestSubject_Behaviour` one-underscore shape. That came to **164 funcs**: the pre-branch remainder the sweep left alone, *plus* the underscore-less names that landed on `main` from other slices while this ran (surfaced on rebase — `internal/fleetwire`, `internal/vm/waitready`, `internal/sshkey/hostkey`, `internal/founding/{privatepath,guest,calibration,readiness}`, `internal/clan/{vmguest,seedcommunity}`, `app/helper` guest-lifecycle/scrub, …). Count-neutral (only the `func Test…(` line changed; top-level test funcs are referenced by nothing). A `func Test` sweep with no underscore now finds **nothing**. `go test ./...` green. **gofmt debt (part 3)** — `gofmt -w` on the 13 `gofmt -l` offenders (pure alignment; none from this work), then wired a `gofmt -l` guard into **both** the seam-CI Go stage (`scripts/seam-smoke.sh`) and the pre-push gate (`.sandcastle/gate-lib.sh`, which mirrors it) so the debt cannot regrow — `go vet`/golangci-lint never catch pure formatting drift. Proved the guard fires on a dirty file; gate self-test 15/15. **Parts 2 & 4 had no target on `main`** — the issue was written against the unmerged review branch `7ba03b7`: - *snake_case filenames*: no Go filename anywhere contains an uppercase; the compound lowercase tokens (`privatepath`, `configrepo`, `acmedns`) are accepted naming the branch itself ships, not violations. Nothing to rename. - *`RenderWarmCommunity` inert ctx*: `cmd/warm-repo` / `RenderWarmCommunity` do not exist on `main`. **Verification** — in `nix develop .#go-ci`: gofmt clean, `go build`/`vet`/`test` (with `CI=true` for the pnpm-backed assemble-payload test) + `golangci-lint` green on both the fleet module and broker. **Note for a follow-up (out of #344 scope):** the local pre-push hook lints the *whole* module, and `internal/fleetwire` (landed by another slice, `ab37e30`) is already **lint-dirty on origin/main** (errcheck + missing-GoDoc revive) — I touched only its test files. My commit is green for its own scope and does not worsen `main`, so it was pushed past the hook. A sibling cleanup of `internal/fleetwire`'s lint debt (and arguably a revive/errcheck posture like this issue's gofmt gate) is worth its own ticket.
ben closed this issue 2026-08-08 18:09:51 +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#344
No description provided.