Repository navigation
ci(openapi-diff): Compare API schemas with the PR's merge-base - #130541
Open
sentry-junior[bot] wants to merge 2 commits into
Open
sentry-junior[bot] wants to merge 2 commits into
sentry-junior[bot] wants to merge 2 commits into
Conversation
The openapi-diff job compared each PR with getsentry/sentry-api-schema main, so it showed unrelated master changes. json-diff exited 1 on any spec change, so the job failed on every API PR and skipped the RPC breaking-change check exactly then. - The openapi workflow uploads the master spec and RPC schema as an api-schemas artifact. PRs take their baseline from the artifact for their merge-base, falling back to the newest api@ release and then to sentry-api-schema main. - The public spec diff is an oasdiff changelog in the job summary and never fails. - The RPC oasdiff breaking check runs in its own job, so it always runs. - make diff-api-docs uses the same script, replacing the json-diff script and its dependency. Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Contributor
|
🚨 Warning: This pull request contains Frontend and Backend changes! It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently. Have questions? Please ask in the |
Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
This branch has not been deployed
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.
openapi-diffcompared every backend PR with getsentry/sentry-api-schemamain, which is the latest master and not where the PR branched off, so its diff also showed unrelated master changes. Itsjson-diffstep exits 1 on any difference, so the job failed on every PR that changes the spec. That's why develop-docs calls the failure expected, and also why the RPC breaking-change step after it was skipped on exactly those PRs.In the 100 runs I sampled, 69 hit the
api_docsfilter. 27 failed at json-diff, and the RPC check was skipped in all 27. The other 42 ran the RPC check and passed. #130472 moves@sentry/apiintostatic/packages/api, which gives master a second baseline source besides sentry-api-schema: theapi@release assets.What changes
Baselines come from the PR's merge-base.
openapi.ymlnow uploadstests/apidocs/openapi-derefed.jsonandrpc_method_schema.jsonfrom each master build as anapi-schemasartifact, kept for 30 days.scripts/openapi-diff.sh baselinegets the merge-base from the compare API and walks back up to 30 master commits to the closest one with that artifact. Every commit that can change the schemas uploads one. Fallbacks, in order:api@GitHub release, picked by listing releases, sincereleases/latestis sentry's calver release;main, for as long as it still receives the spec.The job summary says which baseline it used. Each source writes to a scratch directory, so a source that fails halfway leaves nothing behind.
The public spec diff is a changelog. The
changelogjob writes anoasdiff changelog --format markdownto the job summary, capped below GitHub's 1 MiB limit, and never fails. A missing baseline or an oasdiff error becomes a note in the summary.The RPC check runs in its own job. The
rpc-breakingjob runsoasdiff breaking --fail-on WARNon the RPC schema, so nothing upstream can skip it. Control and cell silos deploy separately, and the new requiredapi-clientcheck (feat(api): Move the @sentry/api package into static/packages/api #130472) doesn't cover RPC.One build. The
buildjob still builds the spec and RPC schema once, withsetup-sentry. The two compare jobs only download its artifact and run the oasdiff image, so CI cost stays about the same.make diff-api-docsruns the same script: the merge-base baseline, then the changelog. It needs gh and docker. That replacesapi-docs/openapi-diff.tsand itsjson-diffdependency, so the lockfile only loses thejson-diffsubtree.A new
make build-rpc-schemawrites.artifacts/rpc_method_schema.json. It's the same target feat(api): Move the @sentry/api package into static/packages/api #130472 adds.A shellcheck pre-commit hook (
--shell=sh --enable=check-extra-masked-returns) covers the new script.The develop-docs text that says this check is expected to fail is updated in getsentry/sentry-docs#20679, which already rewrites that section.
Interaction with #130472
This PR is off master and doesn't depend on #130472, but the two touch neighboring lines in
openapi.ymlandMakefile.build-rpc-schematarget, and point theapi-schemasupload atstatic/packages/api/spec/or.artifacts/rpc_method_schema.json. The baseline script finds both files by name inside the artifact, so their paths don't matter.Verification
--shell=sh --enable=check-extra-masked-returns) is clean. actionlint reports nothing new; its only finding is the existingubuntu-26.04-armlabel. knip is clean.api-schemasartifact exists yet and there's noapi@release, so it fell back to sentry-api-schemamain(15.8 MB spec plus RPC schema) in 18 s.api@release exists: it uses the release;rpc-breakingon identical schemas exits 0, and on a schema with a removed method it prints::errorand exits 1.Co-Authored-By: BYK 126780+BYK@users.noreply.github.com
via @BYK.
--
View Session in Sentry