Skip to content

ci: add openapi spec drift check on PRs#1129

Draft
mandarini wants to merge 4 commits into
masterfrom
ci/openapi-drift-check
Draft

ci: add openapi spec drift check on PRs#1129
mandarini wants to merge 4 commits into
masterfrom
ci/openapi-drift-check

Conversation

@mandarini

@mandarini mandarini commented May 27, 2026

Copy link
Copy Markdown

What this is

  • PR-time gate that re-exports the Fastify OpenAPI documents and fails the build if the committed static/api.json or static/api-admin.json has drifted.

Status

  • Spec drift check — passing. The committed snapshots are in sync with the Fastify route schemas.
  • Lint & Build — passing.
  • Coveralls — failing, but not caused by this PR. The patch-coverage check reports "No coverable files changed" (this PR adds no executable code — only static/api*.json, .gitignore, and biome.jsonc). The reported ~0.1% dip is coverage-measurement variance in the acceptance suite (previously attributed to src/internal/database/migrations/migrate.ts) combined with base-branch drift, not anything introduced here.

Bootstrap — done in this PR

The one-time bootstrap is already complete on this branch:

  • static/api.json + static/api-admin.json were previously gitignored (build-only artifacts published to GH Pages), so the committed copy never existed. This PR stops ignoring them and commits the generated snapshots, making the committed copy load-bearing.
  • The committed specs are emitted minified by npm run docs:export, so they're excluded from biome (the drift gate verifies them; they are not hand-formatted).

What maintainers need to do

  • Nothing to bootstrap — already done.
  • On future PRs that change a route or schema annotation: re-run npm run docs:export and commit the updated static/api.json / static/api-admin.json. (Or download the openapi-specs artifact from the failing run and commit those.)

What it's used for

  • Lets SDKs, type generators, and other downstream consumers pin to a committed, accurate OpenAPI spec instead of relying on it being regenerated correctly out-of-band.
  • Storage already publishes the spec to GH Pages via docs.yml; this change makes the committed copy load-bearing too.

What was added and why

  • .github/workflows/openapi.yml — runs npm run docs:export on PRs touching src/, package.json, or the committed specs; fails on git diff. Mirrors the env block from docs.yml so the export path is identical. Uploads the just-exported spec as an artifact.
  • static/api.json + static/api-admin.json — committed baseline snapshots (bootstrap).
  • .gitignore — stop ignoring the two snapshots.
  • biome.jsonc — exclude the two generated, minified snapshots from the formatter.

@coveralls

coveralls commented May 27, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 27703043149

Coverage decreased (-0.09%) to 78.237%

Details

  • Coverage decreased (-0.09%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 17 coverage regressions across 1 file.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

17 previously-covered lines in 1 file lost coverage.

File Lines Losing Coverage Coverage
src/internal/http/agent.ts 17 32.56%

Coverage Stats

Coverage Status
Relevant Lines: 11884
Covered Lines: 9748
Line Coverage: 82.03%
Relevant Branches: 6813
Covered Branches: 4880
Branch Coverage: 71.63%
Branches in Coverage %: Yes
Coverage Strength: 430.82 hits per line

💛 - Coveralls

@mandarini mandarini force-pushed the ci/openapi-drift-check branch from 7b8f921 to 1cec41c Compare June 17, 2026 15:55
mandarini and others added 2 commits June 17, 2026 19:07
Stop gitignoring static/api.json and static/api-admin.json and commit
the generated snapshots so the spec drift gate has a baseline to diff
against. These were previously build-only artifacts published to GH
Pages; making the committed copy load-bearing is what lets downstream
consumers (SDKs, type generators) pin to an accurate spec.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The committed static/api.json and static/api-admin.json are emitted
minified by 'npm run docs:export' and verified by the drift gate, so
they should not be subject to biome's formatter.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mandarini mandarini self-assigned this Jun 17, 2026
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.

2 participants