Skip to content

fix(release): release script writes changelog entries into the right readme section#3917

Merged
jasonbahl merged 2 commits into
mainfrom
fix/release-readme-changelog-scope-to-section
Jun 10, 2026
Merged

fix(release): release script writes changelog entries into the right readme section#3917
jasonbahl merged 2 commits into
mainfrom
fix/release-readme-changelog-scope-to-section

Conversation

@josephfusco

@josephfusco josephfusco commented Jun 10, 2026

Copy link
Copy Markdown
Member

Before this, the release script (update-readme-changelog.js) edited the first matching version block it found anywhere in readme.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 character Z instead of end-of-input. On single-version readmes the lazy match silently fell through to the inserted branch, prepending a duplicate heading.

Tests cover both the cross-section overwrite and the duplicate-heading path.


Merge order:

  1. 👉 fix(release): release script writes changelog entries into the right readme section #3917 (this PR) — safe to land first; prevents the corruption pathway fix(release): release script no longer crashes mid-run updating readme.txt #3916 would otherwise expose
  2. fix(release): release script no longer crashes mid-run updating readme.txt #3916 — release-script crash fix
  3. fix(release): align all plugin version metadata at deploy time, not just core #3918 — deploy-time backstop

…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.
@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
wpgraphql-com Ready Ready Preview, Comment Jun 10, 2026 9:04pm

@josephfusco josephfusco changed the title fix(release): scope changelog upsert to the Changelog section, drop \Z literal fix(release): scope readme-changelog writes to the Changelog section Jun 10, 2026
@josephfusco josephfusco changed the title fix(release): scope readme-changelog writes to the Changelog section fix(release): release script writes changelog entries into the right readme section Jun 10, 2026
@josephfusco josephfusco requested a review from jasonbahl June 10, 2026 20:37
@josephfusco josephfusco marked this pull request as ready for review June 10, 2026 20:37
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 jasonbahl merged commit 42d205a into main Jun 10, 2026
41 checks passed
@jasonbahl jasonbahl deleted the fix/release-readme-changelog-scope-to-section branch June 10, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants