From c112ac37c9dac4ad46cf1faea46a4eb0faaa824e Mon Sep 17 00:00:00 2001 From: thuanle Date: Tue, 28 Apr 2026 07:25:52 +0700 Subject: [PATCH 1/4] docs: add design spec for issue 18 CI checks Record the approved design to add go vet and pinned staticcheck jobs to PR CI with minimal workflow changes. --- ...4-28-issue-18-ci-vet-staticcheck-design.md | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 docs/superpowers/specs/2026-04-28-issue-18-ci-vet-staticcheck-design.md diff --git a/docs/superpowers/specs/2026-04-28-issue-18-ci-vet-staticcheck-design.md b/docs/superpowers/specs/2026-04-28-issue-18-ci-vet-staticcheck-design.md new file mode 100644 index 0000000..b0839e5 --- /dev/null +++ b/docs/superpowers/specs/2026-04-28-issue-18-ci-vet-staticcheck-design.md @@ -0,0 +1,76 @@ +# Design: Issue #18 — Add `go vet` and `staticcheck` to CI + +## Context +Issue #18 requires expanding PR CI validation for this Go repository beyond existing `gofmt` and `go test` checks. + +Current state: +- CI is defined in `.gitea/workflows/ci.yml`. +- Existing jobs: `fmt` (`gofmt -l .`) and `test` (`go test ./...`). +- No `go vet` or `staticcheck` step exists. + +## Goal +Add practical baseline static analysis to pull request CI by: +- Running `go vet ./...`. +- Running `staticcheck ./...`. +- Pinning `staticcheck` version in CI for deterministic behavior. + +## Non-goals +- Adding `golangci-lint`. +- Refactoring application code unrelated to CI wiring. +- Changing workflow triggers. + +## Approved approach +Use separate CI jobs for `vet` and `staticcheck` while keeping existing `fmt` and `test` jobs unchanged. + +### Why this approach +- Keeps changes surgical and easy to review. +- Makes failures explicit per check (better debugging signal than a combined lint step). +- Preserves current CI behavior while extending validation coverage. + +## Implementation design +Modify `.gitea/workflows/ci.yml` only. + +### Job: `vet` +- `runs-on: linux` +- Steps: + 1. `actions/checkout@v4` + 2. `actions/setup-go@v5` with `go-version-file: go.mod` + 3. `run: go vet ./...` + +### Job: `staticcheck` +- `runs-on: linux` +- Steps: + 1. `actions/checkout@v4` + 2. `actions/setup-go@v5` with `go-version-file: go.mod` + 3. Install pinned staticcheck version: + - `go install honnef.co/go/tools/cmd/staticcheck@2025.1.1` + 4. Run staticcheck: + - `$(go env GOPATH)/bin/staticcheck ./...` + +## Failure behavior +- CI must fail if `go vet ./...` exits non-zero. +- CI must fail if `staticcheck ./...` exits non-zero. +- Existing `fmt` and `test` failure behavior remains unchanged. + +## Verification plan +Local verification before PR creation: +- `gofmt -l .` +- `go test ./...` +- `go vet ./...` +- `staticcheck ./...` (if tool is available locally) + +CI verification through PR run: +- Confirm `fmt`, `test`, `vet`, and `staticcheck` jobs execute on pull requests. +- Confirm non-zero from `vet`/`staticcheck` marks workflow failed. + +## Risks and mitigations +- Risk: pinned staticcheck version not present in runner cache. + - Mitigation: install in-job via `go install` each run. +- Risk: staticcheck findings on current code block CI. + - Mitigation: if encountered, address only findings required to satisfy issue scope. + +## Acceptance mapping +- CI fail on vet errors → `vet` job runs `go vet ./...`. +- CI fail on staticcheck errors → `staticcheck` job runs pinned staticcheck binary. +- Existing checks preserved → `fmt` and `test` jobs remain in workflow. +- No `golangci-lint` → not introduced in workflow. -- 2.54.0 From 3eb64338c9eb4025ee242e44fbb6b61cab6e7d82 Mon Sep 17 00:00:00 2001 From: thuanle Date: Tue, 28 Apr 2026 07:51:04 +0700 Subject: [PATCH 2/4] ci: add go vet job to PR workflow Co-Authored-By: Claude Opus 4.7 --- .gitea/workflows/ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index c5d28e4..cbd8459 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -27,3 +27,12 @@ jobs: with: go-version-file: go.mod - run: go test ./... + + vet: + runs-on: linux + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - run: go vet ./... -- 2.54.0 From 6c6a6280b68dd21d83a944e21d2fa98273373bef Mon Sep 17 00:00:00 2001 From: thuanle Date: Tue, 28 Apr 2026 07:53:23 +0700 Subject: [PATCH 3/4] ci: add pinned staticcheck job to PR workflow Co-Authored-By: Claude Opus 4.7 --- .gitea/workflows/ci.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index cbd8459..246b67d 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -36,3 +36,13 @@ jobs: with: go-version-file: go.mod - run: go vet ./... + + staticcheck: + runs-on: linux + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - run: go install honnef.co/go/tools/cmd/staticcheck@2025.1.1 + - run: $(go env GOPATH)/bin/staticcheck ./... -- 2.54.0 From b73b399c557bd804cd6666eefb506fb5d239e580 Mon Sep 17 00:00:00 2001 From: thuanle Date: Tue, 28 Apr 2026 08:14:05 +0700 Subject: [PATCH 4/4] chore: remove superpowers spec artifact from PR scope --- ...4-28-issue-18-ci-vet-staticcheck-design.md | 76 ------------------- 1 file changed, 76 deletions(-) delete mode 100644 docs/superpowers/specs/2026-04-28-issue-18-ci-vet-staticcheck-design.md diff --git a/docs/superpowers/specs/2026-04-28-issue-18-ci-vet-staticcheck-design.md b/docs/superpowers/specs/2026-04-28-issue-18-ci-vet-staticcheck-design.md deleted file mode 100644 index b0839e5..0000000 --- a/docs/superpowers/specs/2026-04-28-issue-18-ci-vet-staticcheck-design.md +++ /dev/null @@ -1,76 +0,0 @@ -# Design: Issue #18 — Add `go vet` and `staticcheck` to CI - -## Context -Issue #18 requires expanding PR CI validation for this Go repository beyond existing `gofmt` and `go test` checks. - -Current state: -- CI is defined in `.gitea/workflows/ci.yml`. -- Existing jobs: `fmt` (`gofmt -l .`) and `test` (`go test ./...`). -- No `go vet` or `staticcheck` step exists. - -## Goal -Add practical baseline static analysis to pull request CI by: -- Running `go vet ./...`. -- Running `staticcheck ./...`. -- Pinning `staticcheck` version in CI for deterministic behavior. - -## Non-goals -- Adding `golangci-lint`. -- Refactoring application code unrelated to CI wiring. -- Changing workflow triggers. - -## Approved approach -Use separate CI jobs for `vet` and `staticcheck` while keeping existing `fmt` and `test` jobs unchanged. - -### Why this approach -- Keeps changes surgical and easy to review. -- Makes failures explicit per check (better debugging signal than a combined lint step). -- Preserves current CI behavior while extending validation coverage. - -## Implementation design -Modify `.gitea/workflows/ci.yml` only. - -### Job: `vet` -- `runs-on: linux` -- Steps: - 1. `actions/checkout@v4` - 2. `actions/setup-go@v5` with `go-version-file: go.mod` - 3. `run: go vet ./...` - -### Job: `staticcheck` -- `runs-on: linux` -- Steps: - 1. `actions/checkout@v4` - 2. `actions/setup-go@v5` with `go-version-file: go.mod` - 3. Install pinned staticcheck version: - - `go install honnef.co/go/tools/cmd/staticcheck@2025.1.1` - 4. Run staticcheck: - - `$(go env GOPATH)/bin/staticcheck ./...` - -## Failure behavior -- CI must fail if `go vet ./...` exits non-zero. -- CI must fail if `staticcheck ./...` exits non-zero. -- Existing `fmt` and `test` failure behavior remains unchanged. - -## Verification plan -Local verification before PR creation: -- `gofmt -l .` -- `go test ./...` -- `go vet ./...` -- `staticcheck ./...` (if tool is available locally) - -CI verification through PR run: -- Confirm `fmt`, `test`, `vet`, and `staticcheck` jobs execute on pull requests. -- Confirm non-zero from `vet`/`staticcheck` marks workflow failed. - -## Risks and mitigations -- Risk: pinned staticcheck version not present in runner cache. - - Mitigation: install in-job via `go install` each run. -- Risk: staticcheck findings on current code block CI. - - Mitigation: if encountered, address only findings required to satisfy issue scope. - -## Acceptance mapping -- CI fail on vet errors → `vet` job runs `go vet ./...`. -- CI fail on staticcheck errors → `staticcheck` job runs pinned staticcheck binary. -- Existing checks preserved → `fmt` and `test` jobs remain in workflow. -- No `golangci-lint` → not introduced in workflow. -- 2.54.0