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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Keep pasted code separate from issue metadata declarations
pulse-triage[bot]765b877717bb
diff --git a/.github/scripts/issue-version-triage.cjs b/.github/scripts/issue-version-triage.cjsindex 6ae9b2d546..4eee3e6027 100644--- a/.github/scripts/issue-version-triage.cjs+++ b/.github/scripts/issue-version-triage.cjs@@ -10,24 +10,48 @@ function escapeRegExp(value) {return String(value || "").replace(/[.*+?^${}()|[\]\\]/g, "\\$&");}+function declarationLines(body) {+ let fence = null;+ return stripHTMLComments(body).split(/\r?\n/).map((text) => {+ const marker = text.match(/^ {0,3}(`{3,}|~{3,})(.*)$/);+ let delimiter = false;+ const inCode = fence !== null;+ if (fence) {+ if (marker && marker[1][0] === fence.character &&+ marker[1].length >= fence.length && !marker[2].trim()) {+ fence = null;+ delimiter = true;+ }+ } else if (marker && (marker[1][0] === "~" || !marker[2].includes("`"))) {+ fence = { character: marker[1][0], length: marker[1].length };+ delimiter = true;+ }+ // Pasted examples and logs are evidence, not issue-form structure. Keep+ // their text as a value under a real field, but never scan it for fields.+ return { text, delimiter, declaration: !inCode && !delimiter &&+ !/^(?: {4}|\t)/.test(text) };+ });+}++function firstFieldValue(lines) {+ const value = lines.find((line) => !line.delimiter && line.text.trim());+ return value ? value.text.trim() : "";+}+function extractSectionValue(body, heading, followingHeadings = []) {if (!body) return null;- // Hidden template instructions are not declarations. Strip them before- // locating the section as well as before interpreting its value.- const visibleBody = stripHTMLComments(body);- const boundary = followingHeadings.length- ? followingHeadings.map(escapeRegExp).join("|")- : "[^\\n]+";- const pattern = new RegExp(- // With the multiline flag, $ also matches the end of the first value- // line. Only the next field or the actual end of input ends a section.- `^#+\\s*${escapeRegExp(heading)}\\s*$\\n+([\\s\\S]*?)(?=^#+\\s*(?:${boundary})\\s*$|(?![\\s\\S]))`,- "im"- );- const match = visibleBody.match(pattern);- if (!match) return null;+ const lines = declarationLines(body);+ const pattern = new RegExp(`^#+[ \\t]*${escapeRegExp(heading)}[ \\t]*$`, "i");+ const start = lines.findIndex((line) => line.declaration && pattern.test(line.text));+ if (start === -1) return null;+ const boundary = new RegExp(`^#+[ \\t]*(?:${followingHeadings.length+ ? followingHeadings.map(escapeRegExp).join("|") : "[^\\n]+"})[ \\t]*$`, "i");+ let end = start + 1;+ while (end < lines.length && !(lines[end].declaration && boundary.test(lines[end].text))) {+ end += 1;+ }// An empty declared field differs from a legacy report with no field.- return match[1].trim();+ return lines.slice(start + 1, end).map((line) => line.text).join("\n").trim();}function stripHTMLComments(value) {@@ -76,30 +100,25 @@ function normalizeLegacyVersionValue(value) {const visible = String(value).trim().replace(/^[`*_]+/, "");// Keep an explicitly shared server/agent version (as in #1788), without// mining a sentence such as "unknown; agent version 6.5.0" for a number.- return /^(?:v?\d+\.\d+\.\d+\b|server(?:[ \t]*\+[ \t]*pulse-agent)?[ \t]+v?\d+\.\d+\.\d+\b|(?:[a-z0-9._/-]+\/)?pulse:|pulse[-_])/i.test(visible)+ return /^(?:v?\d+\.\d+\.\d+\b|(?:pulse|server(?:[ \t]*\+[ \t]*pulse-agent)?)[ \t]+v?\d+\.\d+\.\d+\b|(?:[a-z0-9._/-]+\/)?pulse:|pulse[-_])/i.test(visible)? normalizeVersion(visible) : null;}function extractPulseVersion(title, body) {if (body) {- // Hidden template examples and headings are not reporter evidence.- const lines = stripHTMLComments(body).split(/\r?\n/);+ const lines = declarationLines(body);const versionHeading = lines.findIndex((line) =>- /^#{1,6}[ \t]+Pulse[ \t]+version[ \t]*$/i.test(line)+ line.declaration && /^#{1,6}[ \t]+Pulse[ \t]+version[ \t]*$/i.test(line.text));if (versionHeading !== -1) {// The explicit running-version field is authoritative, even when it is// incomplete. A title may name the old image in an upgrade report, and// neighbouring fields may contain an unrelated agent version.- const value = [];- for (let i = versionHeading + 1; i < lines.length; i += 1) {- if (/^#{1,6}[ \t]+/.test(lines[i])) break;- value.push(lines[i]);- }- return normalizeVersion(value.join("\n"));+ return normalizeLegacyVersionValue(firstFieldValue(lines.slice(versionHeading + 1)));}for (let i = 0; i < lines.length; i += 1) {- const line = lines[i].replace(/\*\*|__/g, "")+ if (!lines[i].declaration) continue;+ const line = lines[i].text.replace(/\*\*|__/g, "").replace(/^[ \t]*(?:#{1,6}[ \t]+|[-*][ \t]+)/, "").trim();const field = line.match(/^Pulse[ \t]*(?:[|-][ \t]*)?version(?:[ \t]*[:|][ \t]*|[ \t]+|$)(.*)$/i@@ -111,14 +130,9 @@ function extractPulseVersion(title, body) {// an upgrade's starting version from the title.const inlineValue = field[1].trim();if (inlineValue) return normalizeLegacyVersionValue(inlineValue);- for (let j = i + 1; j < lines.length; j += 1) {- const value = lines[j].trim();- if (!value || /^(?:```|~~~)[\w-]*$/.test(value)) continue;- // Accept a version or image reference as the first visible value,- // not a neighbouring heading, named field, log or prose paragraph.- return normalizeLegacyVersionValue(value);- }- return null;+ // A declared value may itself be fenced; that does not turn headings+ // elsewhere in a fenced log into declarations.+ return normalizeLegacyVersionValue(firstFieldValue(lines.slice(i + 1)));}}@@ -129,7 +143,8 @@ function classifyV6FeedbackType(body) {const feedbackType = extractSectionValue(body, "Feedback type");if (!feedbackType) return null;- const normalized = feedbackType.toLowerCase();+ // This is a single-choice field, not the later examples pasted beneath it.+ const normalized = firstFieldValue(declarationLines(feedbackType)).toLowerCase();if (normalized.includes("bug") ||normalized.includes("regression") ||diff --git a/.github/scripts/issue-version-triage.test.cjs b/.github/scripts/issue-version-triage.test.cjsindex ec648d3d5e..55cc809c50 100644--- a/.github/scripts/issue-version-triage.test.cjs+++ b/.github/scripts/issue-version-triage.test.cjs@@ -353,6 +353,125 @@ test("syncLabels ignores hidden bug examples and topic hints", async () => {assert.deepEqual(calls.paginate, []);});+test("fenced examples cannot declare issue metadata", () => {+ const { extractPulseVersion, classifyAdditionalActionableTopics, classifyV6FeedbackType } = triage.internals;+ for (const fence of ["```", "~~~~", " ````"]) {+ for (const newline of ["\n", "\r\n"]) {+ const body = ["### Existing evidence", `${fence}markdown`,+ "### Pulse version", "6.4.1", "### Feedback type", "Bug / regression",+ "### Additional actionable topics", "A copied example, not a new topic.",+ fence].join(newline);+ assert.equal(extractPulseVersion("No declared version", body), null, body);+ assert.equal(extractPulseVersion("Bug on v6.5.0", body), "6.5.0", body);+ assert.equal(classifyV6FeedbackType(body), null, body);+ assert.equal(classifyAdditionalActionableTopics(body), null, body);+ }+ }+});++test("only matching complete fences end pasted examples", () => {+ const { extractPulseVersion, classifyV6FeedbackType } = triage.internals;+ for (const { open, falseClose } of [+ { open: "````text", falseClose: "```" },+ { open: "```text", falseClose: "~~~" },+ { open: "~~~text", falseClose: "```" },+ { open: "```text", falseClose: "``` still part of the log" },+ { open: "```text", falseClose: "" },+ ]) {+ const body = [open, "Log text", falseClose, "### Pulse version", "6.4.1",+ "### Feedback type", "Regression"].join("\n");+ assert.equal(extractPulseVersion("Unknown", body), null, body);+ assert.equal(classifyV6FeedbackType(body), null, body);+ }+});++test("real declarations after fenced examples remain authoritative", () => {+ const { extractPulseVersion, classifyAdditionalActionableTopics, classifyV6FeedbackType } = triage.internals;+ for (const fence of ["```", "~~~"]) {+ const body = [fence, "Pulse version: 6.4.1", "### Pulse version", "6.4.1",+ "### Feedback type", "Regression", "### Additional actionable topics", "Copied topic", fence,+ "### Feedback type", "Documentation issue", "### Additional actionable topics", "None",+ "### Pulse version", "6.5.0"].join("\n");+ assert.equal(extractPulseVersion("Upgrade from v6.4.5", body), "6.5.0", body);+ assert.equal(classifyV6FeedbackType(body), "documentation", body);+ assert.equal(classifyAdditionalActionableTopics(body), false, body);+ }+});++test("indented log fields cannot declare a legacy version", () => {+ for (const indent of [" ", "\t"]) {+ const body = `${indent}Pulse version: 6.4.1\n${indent}Agent version: 6.4.1\n`;+ assert.equal(triage.internals.extractPulseVersion("No declared version", body), null, body);+ assert.equal(triage.internals.extractPulseVersion("Bug on v6.5.0", body), "6.5.0", body);+ }+});++test("real version fields preserve fenced values without borrowing later evidence", () => {+ const { extractPulseVersion } = triage.internals;+ for (const field of ["### Pulse version", "Pulse | Version"]) {+ for (const fence of ["````", "~~~"]) {+ assert.equal(extractPulseVersion("Upgrade from v6.4.5", [field, `${fence}text`,+ "V6.5.0-rc.1", fence, "### Agent version", "6.4.5"].join("\n")), "6.5.0-rc.1");+ assert.equal(extractPulseVersion("Upgrade from v6.4.5", [field, "unknown", `${fence}text`,+ "Agent version: 6.5.0", fence].join("\n")), null);+ assert.equal(extractPulseVersion("Upgrade from v6.4.5", [field, "6.4", `${fence}text`,+ "6.5.0", fence].join("\n")), null);+ }+ }+});++test("structured product-named versions remain declared evidence", () => {+ assert.equal(triage.internals.extractPulseVersion("Bug",+ "### Pulse version\nPulse v6.4.5-beta.1\n### Agent version\n6.4.5"), "6.4.5-beta.1");+ assert.equal(triage.internals.extractPulseVersion("Bug",+ "### Pulse version\nConfirmed on a modified main build around v6.4.5-rc.2\n"), null);+});++test("fenced headings do not truncate genuine secondary topics", () => {+ const body = ["### Additional actionable topics", "The generated command also needs review:",+ "```markdown", "### Pulse version", "A heading in the example, not a new field.", "```",+ "The command must preserve both mounts.", "### Pulse version", "6.5.0"].join("\n");+ assert.equal(triage.internals.classifyAdditionalActionableTopics(body), true);+});++test("feedback keeps its selected value separate from fenced examples", () => {+ const body = ["### Feedback type", "Documentation issue", "```text", "Regression example",+ "### Pulse version", "6.4.1", "```", "### Pulse version", "6.5.0"].join("\n");+ assert.equal(triage.internals.classifyV6FeedbackType(body), "documentation");+ assert.equal(triage.internals.extractPulseVersion("Bug", body), "6.5.0");+});++test("syncLabels cannot classify copied issue templates or disturb Community state", async () => {+ const { github, calls } = createGithub();+ const issue = { number: 2806, title: "Documentation wording",+ body: "```markdown\n### Feedback type\nBug / regression\n### Pulse version\n6.4.1\n" ++ "### Additional actionable topics\nCopied example\n```\n",+ labels: ["enhancement", "needs-retest-on-latest", "needs-human", "needs-decomposition"]+ .map(name => ({ name })) };+ await syncLabels({ github, core: createCore(), context: createContext({ issue }) });+ assert.deepEqual(calls.addLabels, []);+ assert.deepEqual(calls.removeLabel, []);+ assert.deepEqual(calls.createLabel, []);+ assert.deepEqual(calls.createComment, []);+ assert.deepEqual(calls.getLatestRelease, []);+ assert.deepEqual(calls.paginate, []);+ assert.deepEqual(calls.getIssue.map(call => call.issue_number), [2806]);+});++test("syncLabels keeps structured unknown separate from a quoted agent version", async () => {+ const { github, calls } = createGithub();+ const issue = { number: 2807, title: "Upgrade from v6.4.5",+ body: "### Pulse version\nunknown\n```text\nAgent version: 6.5.0\n```\n",+ labels: ["bug", "needs-retest-on-latest", "needs-decomposition", "operator-reviewed"]+ .map(name => ({ name })) };+ await syncLabels({ github, core: createCore(), context: createContext({ issue }) });+ assert.deepEqual(calls.addLabels.map(call => call.labels), [["needs-version-info"]]);+ assert.deepEqual(calls.createLabel.map(call => call.name), ["needs-version-info"]);+ assert.deepEqual(calls.removeLabel, []);+ assert.deepEqual(calls.createComment, []);+ assert.deepEqual(calls.getLatestRelease, []);+});+test("every actionable issue form exposes the decomposition signal", () => {const templateDir = path.resolve(__dirname, "../ISSUE_TEMPLATE");for (const name of [diff --git a/docs/ISSUE_TRIAGE.md b/docs/ISSUE_TRIAGE.mdindex b660a7c7ba..0c91f67197 100644--- a/docs/ISSUE_TRIAGE.md+++ b/docs/ISSUE_TRIAGE.md@@ -204,6 +204,12 @@ cannot supply a field or feedback type, and the next form field's contents arenot secondary topics. These labels surface review work; they do not establishthat a defect is reproduced or a request will be built.+Headings and inline fields inside backtick or tilde code blocks and indented+logs are evidence, not form declarations or field boundaries. A real field can+still contain a fenced version or topic; do not discard that evidence. Version+and single-choice feedback fields use their first visible value, so an explicit+unknown or incomplete version cannot borrow a later example's agent version.+Before changing metadata, the synchronizer reads the current issue body andlabels, rather than classifying a queued event's older report. A failed readstops the job without a stale-data fallback; closed issues and pull requests arediff --git a/frontend-modern/public/docs/ISSUE_TRIAGE.md b/frontend-modern/public/docs/ISSUE_TRIAGE.mdindex b660a7c7ba..0c91f67197 100644--- a/frontend-modern/public/docs/ISSUE_TRIAGE.md+++ b/frontend-modern/public/docs/ISSUE_TRIAGE.md@@ -204,6 +204,12 @@ cannot supply a field or feedback type, and the next form field's contents arenot secondary topics. These labels surface review work; they do not establishthat a defect is reproduced or a request will be built.+Headings and inline fields inside backtick or tilde code blocks and indented+logs are evidence, not form declarations or field boundaries. A real field can+still contain a fenced version or topic; do not discard that evidence. Version+and single-choice feedback fields use their first visible value, so an explicit+unknown or incomplete version cannot borrow a later example's agent version.+Before changing metadata, the synchronizer reads the current issue body andlabels, rather than classifying a queued event's older report. A failed readstops the job without a stale-data fallback; closed issues and pull requests are