Skip to content

chore(spec): generate swag via go tool directive for reproducibility#597

Open
Fodesu wants to merge 1 commit into
memohai:mainfrom
Fodesu:chore/pin-generators-regen-sdk
Open

chore(spec): generate swag via go tool directive for reproducibility#597
Fodesu wants to merge 1 commit into
memohai:mainfrom
Fodesu:chore/pin-generators-regen-sdk

Conversation

@Fodesu

@Fodesu Fodesu commented Jun 9, 2026

Copy link
Copy Markdown
Member

Summary

The swagger go:generate directive used swag@latest, which is
non-deterministic — it ignores the swag v1.16.6 pinned in go.mod and
resolves to whatever version the toolchain returns, so regenerating produces
spurious diffs that vary by machine/time.

Register cmd/swag as a go.mod tool dependency and switch the directive to
go tool swag, so generation always uses the version pinned in go.mod.
Future bumps only touch go.mod (go get -tool ...), never swagger.go.

Regenerating with the pinned v1.16.6 also syncs a stale spec: GET /users/me
declares @Failure 401 in source (since #579) but the committed spec/SDK never
included it.

Changes

  • internal/handlers/swagger.go: go run …swag@v1.16.6go tool swag.
  • go.mod / go.sum: add the tool github.com/swaggo/swag/cmd/swag directive.
  • spec/{swagger.json,swagger.yaml,docs.go}: regenerated; adds the missing
    401 on GET /users/me and normalizes operation key ordering.
  • packages/sdk/src/types.gen.ts: the corresponding 401 type.

@Fodesu Fodesu requested a review from sheepbox8646 June 9, 2026 07:35
The swagger go:generate directive used `swag@latest`, which is
non-deterministic: it ignores the `swag v1.16.6` already pinned in go.mod
and resolves to whatever version the toolchain returns, so regenerating
produces spurious diffs that vary by machine/time.

Register cmd/swag as a go.mod `tool` dependency and switch the directive to
`go tool swag`, so generation always uses the version pinned in go.mod.
Future bumps only touch go.mod (`go get -tool ...`), not swagger.go.

Regenerating with the pinned v1.16.6 also brings the committed spec back in
sync with source: it adds the `/users/me` 401 response (declared via
`@Failure 401` since memohai#579) and normalizes operation key ordering. The SDK
type for that 401 is synced; the SDK SSE runtime files are left untouched.
@Fodesu Fodesu changed the title chore(spec): pin swag generator to v1.16.6 and regenerate chore(spec): generate swag via go tool directive for reproducibility Jun 9, 2026
@Fodesu Fodesu force-pushed the chore/pin-generators-regen-sdk branch from fc59fd7 to ec19224 Compare June 9, 2026 08:34
@Fodesu

Fodesu commented Jun 9, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Fodesu Fodesu requested a review from chen-ran June 9, 2026 14:48
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