Skip to content

Stop the release script skipping version markers in wrapped calls - #3695

Merged
pfefferle merged 4 commits into
trunkfrom
fix/release-script-version-markers
Sep 2, 2026
Merged

Stop the release script skipping version markers in wrapped calls#3695
pfefferle merged 4 commits into
trunkfrom
fix/release-script-version-markers

Conversation

@jeherve

@jeherve jeherve commented Aug 31, 2026

Copy link
Copy Markdown
Member

Proposed changes:

The release script's version-literal patterns anchor on the name of the function the literal belongs to and span the arguments in between with .*?. That never crosses a newline, so a marker in a call wrapped across several lines keeps its placeholder and ships as 'unreleased'.

Nothing pending is affected right now, since every marker on trunk is a single-line @since. But includes/ has six calls written across several lines (class-options.php, class-http.php, class-event.php, class-place.php), and a marker in any of them would go out as-is. This came up in ATmosphere, which runs a copy of this script and had shipped 18 of them across five releases before anyone noticed.

The patterns now match on the literal's argument position rather than the function name. Anchoring on the name can't be made to work here: the name and the version sit on different lines, and every bound wide enough to span the arguments between them also swallows a ; inside a translated message, which plenty of them have.

Two things keep that off unrelated text:

  • The match must not be on a comment line. This preserves the documented version_compare() example in class-migration.php, which is what the negative lookbehind added in Release Script: Replace @since versions  #1221 was protecting. I kept that dedicated migration pattern in place as well.
  • The literal needs an argument ahead of it. None of these functions take the version first, so \__( 'unreleased', 'activitypub' ) stays put, where the word is the thing being translated rather than a version.

The patterns move to bin/version-patterns.js so the tests import what the release actually runs. They had already drifted apart: the suite was still checking the _deprecated_function pattern as #1279 left it, while release.js had since widened it to the rest of the _deprecated_* family. Two do_action_deprecated tests were also asserting against their own inline copy rather than the shared list.

Other information:

  • Have you written new tests for your changes, if applicable?

Five, covering the shapes that were slipping through: a wrapped call, a wrapped call whose message is a variable rather than a literal, a documented example inside a block comment, a commented-out call, and a translated 'unreleased' string. The 19 existing tests pass unchanged, including both migration-pattern ones. Full suite is 315 passing, npm run lint:js clean.

Testing instructions:

  • npm run test:unit -- bin/__tests__/release.test.js — 24 passing.
  • Check the script against the real tree without cutting a release:
node -e "
const {execSync}=require('child_process'), fs=require('fs');
const {phpVersionPatterns}=require('./bin/version-patterns');
const rw=s=>phpVersionPatterns('9.9.9').reduce((c,{search,replace})=>c.replace(search,replace),s);
const rx=/'unreleased'|@(since|deprecated) unreleased/gi;
for (const f of execSync('grep -rl unreleased --include=\"*.php\" . --exclude-dir=vendor --exclude-dir=node_modules --exclude-dir=build').toString().trim().split('\n')) {
  const src=fs.readFileSync(f,'utf8');
  console.log(f, (src.match(rx)||[]).length, '->', (rw(src).match(rx)||[]).length);
}"

Every file should end at 0 except includes/class-migration.php, which stays at 2. Those two are the instructional comment on lines 242 and 246, and rewriting them would destroy the example that tells the next person to use the marker.

  • Confirm the same file is untouched end to end: run the rewrite over includes/class-migration.php and diff it against the original. No lines should differ.

Changelog entry

Needs the "Skip Changelog" label. This is release tooling, so there's nothing for a site owner to read on the update screen.

The version-literal patterns anchored on the name of the enclosing function
and spanned the arguments in between with '.*?', which never crosses a
newline. Six calls in includes/ are wrapped across several lines, so a marker
in any of them would ship as 'unreleased'.

Match on the literal's argument position instead, keeping the guard that left
the documented version_compare() example in class-migration.php alone, and
requiring an argument ahead of the literal so a translated 'unreleased' string
stays put.

The patterns move to bin/version-patterns.js so the tests import what the
release runs. They had already drifted: the suite was still checking the
_deprecated_function pattern as it stood in #1279, not as release.js has it.
Copilot AI lite review requested due to automatic review settings August 31, 2026 11:40
@jeherve jeherve added the Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary. label Aug 31, 2026
@jeherve jeherve self-assigned this Aug 31, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@pfefferle
pfefferle requested a lite review from Copilot August 31, 2026 16:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

@pfefferle
pfefferle requested review from a team and a lite review from Copilot August 31, 2026 16:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

@pfefferle
pfefferle merged commit 4e8e855 into trunk Sep 2, 2026
6 checks passed
@pfefferle
pfefferle deleted the fix/release-script-version-markers branch September 2, 2026 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants