Repository navigation
PLAT-1314/ci: reject stale embedded OpenAPI specs - #9
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5e5104bb36
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| # Include untracked files: adding a generator output must fail until that new | ||
| # file is committed, even though git diff alone would not show it. | ||
| changes="$(git status --porcelain --untracked-files=all -- cmd/twoctl/cli/specs/)" |
There was a problem hiding this comment.
Remove orphaned outputs before checking drift
When an API is removed or renamed in scripts/codegen.sh, regeneration leaves its previously tracked .processed.yaml file untouched, and this status check therefore reports a clean tree. Because operations.go embeds every matching file—and can still reference the orphan through its separate apiMeta list—a support-removal change can pass this gate while retaining and potentially exposing the stale API. Clear the generated directory before regeneration or compare its complete file set against the expected outputs.
Useful? React with 👍 / 👎.
Context
PLAT-1314 calls for CI to fail on stale generated code. Nightly upstream regeneration already opens PRs, but ordinary PR CI never checks that embedded OpenAPI specs still match the committed inputs and preprocessor. The CLI can therefore pass build/tests while using stale API definitions.
Changes
make check-generated, which runs the existing generator against vendored inputs and checks embedded outputs for tracked changes and untracked files.Scope / Non-goals
The upstream refresh schedule and authentication remain unchanged. This uses the committed specs and needs no external API credentials. It is independent of open #6 and #8 and starts from main including merged #7.
Validation
On exact head
5e5104bb3649cace92bcf5d181d06496c75539a7, CI run 40855414113 passed both jobs:go build ./..., the newmake check-generatedgate (embedded OpenAPI specs are up to date), and all tests throughmake test-coverpassed. Total coverage 80.7% exceeds the 80% gate.git diff --checkpassed.Ticket
Refs PLAT-1314.