Skip to content

chore: strict-server codegen, CI improvements, remove auto-assign#10

Merged
koinsaari merged 1 commit into
mainfrom
chore/codegen-strict
May 29, 2026
Merged

chore: strict-server codegen, CI improvements, remove auto-assign#10
koinsaari merged 1 commit into
mainfrom
chore/codegen-strict

Conversation

@koinsaari
Copy link
Copy Markdown
Contributor

@koinsaari koinsaari commented May 29, 2026

Summary

  • Switch oapi-codegen to strict-server mode — handlers receive typed request objects and return typed response objects, no manual json.Decoder/json.Encoder
  • Track internal/gen/api.gen.go in git and remove it from .dockerignore so the repo is self-contained and Docker builds work without a codegen step
  • Add .claudeignore to skip indexing large generated files and go.sum (saves context tokens)
  • Add codegen-check CI job that regenerates the spec and fails if internal/gen/ drifts
  • Bump setup-go to v6.4.0 (SHA-pinned) across all CI jobs — supersedes Dependabot PR chore(deps): bump actions/setup-go from 5.5.0 to 6.4.0 #8
  • Remove auto-assign workflow — fired on every PR edit including title changes, not useful for a small team

Test plan

🤖 Generated with Claude Code

@claude
Copy link
Copy Markdown

claude Bot commented May 29, 2026

Claude encountered an error —— View job


PR Review

  • Read REVIEW.md and CLAUDE.md
  • Analyze changed files
  • Post review findings

No blocking issues. This is a clean, incremental setup for strict-server codegen.

Checked:

  • No internal/authinternal/clients/jellyfin import cycle introduced
  • No JWT keyfunc changes
  • No SQL query changes
  • No new API routes requiring handler tests (the strict StrictServerInterface is generated but not yet wired up — main.go still uses a bare http.NewServeMux — which is intentional for an incremental rollout)

🟡 Nits (2)

1. go-chi/chi/v5 indirect dependency (go.mod:17)

chi/v5 was added as // indirect. The generated file (api.gen.go) doesn't import it directly — this dependency is pulled in transitively through the oapi-codegen tool declaration. That's fine, but worth confirming with go mod tidy that it stays after the tool is invoked, so future tidy runs don't silently drop it and break a build once chi is actually imported.

2. codegen-check job has no explicit tool-build step (.github/workflows/ci.yml:65–68)

- name: Regenerate and check for drift
  run: |
    make gen
    git diff --exit-code internal/gen/

setup-go@v6 caches modules, so go tool oapi-codegen will typically be served from cache. On a cold cache the first run will build the tool from source, which can add ~30–60 s. Not a problem, just something to be aware of if the job feels slow on the first PR after a cache eviction.

Fix this →


Summary: Both findings are minor. State is success.

@koinsaari koinsaari changed the title chore: switch to oapi-codegen strict-server and commit generated code chore: switch to oapi-codegen strict-server and add generated code May 29, 2026
- Enable strict-server mode in oapi-codegen.yaml (typed request/response objects,
  no manual json.Decoder/Encoder in handlers)
- Remove internal/gen/ from .gitignore and .dockerignore so the generated file is
  tracked and the Docker build context is self-contained
- Add .claudeignore to skip indexing internal/gen/ and go.sum (save context tokens)
- Add codegen-check CI job with go mod download pre-warm to detect spec/generated-code
  drift on every PR
- Bump setup-go to v6.4.0 across all CI jobs
- Remove auto-assign workflow (noise on every PR edit, not needed for small team)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@koinsaari koinsaari force-pushed the chore/codegen-strict branch from 73d51fc to 3e59b8d Compare May 29, 2026 21:19
@claude
Copy link
Copy Markdown

claude Bot commented May 29, 2026

Claude encountered an error —— View job


PR Review

  • Read REVIEW.md and CLAUDE.md
  • Analyze changed files
  • Post review findings

No blocking issues. This is a clean, well-structured codegen setup.

Checked:

  • No internal/authinternal/clients/jellyfin import cycle introduced
  • JWT keyfunc at internal/auth/jwt.go:37 correctly validates signing method before returning key (unchanged by this PR)
  • No SQL query changes
  • No new API routes requiring handler tests — StrictServerInterface is generated but main.go still wires only http.NewServeMux, which is the right incremental approach

Notes on previous review findings:

The previous review flagged go-chi/chi/v5 as an indirect dependency — this was incorrect. chi does not appear in go.mod and the generated file (internal/gen/api.gen.go) only imports github.com/getkin/kin-openapi/openapi3 as an external dependency alongside stdlib. No chi dependency to worry about.

The previous review's cold-cache concern for codegen-check is already addressed: go mod download is present before make gen (ci.yml:67), so module sources are fetched before the tool is compiled.


Summary: No findings. State is success.

@koinsaari koinsaari changed the title chore: switch to oapi-codegen strict-server and add generated code chore: strict-server codegen, CI improvements, remove auto-assign May 29, 2026
@koinsaari koinsaari merged commit 1a1931e into main May 29, 2026
6 of 7 checks passed
@koinsaari koinsaari deleted the chore/codegen-strict branch May 29, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant