Skip to content

ci: fail the build when the generated OpenAPI spec or web client is stale - #2178

Open
andyst-dev wants to merge 1 commit into
chrisbenincasa:mainfrom
andyst-dev:fix/2115-regenerate-web-client
Open

andyst-dev wants to merge 1 commit into
chrisbenincasa:mainfrom
andyst-dev:fix/2115-regenerate-web-client

Conversation

@andyst-dev

Copy link
Copy Markdown
Contributor

Follow-up to #2115.

The generated OpenAPI spec and the web client had drifted from the routes. Regenerating both on main today is clean and pnpm --filter @tunarr/web typecheck passes, so the drift itself is already resolved (the client was regenerated in 464c296, and c97d767 fixed the spec emission that made the client generate incorrectly). What is still missing is the enforcement suggested in the issue, so the same drift cannot land again unnoticed.

This adds one step to the existing build job:

  • builds @tunarr/types and @tunarr/shared,
  • runs generate-openapi against a throwaway database directory via TUNARR_DATABASE_PATH, so it does not read or pollute any existing Tunarr data,
  • runs generate-client,
  • fails, printing the offending diff, if web/src/generated or docs/generated changed.

Verified locally on main (754786b): the step exits 0 on a clean tree after regenerating both artifacts, and exits 1 with the type diff when I add a field to a route schema and regenerate. I could not run the job on GitHub Actions itself; the runner needs only Node 22 and pnpm, which the job already sets up.

If you would rather fix drift at the source than gate it in CI, feel free to close this and the issue - the current tree is already consistent.

Refs #2115

This branch has not been deployed

No deployments
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