chore: sync infra OpenAPI specs#492
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Additional findings (outside current diff — PR may have been updated during review):
-
🟡
src/core/shared/contracts/infra-api.types.ts:7-13— The regenerated OpenAPI type files (dashboard-api.types.ts,infra-api.types.ts) use openapi-typescript's default formatting (4-space indent, double quotes, semicolons) instead of the project's biome config (2-space, single quotes, semicolons asNeeded), which is why the diff is dominated by wholesale reformatting. Root cause:.github/workflows/sync-infra-specs.yml:76diffssrc/types/*.types.tsbut thegenerate:*scripts inpackage.jsonemit tosrc/core/shared/contracts/*.types.ts, soGENERATED_TYPE_FILESis always empty and the autofix step silently exits — the PR description's promise to apply 'formatting/lint autofixes' is never honored. Fix by updating the paths in the workflow tosrc/core/shared/contracts/infra-api.types.ts src/core/shared/contracts/dashboard-api.types.ts; otherwise every future sync PR will churn the same reformatting.Extended reasoning...
What the bug is
The two regenerated files in this PR (
src/core/shared/contracts/dashboard-api.types.ts,src/core/shared/contracts/infra-api.types.ts) come out ofopenapi-typescriptwith its defaults — 4-space indent, double quotes, mandatory semicolons — whilebiome.jsonfor this repo specifiesindentWidth: 2,javascript.formatter.quoteStyle: "single",semicolons: "asNeeded". The pre-PR committed versions of both files followed the biome config, and the sister filesrc/core/shared/contracts/argus-api.types.ts(untouched by this PR) also follows biome style — so the norm is clear: these generated files are expected to be biome-formatted.Root cause: a path bug in the sync workflow
.github/workflows/sync-infra-specs.yml:76filters the diff on the wrong paths:GENERATED_TYPE_FILES=$(git diff --name-only -- src/types/infra-api.types.ts src/types/dashboard-api.types.ts | tr '\n' ' ')But
package.jsonwrites the generated files elsewhere:"generate:infra": "bunx openapi-typescript ./spec/openapi.infra.yaml -o ./src/core/shared/contracts/infra-api.types.ts", "generate:dashboard-api": "bunx openapi-typescript ./spec/openapi.dashboard-api.yaml -o ./src/core/shared/contracts/dashboard-api.types.ts",
src/types/*.types.tsdoes not exist in this repo — the actual generated files live undersrc/core/shared/contracts/. Thegit diff --name-only -- <path>pathspec matches nothing, soGENERATED_TYPE_FILESis empty, the guard at line 78–81 fires (No generated type changes detected; skipping autofix.), andbunx biome format --write/bunx biome lint --writenever run. The step exits 0, and the PR is created with the raw openapi-typescript output.Step-by-step proof
- Cron fires; workflow downloads new specs into
spec/openapi.infra.yamlandspec/openapi.dashboard-api.yaml. bun run generate:infraandbun run generate:dashboard-apioverwritesrc/core/shared/contracts/{infra,dashboard}-api.types.tswith openapi-typescript's 4-space/double-quote/semicolon output.- The autofix step runs
git diff --name-only -- src/types/infra-api.types.ts src/types/dashboard-api.types.ts. Since those paths don't exist in the tree, git returns nothing. GENERATED_TYPE_FILESis empty → the[[ -z ... ]]branch printsNo generated type changes detected; skipping autofix.andexit 0.peter-evans/create-pull-requestcommits the unformatted regenerated files along with the spec change, producing exactly the wholesale-reformatting diff visible here.
Running
bunx @biomejs/biome format --write ./src/core/shared/contracts/infra-api.types.tslocally reformats the entire file from 4-space/double-quote/semicolon to 2-space/single-quote/no-semicolon — that's the diff the PR description promises but doesn't deliver.Why existing code doesn't prevent it
The autofix step is the only thing that would have normalized this, and it silently no-ops. There's no
files.ignoreentry inbiome.jsonand no.biomeignorecoveringsrc/core/shared/contracts/**, so the formatter has no reason to skip these files — the step just never runs. Thelintjob incode-quality.ymluses--formatter-enabled=false, so it doesn't gate merge on formatting either.Impact
Auto-generated files, no runtime impact — but every future scheduled sync PR will churn the same massive whitespace/quote/semicolon diff until either (a) the workflow paths are corrected or (b) a biome ignore rule is added for
src/core/shared/contracts/*.types.ts. Reviewers will keep seeing 5000+ noise lines for what should be a small schema update (this PR's real change is the fourhugePages*fields onNodeMetrics).How to fix
Update line 76 of
.github/workflows/sync-infra-specs.ymlto point at the actual output paths:GENERATED_TYPE_FILES=$(git diff --name-only -- src/core/shared/contracts/infra-api.types.ts src/core/shared/contracts/dashboard-api.types.ts | tr '\n' ' ')(Optionally add
src/core/shared/contracts/argus-api.types.tstoo ifgenerate:argusever gets wired into this sync workflow.) The fix belongs in a follow-up PR since this PR does not modify the workflow file. - Cron fires; workflow downloads new specs into
8acae14 to
674ba8c
Compare
18aace8 to
9d14bf4
Compare
ee010e1 to
6606c62
Compare
2fb89f9 to
89bc944
Compare
47442a8 to
e582f1f
Compare
44f53de to
6eb66e2
Compare
465be1c to
75cdceb
Compare
This PR syncs OpenAPI specs from e2b-dev/infra:
spec/openapi.infra.yamlspec/openapi.dashboard-api.yamlIt also regenerates dependent TypeScript API types and applies formatting/lint autofixes.
This PR was automatically created by the sync-infra-specs workflow.