ci(openapi): enforce info.version bump on spec changes + version sidecar#246
Open
paperclip-resolver[bot] wants to merge 1 commit into
Open
ci(openapi): enforce info.version bump on spec changes + version sidecar#246paperclip-resolver[bot] wants to merge 1 commit into
paperclip-resolver[bot] wants to merge 1 commit into
Conversation
Adds a pull_request CI check that fails when public/openapi.json paths or response schemas change without an info.version bump (and when a bump lacks a CHANGELOG.md entry). Emits public/openapi-version.json as a lightweight pollable consumer signal, documents the SemVer policy in CONTRIBUTING.md, and seeds CHANGELOG.md. Note: .github/workflows/openapi-version-check.yml is not included here because the paperclip-resolver[bot] App installation on the Sharp-API org lacks the workflows permission. The workflow YAML is in the PR description for an operator with workflows-write to commit separately. Fixes #233
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #233
Summary
Customer ask (Phil Goodrich) — bump
info.versionon everyopenapi.jsonpaths/schema change, and give consumers a cheap way to detect those bumps.#230shipped the one-off/accountshape fix + version bump; this PR is the systemic guardrail so the next divergence doesn't slip through.Changes
CONTRIBUTING.mdgains an OpenAPI spec versioning section: SemVer rules (MAJOR / MINOR / PATCH), local-run instructions, and the consumer signal.scripts/check-openapi-version.mjsis a self-contained Node script that compares the base-branch spec against the PR's spec by canonicalised.pathsand.components.schemas(infox-*stamping is ignored, so build-time provenance churn never trips it). It fails CI when paths/schemas changed without aninfo.versionbump, and when a bump lacks aCHANGELOG.mdentry — self-enforcing changelog hygiene.scripts/stamp-openapi.mjs(already runs in build) now also emitspublic/openapi-version.json:{ "version": "2.1.0", "x-generated-at": "...", "x-commit-sha": "..." }https://docs.sharpapi.io/openapi-version.json(~120 bytes) instead of re-downloading the full ~170 KB spec. Seeded with current provenance; build refreshes it on every deploy.CHANGELOG.mdseeded with 2.0.0 + 2.1.0 entries; future bumps enforced by the CI check.The CI workflow file that wires up the script (
.github/workflows/openapi-version-check.yml) is not in this commit. Thepaperclip-resolver[bot]GitHub App installation on the Sharp-API org lacks theworkflowspermission, so the Git Data API rejected the tree write withx-accepted-github-permissions: actions=write. (Plain blobs and trees outside.github/workflows/work fine — only workflow file writes are gated.)A reviewer with workflows-write should add the file below before merging, either via the GitHub web UI ("Add file → Create new file") or via a regular
git pushfrom their own identity:.github/workflows/openapi-version-check.yml(verbatim):Alternatively: grant the
paperclip-resolver[bot]App the Actions (or Workflows) write permission on the Sharp-API org install, then I can push the workflow on a subsequent run.Verification
scripts/check-openapi-version.mjsunit-tested against 5 branches in the worktree before commit:scripts/stamp-openapi.mjssmoke-run in the worktree: emits a validopenapi-version.json({ "version": "2.1.0", ... }) and does not perturb the spec semantics (only infox-*fields, which the checker ignores).Type: ci