Lint the release the same way we lint everything else

Merged
JE
4mo ago
+84-3

v0.9.0-rc.1 failed. Nothing was wrong with the code.

What happened

release.yml pinned golangci-lint at v2.9.0. test.yml and security.yml are on v2.11.1 — with a # keep in lockstep with test.yml Lint comment on the latter. release.yml drifted and nothing noticed, because the release gate is the one job no pull request ever runs.

It surfaced as:

internal/commands/assignments.go:142:85: G115: integer overflow conversion int -> int32 (gosec)

That conversion is guarded, two lines above it:

if position < 1 || position > math.MaxInt32 {
    return output.ErrUsage("--position must be 1 or greater (positions are 1-based)")
}
...
MyAssignments().Reorder(cmd.Context(), recordingID, int32(position))

gosec at v2.11.1 follows that bound and stays quiet. At v2.9.0 it does not. So a false positive that every PR check had already passed took down a release tag, and assignments.go needs no change — it was already correct.

The fix

Pin matched, plus scripts/check-lint-lockstep.sh to enforce it. The lockstep comments already existed and already failed; comments don't enforce.

It reads the version off every golangci-lint-action step and fails naming the files:

FAIL: golangci-lint pins disagree across workflows:
  .github/workflows/release.yml:v2.9.0
  .github/workflows/security.yml:v2.11.1
  .github/workflows/test.yml:v2.11.1

Verified both directions: passes on this branch (3 workflows at v2.11.1), and fails as above when release.yml is reverted to v2.9.0.

Wired into three places:

  • make check — local bin/ci
  • the release quality gate — so a future drift fails as drift, ahead of the linter
  • test.yml, before the linter step — so PRs catch it, which is the whole point

Next

Once this lands, v0.9.0-rc.1 gets re-cut as v0.9.0-rc.2. rc.1 published no release and no artifacts — every job after the gate was skipped — so nothing needs unpublishing. I'd rather leave the dead tag than retag it.

bin/ci green (EXIT=0).


Summary by cubic

Align golangci-lint versions across CI and enforce lockstep to prevent release failures from version drift. release.yml now pins v2.11.1, and the check fails if any workflow drifts or has an unpinned step.

  • Bug Fixes
    • Pin golangci-lint to v2.11.1 in .github/workflows/release.yml (matching test.yml/security.yml).
    • Add scripts/check-lint-lockstep.sh to ensure all golangci/golangci-lint-action steps are pinned and use the same version; report mismatches and missing pins.
    • Run the check in make check, the release quality gate, and in test.yml before linting.