From acfe84d9cf54348f95dc0133269ce05d7d607ecc Mon Sep 17 00:00:00 2001 From: "courtmanr@gmail.com" Date: Sun, 26 Jul 2026 09:49:11 +0100 Subject: [PATCH] Fix issue version parser dropping capitalised V prefixes normalizeVersion matched /\bv?(\d+\.\d+\.\d+...)/ without the i flag, so a reported version written as "V6.0.4" never parsed. The heading regexes in extractPulseVersion already carry the i flag and did capture "V6.0.4" correctly, but they hand the captured string to normalizeVersion, which then returned null. That collapsed every extraction path -- inline scan, heading match, legacy match, and title fallback -- so the issue was labelled needs-version-info despite stating its version. Adding the i flag to normalizeVersion fixes all four paths at once. It is a no-op on the rest of the pattern, since [0-9A-Za-z.-] already spans both cases. Seen on #1538, which stated "V6.0.4" under the "Pulse version" heading and was wrongly flagged as missing version metadata. Co-Authored-By: Claude Opus 5 --- .github/scripts/issue-version-triage.cjs | 2 +- .github/scripts/issue-version-triage.test.cjs | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/scripts/issue-version-triage.cjs b/.github/scripts/issue-version-triage.cjs index 81ee6be658..b333ae2037 100644 --- a/.github/scripts/issue-version-triage.cjs +++ b/.github/scripts/issue-version-triage.cjs @@ -25,7 +25,7 @@ function extractSectionValue(body, heading) { function normalizeVersion(value) { if (!value) return null; - const match = String(value).match(/\bv?(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)\b/); + const match = String(value).match(/\bv?(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)\b/i); return match ? match[1] : null; } diff --git a/.github/scripts/issue-version-triage.test.cjs b/.github/scripts/issue-version-triage.test.cjs index ad0e7ea31e..7610fa0c17 100644 --- a/.github/scripts/issue-version-triage.test.cjs +++ b/.github/scripts/issue-version-triage.test.cjs @@ -182,3 +182,28 @@ test("postRetestComment skips maintainer-authored issues", async () => { assert.equal(calls.createComment.length, 0); }); + +test("normalizeVersion accepts a capitalised V prefix", () => { + const { normalizeVersion } = triage.internals; + + // Regression: issue #1538 reported "V6.0.4" under the "Pulse version" + // heading and was wrongly labelled needs-version-info. The heading regexes + // are case-insensitive and captured "V6.0.4" correctly, but handed it to a + // case-sensitive normalizeVersion, so every extraction path returned null. + assert.equal(normalizeVersion("V6.0.4"), "6.0.4"); + assert.equal(normalizeVersion("v6.0.4"), "6.0.4"); + assert.equal(normalizeVersion("6.0.4"), "6.0.4"); + assert.equal(normalizeVersion("V6.1.0-rc.4"), "6.1.0-rc.4"); + + assert.equal(normalizeVersion("V6"), null); + assert.equal(normalizeVersion("### Pulse version"), null); +}); + +test("extractPulseVersion reads a capitalised version under its heading", () => { + const { extractPulseVersion } = triage.internals; + + assert.equal( + extractPulseVersion("[Bug]: something broke", "### Pulse version\nV6.0.4\n"), + "6.0.4" + ); +});