Skip to content

PLAT-1314/ci: reject stale embedded OpenAPI specs - #9

Merged
brtkwr merged 1 commit into
mainfrom
bkunwar/plat-1314-codegen-drift
Oct 29, 2026
Merged

brtkwr merged 1 commit into
mainfrom
bkunwar/plat-1314-codegen-drift

Conversation

@brtkwr

@brtkwr brtkwr commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

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

  • Add make check-generated, which runs the existing generator against vendored inputs and checks embedded outputs for tracked changes and untracked files.
  • Run the drift gate in normal PR/main CI before the test suite, with the generated diff and repair command shown on failure.
  • Document how to regenerate and commit embedded specs alongside source/preprocessor changes.

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:

  • build: go build ./..., the new make check-generated gate (embedded OpenAPI specs are up to date), and all tests through make test-cover passed. Total coverage 80.7% exceeds the 80% gate.
  • lint: all repository lints passed.
  • No tests or regeneration run locally. git diff --check passed.

Ticket

Refs PLAT-1314.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T10:12:09.828487Z 5e5104b PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@brtkwr
brtkwr merged commit 4e816c1 into main Oct 29, 2026
2 checks passed
@brtkwr
brtkwr deleted the bkunwar/plat-1314-codegen-drift branch October 29, 2026 10:11

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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/)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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.

1 participant