fix(release): release script writes changelog entries into the right readme section#3917
Merged
Merged
Conversation
…Z literal Two latent defects in update-readme-changelog.js, surfaced by reviewing the IDE 5.0.0 release-please incident end-to-end: 1) Full-content match could cross sections. The previous regex matched the first `^= X.Y.Z =` heading in the entire readme. By the time this script runs in the workflow, `update-upgrade-notice.js` has already written `= X.Y.Z =` into the Upgrade Notice section — so the changelog block silently overwrote the Upgrade Notice entry instead of the intended Changelog entry. Locally reproducible against the IDE 5.0.0 readme shape. 2) `\Z` was a literal `Z`, not an end-of-input anchor. JavaScript regex does not recognize `\Z`; when neither sibling alternative (`^= <ver>`, `^== `) fired, the lookahead fell through to no-match, the script took the `inserted` branch, and produced a duplicate `= X.Y.Z =` heading. Scope the match to the slice that starts at `== Changelog ==` (everything before is pass-through prefix), and replace the lookahead's `\Z` with a plain end-of-input `$` (no `m` flag on the inner regex, lookbehind anchors line start). Both defects are now structurally precluded, not just regex-tweaked. Add two regression tests: one fixture matching PR #3892's shape (Upgrade Notice and Changelog both carry `= X.Y.Z =`); one for the single-version readme that triggered the `\Z` insert-duplicate path.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Per PR feedback: comments explaining what the previous (buggy) regex did belong in the PR description and commit log, not in permanent source. Keeps only the why-is-this-code-shaped-this-way notes.
jasonbahl
approved these changes
Jun 10, 2026
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.
Before this, the release script (
update-readme-changelog.js) edited the first matching version block it found anywhere inreadme.txt— which on a release where the upgrade-notice script ran first is the one in the Upgrade Notice section. The Changelog silently never got the new entry, and the Upgrade Notice got rewritten with changelog markup instead of upgrade guidance.Scopes the script to the slice of the file that starts at
== Changelog ==. Also fixes a latent bug where the lookahead used\Z— not a valid JS regex escape, so it matched the literal characterZinstead of end-of-input. On single-version readmes the lazy match silently fell through to theinsertedbranch, prepending a duplicate heading.Tests cover both the cross-section overwrite and the duplicate-heading path.
Merge order: