Skip to content

ci: add oasdiff breaking-change gate on PRs#1172

Merged
Stephen Lumenta (sbl) merged 3 commits into
mainfrom
ci-oasdiff-breaking-gate
Jun 11, 2026
Merged

ci: add oasdiff breaking-change gate on PRs#1172
Stephen Lumenta (sbl) merged 3 commits into
mainfrom
ci-oasdiff-breaking-gate

Conversation

@sbl

Copy link
Copy Markdown
Contributor

Why

The existing PR checks regenerate every client SDK and run its tests, which catches spec changes that break code generation. They cannot catch changes that regenerate cleanly but break consumers: a renamed operationId, a removed or renamed parameter, a changed type, or a flipped required flag regenerates clients and their tests together, so CI stays green while every published SDK changes its surface. On merge, build.yml then auto-publishes the regenerated clients to seven downstream repos.

This gap matters right now because an automated docs-quality sweep is about to open a batch of spec PRs that must be doc-only. A semantic gate makes "doc-only" machine-checked instead of reviewer-checked.

What

One new workflow, breaking-changes.yml, on pull_request:

  • Gate: oasdiff breaking <base>/doc/compiled.json <head>/doc/compiled.json --fail-on ERR. Description and example edits pass; functional surface changes fail. Both sides are the committed bundle, which the existing compare-output job already keeps honest, so no recompile happens here.
  • Escape hatch: adding the breaking-change-approved label skips the gate (the workflow re-runs on label changes), so intentional API changes are a one-label action, not a workaround.
  • Reviewer aid: the job posts the oasdiff changelog output as a sticky PR comment, so reviewers see the semantic API diff instead of compiled-bundle noise.

Verified locally against this repo's bundle: identical specs pass, a deleted operation fails with api-removed-without-deprecation, a description-only edit passes.

Follow-up (repo settings, not in this PR)

main currently has no required status checks (one approving review only), so any red check is mergeable. Suggest marking this job plus Lint, compare-output, compile-go, gradle, jest, phpunit, rspec, test, and unittest as required.

🤖 Generated with Claude Code

The generated-client test matrix only catches spec changes that fail to
compile. A renamed operationId, a removed parameter, or a changed type
regenerates clients and their tests together, so everything stays green
while every SDK consumer breaks — and build.yml then auto-publishes the
regenerated clients to seven downstream repos on merge.

oasdiff compares the compiled spec semantically: doc-only edits
(descriptions, examples) pass, functional surface changes fail with
--fail-on ERR. Both sides of the diff are the committed
doc/compiled.json, which the existing compare-output job already keeps
honest, so no recompile is needed.

Intentional API changes opt out via the breaking-change-approved label;
the job also posts the oasdiff changelog as a sticky PR comment so
reviewers see the semantic diff instead of bundle noise.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

API changelog (oasdiff)

Doc-only edits (descriptions, examples) do not appear here.

No changes detected

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new GitHub Actions workflow to semantically detect breaking OpenAPI surface changes in pull requests (using oasdiff against the committed doc/compiled.json), with a label-based override and an automated changelog comment to aid reviewers.

Changes:

  • Introduces breaking-changes.yml workflow triggered on PR updates and label changes.
  • Checks out both PR head and base commit, runs oasdiff changelog, and posts/updates a “sticky” PR comment.
  • Fails the workflow on detected breaking changes unless the breaking-change-approved label is present.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/breaking-changes.yml Outdated
Comment thread .github/workflows/breaking-changes.yml Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

@docstun Manuel Boy (docstun) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Stephen Lumenta (@sbl) neat! If works as intended, we can bundle this into a shared action and bring this to the remaining OpenAPI schema repos for consistency.

@sbl Stephen Lumenta (sbl) merged commit 781ef2c into main Jun 11, 2026
12 checks passed
@sbl Stephen Lumenta (sbl) deleted the ci-oasdiff-breaking-gate branch June 11, 2026 18:17
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.

3 participants