Repository navigation
Commit ff78363
authored
ci: fail the lint job when openapi.json drifts from its JSDoc (#3040)
## Summary
**Adds a CI gate so `packages/api/openapi.json` can't silently drift from the JSDoc it is generated from.**
- **Problem:** the committed spec was enforced only by the husky lint-staged hook, which `--no-verify`, a hook-less clone, a bad merge resolution, or a direct hand-edit all bypass — nothing in CI noticed.
- **Fix:** `scripts/ci/check-openapi-sync.sh` regenerates the spec and fails on a diff, wired into the `lint` job and `make ci-lint`; the lint-staged key now also covers `src/utils/swagger.ts`, whose `swaggerOptions` (title, `servers`, `tags`) is a spec input the hook never watched.
- **Why it runs outside nx:** the api's own `ci:lint` regenerates the spec but never asserts on it — `nx affected` skips the api on PRs that don't touch it, and because `ci:lint.outputs` lists the file, a cache hit *restores* the spec rather than regenerating it.
- **`.prettierignore` is part of the fix, not cleanup:** prettier reformats the spec by ~1400 lines (it collapses short arrays; the generator's `JSON.stringify` does not) and the root lint-staged JSON group matches it, so without the ignore no commit could satisfy both formatters and the gate would be permanently red.
Verified by perturbing the JSDoc (gate fails, `git add` clears it), by hand-editing the spec (fails, where `nx run @hyperdx/api:ci:lint` is a cache hit that passes), and by a real `lint-staged` run on a `swagger.ts` edit. `make ci-lint` is green.
### How to test on Vercel preview
N/A — non-UI change.
### References
- Linear Issue: none
- Related PRs: none
Note for reviewers: this invalidates every nx cache entry once (`.prettierignore` and root `package.json` are both in `sharedGlobals`), so this PR's `lint` job runs cold. Recent runs are 3:25–4:21 against `timeout-minutes: 8`; if it trips the timeout it needs bumping here, since a re-run is restore-only and will still be cold.1 parent 53336f7 commit ff78363
6 files changed
Lines changed: 55 additions & 1 deletion
File tree
- .github/workflows
- agent_docs
- scripts/ci
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
117 | 122 | | |
118 | 123 | | |
119 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
71 | 75 | | |
72 | 76 | | |
73 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
0 commit comments