fix(release): keep generated release notes when the write-back fails - #1008
Open
shashank-100 wants to merge 1 commit into
Open
fix(release): keep generated release notes when the write-back fails#1008shashank-100 wants to merge 1 commit into
shashank-100 wants to merge 1 commit into
Conversation
`versionPackages` staged the root changelog beside the package, let Changesets write the new release notes into it, copied the result back to the root, and removed the staged file in a `finally`. That cleanup ran unconditionally. If the write-back on line 53 failed — disk full, permissions, an interrupted write — the staged file was deleted anyway, and it was at that moment the only copy of the new release notes: Changesets has already consumed the `.changeset/*.md` entries that produced them, and the root still holds pre-version content. Recovery was manual. Remove the staged copy only after the write-back succeeds. A failed write-back now leaves the generated history in place and reports where to find it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019jAgP7j1gaT9fSk5syLHDH
Contributor
|
PR author is not in the allowed authors list. |
|
@shashank-100 is attempting to deploy a commit to the Modem Team on Vercel. A member of the Team first needs to authorize it. |
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.
Problem
scripts/changeset-version.tskeeps Hunk's changelog canonical at the repository root by staging it besidepackages/hunk, running Changesets, and copying the generated result back. The cleanup ran in afinally:If the write-back fails — disk full, permissions, an interrupted write — the staged file is deleted anyway. At that moment it holds the only copy of the new release notes: Changesets has already consumed the
.changeset/*.mdentries that produced them, and the root still contains pre-version content. The generated history is gone and recovery is manual, during a release.Approach
Remove the staged copy only once it is reproducible again. A failure before Changesets produced output still cleans up and rethrows unchanged; a failure after leaves the generated file in place and reports where to find it:
Non-goals: the staging strategy, the canonical-root invariant, and the success path are unchanged. This only narrows when the cleanup is allowed to run. The original error is attached as
cause.Why core
Release tooling under
scripts/, alongside the code it fixes. No runtime or extension surface is involved.Tests
Added
keeps the generated changelog when it cannot be returned to the rootinscripts/changeset-version.test.ts. It makes the write-back fail after Changesets has produced output, then asserts the generated notes survive. Confirmed to fail on the unfixed code (rawEACCES, staged file already deleted) and pass with the fix.The existing
removes the staged package changelog when Changesets failstest still passes, so the pre-output failure path is unchanged.Beyond the test, I verified the data loss directly against both versions of the function:
Commands run
The 2 full-suite failures are not from this change; the diff touches only
scripts/changeset-version.*:install VM contract > allows cleaning only real harness-owned paths...— pre-existing onmain. Reproduced on a clean tree atupstream/main:bun test test/cli/install-vm/contract.test.ts→10 pass, 1 fail. The harness compares arealpathSync-resolved root against an unresolved target, so macOS's/var→/private/varsymlink breaks the containment check.filesystem watch observerandJujutsu source readingfailures appear only under full-suite parallel load and are timing-sensitive. Re-runningbun test packages/hunk/src/core/watch/with this change applied gives68 pass, 0 fail.Platforms
Verified on macOS (darwin 25.6.0). The new test skips on Windows and as root, where the permission denial it depends on does not hold; the fix itself is platform-neutral
node:fscontrol flow.Changeset
Empty, per CONTRIBUTING — this is release tooling with no user-visible behavior change.
Follow-up
Found while reviewing
e76b0039; noted as a follow-up in #1007 and split out here so each change is reviewable on its own. Independent of #1007 — branched frommain, no shared files, either can merge first.🤖 Generated with Claude Code
https://claude.ai/code/session_019jAgP7j1gaT9fSk5syLHDH