Skip to content

ci: wire npm run test:openapi into build-check.yml#4518

Merged
bokelley merged 5 commits into
mainfrom
ci/wire-openapi-freshness-gate
May 14, 2026
Merged

ci: wire npm run test:openapi into build-check.yml#4518
bokelley merged 5 commits into
mainfrom
ci/wire-openapi-freshness-gate

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Summary

Adds one step to the build job in .github/workflows/build-check.yml:

```yaml

  • name: OpenAPI freshness (static/openapi/registry.yaml regenerated from Zod source)
    run: npm run test:openapi
    ```

Why

package.json already had the freshness gate:

```json
"test:openapi": "tsx scripts/generate-openapi.ts && git diff --exit-code static/openapi/registry.yaml || (echo 'OpenAPI spec is out of date. Run: npm run build:openapi' && exit 1)"
```

But it lived inside the umbrella npm run test script, and build-check.yml cherry-picks ~10 specific test scripts — test:openapi was never one of them. So Zod-schema PRs were landing without triggering a regen, and static/openapi/registry.yaml would drift until someone happened to run npm run build:openapi locally as part of an unrelated PR. Most recently #4515 absorbed ~340 lines of catchup.

After this change any PR that touches a Zod schema reachable from generate-openapi.ts without regenerating the yaml will fail its own CI with the existing error message: `OpenAPI spec is out of date. Run: npm run build:openapi`.

Test plan

  • Workflow-only change; no source schemas touched
  • Confirm build-check CI on this PR passes the new step (yaml is fresh against main)

Closes #4516.

🤖 Generated with Claude Code

@bokelley bokelley force-pushed the ci/wire-openapi-freshness-gate branch from 35117a7 to 2b22fe1 Compare May 14, 2026 08:04
@bokelley bokelley force-pushed the ci/wire-openapi-freshness-gate branch from acd2054 to 8db6a98 Compare May 14, 2026 08:51
Brian O'Kelley and others added 3 commits May 14, 2026 10:15
The OpenAPI freshness script (tsx scripts/generate-openapi.ts && git diff
--exit-code static/openapi/registry.yaml) already existed in package.json
and ran inside the umbrella npm run test. But build-check.yml cherry-picks
specific test scripts and never invoked it, so Zod-schema PRs were landing
without regenerating static/openapi/registry.yaml. Drift accumulated until
someone happened to run npm run build:openapi locally (e.g. #4515 absorbed
~340 lines).

After this change any PR that edits server/src/schemas/registry.ts (or any
schema reachable from generate-openapi.ts) without regenerating the yaml
will fail its own CI with the existing error message:
"OpenAPI spec is out of date. Run: npm run build:openapi".

Workflow-only — no source schemas change. Closes #4516.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…step

generate-openapi.ts transitively imports auth middleware which constructs
WorkOS at module load — the script never makes a network call but the
constructor demands API key or client ID. Dummy values satisfy validation;
CI doesn't ship real secrets and shouldn't need to for spec generation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bokelley bokelley force-pushed the ci/wire-openapi-freshness-gate branch from 8db6a98 to d895d22 Compare May 14, 2026 14:15
Brian O'Kelley and others added 2 commits May 14, 2026 10:32
The added OpenAPI freshness step re-runs scripts/generate-openapi.ts,
which is import-heavy. Combined with the existing 10-script pipeline,
the job started timing out at exactly 15 min. 20 gives headroom without
masking real regressions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ng on module-load timers

Importing server/src/routes/registry-api.js pulls in:
  - middleware/auth.ts          (3 module-level setInterval calls for
                                 session-cache cleanup, etc.)
  - middleware/pg-rate-limit-store.ts  (setInterval flushing
                                 in-memory rate-limit buckets to PG)

Those timers keep the Node event loop alive after the yaml has been
written, so the script sits idle until the surrounding CI job hits its
timeout. Locally the timers sometimes get unreferenced by tsx fast
enough that the script appears to exit, but the behavior was always
fragile; in CI the same code reliably runs 17+ minutes before the job
times out (vs ~3s of real work).

Explicit process.exit(0) — we're done as soon as the file is written,
and we don't need a long-running auth subsystem in a build-time spec
generator.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bokelley bokelley merged commit 2b514f8 into main May 14, 2026
13 checks passed
@bokelley bokelley deleted the ci/wire-openapi-freshness-gate branch May 14, 2026 16:16
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.

CI: wire npm run test:openapi into build-check.yml

1 participant