fix(publish): say the diff is unavailable rather than claiming no changes - #11
Merged
Merged
Conversation
…nges The catch around oasdiff wrote "No API-surface changes detected." That branch only runs inside stage === 'changed', which means the spec provably differs from what is published, so a crashed differ produced a permanent public statement that the opposite was true, in both CHANGELOG.md and the release body. Empty oasdiff output and a dead oasdiff are different facts and now read differently; the empty case keeps its wording, which is accurate. The error is also logged rather than swallowed, so the job says why. Verified by running the publisher with oasdiff absent: the log carries "spawnSync oasdiff ENOENT" and the entry reads "Diff unavailable". Not fixed here: this path has never executed in production. CHANGELOG.md holds one entry, "Initial published spec.", which is the no-previous-spec branch, so oasdiff has not run once. UN-7216 carries that.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Part of UN-7216.
The bug
publish.tswrapped theoasdiff changelogcall in atry/catchwhose fallback wasNo API-surface changes detected.That branch only runs inside
stage === 'changed', andclassifyreturnschangedprecisely when the incoming spec differs from what is published. So the one situation where the fallback fires is the one situation where "no changes" is guaranteed false — and the result is written intoCHANGELOG.mdand reused as the GitHub Release body, permanently and publicly.Not failing the publish over a broken differ is the right call. The fallback text was the problem, not the fallback.
The change
The
catchnow writesDiff unavailable: the spec changed, but oasdiff did not run.and logs the underlying error instead of swallowing it.The
|| 'No API-surface changes detected.'on empty oasdiff output is untouched: empty output genuinely means oasdiff found no API-surface changes, which is a true statement. A crash and an empty result are different facts and should not share a sentence.Verification
Ran the publisher against a scratch clone with a local bare remote,
oasdiffabsent, and a modified spec:npm run typecheckclean,npm test11/11.Context worth knowing
This path has never executed in production.
CHANGELOG.mdcontains exactly one entry,Initial published spec., which is the!fs.existsSync(SPEC_JSON)branch.oasdiff changeloghas not run here once, so the first real exercise of it will be the next production deploy that changes the spec.UN-7216 carries that and the related pipeline findings.