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.

Respect visible legacy version labels in issue intake

pulse-triage[bot]4f593d29456d
diff --git a/.github/scripts/issue-version-triage.cjs b/.github/scripts/issue-version-triage.cjs
index e8a13b87b3..f6181d6939 100644
--- a/.github/scripts/issue-version-triage.cjs
+++ b/.github/scripts/issue-version-triage.cjs
@@ -34,7 +34,7 @@ function lexFieldValue(value, report) {
return fieldLexer.lex(value);
}
-function inlineProjection(tokens, maskCode = false) {
+function inlineProjection(tokens) {
return (tokens || []).map((token) => {
const raw = token.raw || "";
// Keep line positions when removing hidden comments. A comment inside a
@@ -42,13 +42,10 @@ function inlineProjection(tokens, maskCode = false) {
if (token.type === "html" && /^<!--/.test(raw)) {
return raw.replace(/[^\r\n]/g, "");
}
- if (maskCode && token.type === "codespan") {
- return raw.replace(/[^\r\n]/g, " ");
- }
if (token.tokens && typeof token.text === "string") {
const offset = raw.indexOf(token.text);
if (offset !== -1) {
- return raw.slice(0, offset) + inlineProjection(token.tokens, maskCode) +
+ return raw.slice(0, offset) + inlineProjection(token.tokens) +
raw.slice(offset + token.text.length);
}
}
@@ -79,7 +76,9 @@ function projectDeclarationLines(tokens) {
// literal code, images, struck-out text and raw HTML non-declarative.
heading: inlineDeclarationText(token.tokens, true).trim(), headingDepth: token.depth });
} else if (token.type === "paragraph") {
- append(inlineProjection(token.tokens), true, inlineProjection(token.tokens, true));
+ // Legacy field labels follow their visible emphasis/link text too.
+ // Keep code delimiters so literal field examples cannot declare one.
+ append(inlineProjection(token.tokens), true, inlineDeclarationText(token.tokens, true));
} else if (token.type === "code") {
// A real version field may have a fenced or indented value. Its contents
// remain a value, never new metadata or a section boundary.
@@ -91,7 +90,7 @@ function projectDeclarationLines(tokens) {
const first = item.tokens[0];
if (first && first.type === "text" && first.tokens) {
const text = inlineProjection(first.tokens);
- const metadata = inlineProjection(first.tokens, true);
+ const metadata = inlineDeclarationText(first.tokens, true);
append(text.split(/\r?\n/)[0], true, metadata.split(/\r?\n/)[0]);
append(text.split(/\r?\n/).slice(1).join("\n"));
for (const nested of item.tokens.slice(1)) append(nested.raw || "");
@@ -330,12 +329,7 @@ function extractPulseVersion(title, body, report = parseReportMarkdown(body)) {
// Legacy inline/standalone fields have the same authority as the form.
// Unknown or incomplete must not borrow an agent/platform version or
// an upgrade's starting version from the title.
- const visibleLine = (lines[i].heading ?? lines[i].text).replace(/\*\*|__/g, "")
- .replace(/^[ \t]*[-*][ \t]+/, "").trim();
- const visibleField = visibleLine.match(
- /^Pulse[ \t]*(?:[|-][ \t]*)?version(?:[ \t]*[:|][ \t]*|[ \t]+|$)(.*)$/i
- );
- const inlineValue = visibleField ? visibleField[1].trim() : "";
+ const inlineValue = field[1].trim();
if (inlineValue) return normalizeLegacyVersionValue(inlineValue, report);
// A declared value may itself be fenced; that does not turn headings
// elsewhere in a fenced log into declarations.
diff --git a/.github/scripts/issue-version-triage.test.cjs b/.github/scripts/issue-version-triage.test.cjs
index 052b87447d..d73a9542a2 100644
--- a/.github/scripts/issue-version-triage.test.cjs
+++ b/.github/scripts/issue-version-triage.test.cjs
@@ -2435,6 +2435,70 @@ test("formatted field headings retain visible declarations and field boundaries"
}
});
+test("legacy version labels use visible formatting without borrowing a title or agent version", () => {
+ for (const label of [
+ "_Pulse version_",
+ "***Pulse version***",
+ '[Pulse version](https://example.invalid/6.4.1 "Agent version")',
+ "**[Pulse version][field]**",
+ "[Pulse version][]",
+ "[Pulse version]",
+ ]) {
+ for (const [value, expected] of [["`6.6.0`", "6.6.0"], ["unknown", null], ["6.6", null]]) {
+ for (const field of [`${label}: ${value}`, `- ${label}: ${value}`, `${label}\n\n${value}`]) {
+ const body = `${field}\n\n### Agent version\n9.9.9\n\n` +
+ "[field]: https://example.invalid/6.4.1\n[Pulse version]: https://example.invalid/6.4.1";
+ for (const newline of ["\n", "\r\n"]) {
+ assert.equal(triage.internals.extractPulseVersion("[Bug]: 6.4.1 prior image",
+ body.replaceAll("\n", newline)), expected, body);
+ }
+ }
+ }
+ }
+});
+
+test("literal or withdrawn legacy labels remain evidence rather than version declarations", () => {
+ for (const label of [
+ "`Pulse version`",
+ "**`Pulse version`**",
+ "~~Pulse version~~",
+ "![Pulse version](https://example.invalid/ignored)",
+ '[Context](https://example.invalid/ignored "Pulse version")',
+ "<span>Pulse version</span>",
+ "<!-- Pulse version -->Context",
+ ]) {
+ for (const field of [`${label}: 6.6.0`, `- ${label}: 6.6.0`]) {
+ assert.equal(triage.internals.extractPulseVersion("Unversioned report", field), null, field);
+ }
+ }
+ const field = "[Pulse version](https://example.invalid/6.4.1): 6.6.0";
+ for (const body of ["> " + field, "```markdown\n" + field + "\n```", " " + field]) {
+ assert.equal(triage.internals.extractPulseVersion("Unversioned report", body), null, body);
+ }
+});
+
+test("the silent consumer respects linked legacy versions while preserving Community decisions", async () => {
+ for (const [value, additions, removals] of [
+ ["6.6.0", ["affects-6.6.0"], ["affects-6.4.1", "needs-version-info"]],
+ ["unknown", [], ["affects-6.4.1"]],
+ ]) {
+ const { github, calls } = createGithub();
+ const issue = { number: 42, title: "[Bug]: 6.4.1 prior image",
+ body: `- **[Pulse version][field]**: ${value}\n\n### Agent version\n9.9.9\n\n` +
+ "[field]: https://example.invalid/6.4.1",
+ labels: ["bug", "affects-6.4.1", "needs-version-info", "needs-human", "release-blocker",
+ "needs-decomposition", "needs-retest-on-latest"].map(name => ({ name })) };
+ await syncLabels({ github, context: createContext({ issue }), core: createCore() });
+ assert.deepEqual(calls.addLabels.map(call => call.labels), additions.length ? [additions] : []);
+ assert.deepEqual(calls.removeLabel.map(call => call.name), removals);
+ assert.deepEqual(calls.createComment, []);
+ assert.deepEqual(calls.getLatestRelease, []);
+ assert.deepEqual(calls.getEvents, []);
+ assert.deepEqual(calls.paginate, []);
+ assert.equal(calls.getIssue.length, 2);
+ }
+});
+
test("heading destinations, literal examples and withdrawn text cannot declare fields", () => {
for (const format of [
value => `\`${value}\``,
diff --git a/docs/ISSUE_TRIAGE.md b/docs/ISSUE_TRIAGE.md
index 2a17c2825c..91ca87d176 100644
--- a/docs/ISSUE_TRIAGE.md
+++ b/docs/ISSUE_TRIAGE.md
@@ -271,6 +271,10 @@ not proof that the full thread lacks the version; read existing evidence before
asking only for a consequential remaining distinction. No refile or new
diagnostics are required by version classification.
+Ordinary emphasis and a link's visible label do not change that field's meaning,
+including in a legacy list item. Link destinations and titles, literal code,
+images and withdrawn text cannot declare a field or supply its version.
+
This boundary is deliberate: preserving an explicit reporter declaration is
safe to automate, while deciding whether two observations are one root cause is
a product and technical judgment.