Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Do not shorten malformed issue versions into release labels

pulse-triage[bot]9d5eb9df0cf3
diff --git a/.github/scripts/issue-version-triage.cjs b/.github/scripts/issue-version-triage.cjs
index df2b82e6ae..84b90ccdce 100644
--- a/.github/scripts/issue-version-triage.cjs
+++ b/.github/scripts/issue-version-triage.cjs
@@ -6,6 +6,12 @@ const BUG_LABEL = "bug";
const DOCS_LABEL = "documentation";
const ENHANCEMENT_LABEL = "enhancement";
+// Match a complete version token, not a valid-looking prefix of a malformed
+// value. An extra core component, unfinished suffix or empty prerelease
+// segment must not turn into an assertion about another release. Ordinary
+// sentence punctuation after a complete token remains harmless.
+const VERSION_TOKEN = String.raw`\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?![0-9A-Za-z_-]|\.+[0-9A-Za-z_-])`;
+
// These headings end a secondary-topic field at its own level or above.
// Deeper headings and legacy field-looking prose remain that topic's evidence,
// not a second source of primary version or feedback metadata.
@@ -249,7 +255,9 @@ function isActionableTopicValue(value, report) {
function normalizeVersion(value) {
if (!value) return null;
- const match = String(value).match(/\bv?(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)\b/i);
+ // Do not salvage a later dotted fragment after rejecting the original
+ // token (for example, 6.0.1 inside 6.6.0.1).
+ const match = String(value).match(new RegExp(String.raw`(?<![0-9A-Za-z_.-])v?(${VERSION_TOKEN})`, "i"));
return match ? match[1] : null;
}
@@ -307,9 +315,9 @@ function normalizeLegacyVersionValue(value, report) {
// The complete version must follow its server prefix immediately. An
// unversioned/incomplete image or a companion binary cannot borrow an
// agent/platform number later in the value (or one in the registry name).
- const declared = visible.match(
- /^(?:(?:pulse|server(?:[ \t]*\+[ \t]*pulse-agent)?)[ \t]+|(?:[a-z0-9._/-]+\/)?pulse(?:-pro)?:[ \t]*|pulse(?:-pro)?[-_])?v?(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)\b/i
- );
+ const declared = visible.match(new RegExp(
+ String.raw`^(?:(?:pulse|server(?:[ \t]*\+[ \t]*pulse-agent)?)[ \t]+|(?:[a-z0-9._/-]+\/)?pulse(?:-pro)?:[ \t]*|pulse(?:-pro)?[-_])?v?(${VERSION_TOKEN})`, "i"
+ ));
if (!declared) return null;
const version = declared[1];
return declaredVersionIsTransition(version + visible.slice(declared[0].length))
@@ -321,7 +329,7 @@ function extractTitlePulseVersion(title) {
// A starting version in an upgrade title is not a running declaration.
if (/\b(?:upgrad(?:e|ed|ing)|migrat(?:e|ed|ing))\b[^\n]*\bfrom\b/i.test(text)) return null;
- const version = String.raw`v?\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?\b`;
+ const version = String.raw`v?${VERSION_TOKEN}`;
// A title can also name the agent, OS or monitored platform. Prefer a
// server-qualified value, rather than taking its first arbitrary number.
const declared = text.match(new RegExp(
diff --git a/.github/scripts/issue-version-triage.test.cjs b/.github/scripts/issue-version-triage.test.cjs
index 28f2eb49d9..2d74fe9cea 100644
--- a/.github/scripts/issue-version-triage.test.cjs
+++ b/.github/scripts/issue-version-triage.test.cjs
@@ -4144,3 +4144,94 @@ test("loose-list version declarations inside secondary topics remain topic evide
assert.equal(triage.internals.extractPulseVersion("Unversioned report", body), "6.6.0");
assert.equal(triage.internals.classifyAdditionalActionableTopics(body), true);
});
+
+test("malformed version tokens cannot be shortened or salvaged into another release", () => {
+ for (const value of ["6.6.0.1", "v6.6.0.12", "6.6.0-", "V6.6.0-beta..3", "6.6.0-beta_3"]) {
+ assert.equal(triage.internals.normalizeVersion(value), null, value);
+ }
+});
+
+test("explicit malformed versions remain authoritative in all supported Markdown layouts", () => {
+ const { extractPulseVersion } = triage.internals;
+ for (const value of ["6.6.0.1", "6.6.0-", "6.6.0-beta..3", "6.6.0-beta_3"]) {
+ for (const body of [
+ `### Pulse version\n${value}\n\n### Agent version\n6.5.0`,
+ `**Pulse version:** ${value}\nAgent version: 6.5.0`,
+ `Pulse version\n${value}\nAgent version: 6.5.0`,
+ `- **Pulse version**: ${value}\n- Agent version: 6.5.0`,
+ `1. **Pulse version**: ${value}\n\n2. Agent version: 6.5.0`,
+ `### Pulse version\n\`\`\`text\n${value}\n\`\`\`\n### Agent version\n6.5.0`,
+ `### Pulse version\n[${value}][release]\n\n[release]: https://example.invalid/6.6.0`,
+ ]) {
+ assert.equal(extractPulseVersion("Pulse 6.4.5 update failed", body), null, body);
+ }
+ }
+});
+
+test("title fallback does not shorten a malformed server or neutral version token", () => {
+ const { extractPulseVersion } = triage.internals;
+ for (const value of ["6.6.0.1", "6.6.0-", "6.6.0-beta..3", "6.6.0-beta_3"]) {
+ for (const title of [
+ `Pulse ${value} loses readings`,
+ `Pulse Pro version: V${value} loses readings`,
+ `rcourtman/pulse:${value} loses readings`,
+ `[Bug]: v${value} loses readings`,
+ `Bug on v${value}`,
+ ]) {
+ assert.equal(extractPulseVersion(title, "Legacy report."), null, title);
+ assert.equal(extractPulseVersion(title, "### Pulse version\n6.5.0"), "6.5.0", title);
+ }
+ }
+});
+
+test("complete stable and prerelease tokens retain their full value and ordinary punctuation", () => {
+ const { extractPulseVersion, normalizeVersion } = triage.internals;
+ for (const version of ["6.6.0", "6.7.0-beta.3", "6.6.0-RC.6", "6.7.0-alpha-2.3", "6.7.0-alpha-"]) {
+ for (const suffix of ["", ".", "...", ", still failing", " (Docker)", "; agent 6.5.0"]) {
+ const value = `V${version}${suffix}`;
+ assert.equal(normalizeVersion(value), version, value);
+ assert.equal(extractPulseVersion("Upgrade from 6.4.5", `### Pulse version\n${value}`), version, value);
+ assert.equal(extractPulseVersion(`Pulse ${value}`, "Legacy report."), version, value);
+ }
+ }
+});
+
+test("malformed attempted archives cannot borrow a valid dotted fragment", () => {
+ for (const stem of ["pulse", "pulse-pro"]) {
+ for (const value of ["6.6.0.1", "6.6.0-beta..3"]) {
+ const archive = `${stem}-v${value}-linux-amd64.tar.gz`;
+ assert.equal(triage.internals.extractPulseVersion("Pulse 6.4.5 install failed",
+ `### Pulse version\n\`${archive}\``), null, archive);
+ }
+ }
+});
+
+for (const action of ["opened", "edited", "reopened"]) {
+ test(`${action} malformed-version metadata preserves Community decisions and accepts a later correction`, async () => {
+ for (const value of ["6.6.0.1", "6.6.0-", "6.6.0-beta..3", "6.6.0-beta_3"]) {
+ const preserved = ["bug", "needs-retest-on-latest", "needs-decomposition", "operator-reviewed", "affects-storage"];
+ const issue = { number: 42, state: "open", title: "Pulse 6.4.5 update failed",
+ body: `### Pulse version\n${value}\n\n### Additional actionable topics\nKeep failed attempts visible.`,
+ updated_at: "2026-10-29T03:40:00Z", comments: 1,
+ labels: [...preserved, "affects-6.5.0"].map(name => ({ name })) };
+ const { github, calls } = createGithub({ currentIssue: issue });
+ const context = { repo: { owner: "fixture", repo: "fixture" }, payload: { action, issue } };
+ await triage.syncLabels({ github, context, core: { info() {} } });
+ assert.deepEqual(calls.addLabels.map(call => call.labels), [["needs-version-info"]], value);
+ assert.deepEqual(calls.removeLabel.map(call => call.name), ["affects-6.5.0"], value);
+ assert.deepEqual(github.currentIssue.labels.map(label => label.name).sort(),
+ [...preserved, "needs-version-info"].sort(), value);
+ assert.deepEqual(calls.createLabel.map(call => call.name), ["needs-version-info"], value);
+
+ github.currentIssue = { ...github.currentIssue, body: issue.body.replace(value, "6.7.0-beta.3"),
+ updated_at: "2026-10-29T03:41:00Z" };
+ await triage.syncLabels({ github, context: { ...context, payload: { action: "edited", issue: github.currentIssue } },
+ core: { info() {} } });
+ assert.deepEqual(github.currentIssue.labels.map(label => label.name).sort(),
+ [...preserved, "affects-6.7.0-beta.3"].sort(), value);
+ assert.equal(calls.getLatestRelease.length, 0);
+ assert.equal(calls.createComment.length, 0);
+ assert.equal(calls.getEvents.length, 0);
+ }
+ });
+}