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.

Preserve issue metadata after inline and quoted HTML literals

pulse-triage[bot]ad1fdcacdd3e
diff --git a/.github/scripts/issue-version-triage.cjs b/.github/scripts/issue-version-triage.cjs
index bd4d9539b3..edc0ebd406 100644
--- a/.github/scripts/issue-version-triage.cjs
+++ b/.github/scripts/issue-version-triage.cjs
@@ -80,8 +80,25 @@ function stripHTMLComments(value) {
fence = { character: marker[1][0], length: marker[1].length };
return text;
}
- if (/^(?: {4}|\t)/.test(text)) return text;
+ // A quoted log is not a top-level form declaration. Its literal
+ // comment opener must not hide the unquoted fields which follow it.
+ if (/^(?: {4}|\t| {0,3}>)/.test(text)) return text;
}
+ // Match complete, same-line code spans by exact backtick-run length.
+ // Looking up the next run avoids rescanning a long pasted line for each
+ // unmatched delimiter. Backticks inside a hidden comment cannot open a
+ // span: the scanner below skips the comment before considering them.
+ const codeEnds = new Map();
+ const nextRun = new Map();
+ const runs = [...text.matchAll(/`+/g)];
+ for (let i = runs.length - 1; i >= 0; i -= 1) {
+ const run = runs[i];
+ if (nextRun.has(run[0].length)) {
+ codeEnds.set(run.index, nextRun.get(run[0].length));
+ }
+ nextRun.set(run[0].length, run.index + run[0].length);
+ }
+ const token = /<!--|`+/g;
let visible = "";
let offset = 0;
while (offset < text.length) {
@@ -91,11 +108,24 @@ function stripHTMLComments(value) {
offset = end + 3;
inComment = false;
} else {
- const start = text.indexOf("<!--", offset);
- if (start === -1) return visible + text.slice(offset);
+ token.lastIndex = offset;
+ const next = token.exec(text);
+ if (!next) return visible + text.slice(offset);
+ const start = next.index;
visible += text.slice(offset, start);
- offset = start + 4;
- inComment = true;
+ let escapes = 0;
+ for (let i = start - 1; i >= 0 && text[i] === "\\"; i -= 1) escapes += 1;
+ const codeEnd = next[0][0] === "`" && escapes % 2 === 0 && codeEnds.get(start);
+ if (codeEnd) {
+ visible += text.slice(start, codeEnd);
+ offset = codeEnd;
+ } else if (next[0] === "<!--" && escapes % 2 === 0) {
+ offset = start + 4;
+ inComment = true;
+ } else {
+ visible += next[0];
+ offset = start + next[0].length;
+ }
}
}
return visible;
diff --git a/.github/scripts/issue-version-triage.test.cjs b/.github/scripts/issue-version-triage.test.cjs
index 4c1e40a2ad..9380c41249 100644
--- a/.github/scripts/issue-version-triage.test.cjs
+++ b/.github/scripts/issue-version-triage.test.cjs
@@ -415,6 +415,68 @@ test("pasted HTML keeps genuine topic values without turning copied headings int
assert.equal(triage.internals.extractPulseVersion("Upgrade from v6.4.5", body), "6.5.0");
});
+test("inline and quoted HTML literals cannot hide subsequent form declarations", () => {
+ const { extractPulseVersion, classifyV6FeedbackType, classifyAdditionalActionableTopics } = triage.internals;
+ for (const evidence of [
+ "The error includes `<!-- unfinished`.",
+ "The error includes ``a ` tick and <!-- unfinished``.",
+ "The error includes `<!-- first` and ``<!-- second``.",
+ "> ```html\n> <!-- unfinished\n> ### Pulse version\n> 6.4.1\n> ```",
+ " > The response includes <!-- unfinished",
+ "The literal is \\<!-- unfinished.",
+ ]) {
+ for (const newline of ["\n", "\r\n"]) {
+ const body = ["### Existing evidence", evidence, "", "### Pulse version", "6.5.0",
+ "### Feedback type", "Documentation issue", "### Additional actionable topics",
+ "Storage History remains empty."].join("\n").replaceAll("\n", newline);
+ assert.equal(extractPulseVersion("Upgrade from v6.4.5", body), "6.5.0", body);
+ assert.equal(classifyV6FeedbackType(body), "documentation", body);
+ assert.equal(classifyAdditionalActionableTopics(body), true, body);
+ }
+ }
+});
+
+test("actual hidden comments stay hidden beside inline and quoted evidence", () => {
+ const { extractPulseVersion, classifyV6FeedbackType, classifyAdditionalActionableTopics } = triage.internals;
+ for (const evidence of [
+ "A literal `<!-- unfinished` followed by <!--",
+ "A mismatched `<!-- opener`` remains an actual comment",
+ "An escaped \\` backtick does not protect <!-- unfinished`",
+ "An even escape \\\\<!-- still opens a comment",
+ "<!-- a hidden ` backtick is not an opener --> <!-- second hidden`",
+ ]) {
+ const body = [evidence, "> quoted text", "```", "### Pulse version", "6.4.1",
+ "### Feedback type", "Bug / regression", "### Additional actionable topics", "Hidden topic",
+ "-->", "### Pulse version", "unknown", "### Feedback type", "Documentation issue",
+ "### Additional actionable topics", "None"].join("\n");
+ assert.equal(extractPulseVersion("Upgrade from v6.4.5", body), null, body);
+ assert.equal(classifyV6FeedbackType(body), "documentation", body);
+ assert.equal(classifyAdditionalActionableTopics(body), false, body);
+ const unfinished = body.replace("-->\n### Pulse version\nunknown", "\n### Pulse version\nunknown");
+ assert.equal(extractPulseVersion("Bug", unfinished), null, unfinished);
+ assert.equal(classifyV6FeedbackType(unfinished), null, unfinished);
+ assert.equal(classifyAdditionalActionableTopics(unfinished), null, unfinished);
+ }
+});
+
+test("syncLabels preserves visible fields after inline HTML without new contact", async () => {
+ for (const evidence of ["Error: `<!-- unfinished`", "> <!-- unfinished response"]) {
+ const { github, calls } = createGithub();
+ const issue = { number: 2808, title: "Upgrade from v6.4.5",
+ body: ["### Existing evidence", evidence, "", "### Pulse version", "6.5.0",
+ "### Feedback type", "Bug / regression", "### Additional actionable topics", "Missing History"].join("\n"),
+ labels: ["needs-human", "needs-retest-on-latest", "operator-reviewed", "needs-version-info"]
+ .map(name => ({ name })) };
+ await syncLabels({ github, core: createCore(), context: createContext({ issue }) });
+ assert.deepEqual(calls.addLabels.flatMap(call => call.labels), ["affects-6.5.0", "bug", "needs-decomposition"]);
+ assert.deepEqual(calls.removeLabel.map(call => call.name), ["needs-version-info"]);
+ assert.deepEqual(calls.createComment, []);
+ assert.deepEqual(calls.getLatestRelease, []);
+ assert.deepEqual(calls.paginate, []);
+ assert.deepEqual(calls.getIssue.map(call => call.issue_number), [2808]);
+ }
+});
+
test("syncLabels consumes real fields after pasted HTML without contact or state changes", async () => {
const { github, calls } = createGithub();
const issue = { number: 2801, title: "Upgrade from v6.4.5",
diff --git a/docs/ISSUE_TRIAGE.md b/docs/ISSUE_TRIAGE.md
index 7d283f87fe..6b4b22b18c 100644
--- a/docs/ISSUE_TRIAGE.md
+++ b/docs/ISSUE_TRIAGE.md
@@ -233,6 +233,11 @@ cannot supply a field or feedback type, and the next form field's contents are
not secondary topics. These labels surface review work; they do not establish
that a defect is reproduced or a request will be built.
+Quoted logs and literal HTML markers inside a complete same-line backtick span
+or after a Markdown escape cannot hide subsequent unquoted form fields. Actual
+hidden comments still cannot declare metadata, even when they contain backticks,
+quotes or apparent code fences; an unfinished hidden comment remains hidden.
+
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