Skip to content

ci: lint the OpenAPI spec and fail on breaking API changes - #249

Open
ndbroadbent wants to merge 1 commit into
mainfrom
nathan/ci-checklist-openapi
Open

ndbroadbent wants to merge 1 commit into
mainfrom
nathan/ci-checklist-openapi

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Dec 5, 2026 •

Copy link
Copy Markdown
Member

Nothing linted the OpenAPI spec, and an API change that breaks older clients (a CLI older than its gateway, the phone app) showed up only as type errors in the web client, if at all.

task lint:openapi (scripts/check_openapi.sh), in the repo-checks job against the PR's base or the push's previous commit:

  • Redocly 2.84.0 lints web/src/api/openapi.json with its recommended rules (redocly.yaml). The public routes (health, logins, logouts) are security-defined exceptions. The login redirects (no 2xx) and the health check (no 4xx) are in .redocly.lint-ignore.yaml with their reasons.
  • oasdiff 1.41.0 compares the spec with the base commit's and fails on a breaking change, unless a commit message between the two says why with [breaking-api].

Both are pinned in mise.toml; the job checks out with fetch-depth: 0 for the base commit and its messages.

Spec fixes so the lint passes

  • Every operation has an @ID: orval's own method-plus-path name, so web/src/api/generated.ts is unchanged. task generate only renames one shared request body component in the spec.
  • PUT /auth/mfa/methods/{methodID} and GET /integrations/slack were documented without @Security, though both always required a session. oasdiff rates documenting that as breaking, so the commit carries [breaking-api] with the reason; no client changes.
  • Authenticated routes that listed no client error now list 401, plus 403 when they need a permission. The login redirects list the rate limiter's 429, and the spec names its Apache-2.0 licence.

Found, not fixed here: some routes have no swag annotations, so they're missing from the spec: the Slack integration's OAuth, channels and alerts routes, and POST /auth/cli/mfa. The spec also has no scheme for the Authorization: Bearer session and API tokens that the CLI and CI use. Both are for a follow-up.

Tested locally: the lint passes with the 6 documented exceptions; removing POST /api-tokens from the spec fails the diff; this branch's own change passes only because of its [breaking-api] commit. task generate leaves generated.ts unchanged.

This conflicts with #247 and #248 on the same lines of ci.yml, Taskfile.yml, mise.toml and AGENTS.md; I'll rebase once they're merged.


Run Proof on this PR
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

task lint:openapi (scripts/check_openapi.sh) runs in the repo-checks job:

- Redocly lints web/src/api/openapi.json with its recommended rules
  (redocly.yaml). Public routes are listed as security-defined exceptions,
  and the login redirects and the health check have their reasons in
  .redocly.lint-ignore.yaml.
- oasdiff compares the spec with the base commit's and fails on a breaking
  change, unless a commit message says why with [breaking-api]: people run
  CLIs older than their gateway, and the phone app updates on its own.

To pass the lint, every operation now has an @id: orval's own method-plus-
path name, so the generated client is unchanged. Authenticated routes that
listed no client error now list 401 (and 403 when they need a permission),
the login redirects list the rate limiter's 429, and the spec names its
Apache-2.0 licence.

[breaking-api] PUT /auth/mfa/methods/{methodID} and GET /integrations/slack
now document the session they have always required (@Security). The routes
themselves don't change, so no client breaks.
@deepsource-io

deepsource-io Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 9edd5e7...2a610bc on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
JavaScript Dec 5, 2026 7:22a.m. Review ↗
Go Dec 5, 2026 7:22a.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

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