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.

Remove redundant backtracking from feedback metadata parsing

pulse-triage[bot]da1711c0db64
diff --git a/.github/scripts/issue-version-triage.cjs b/.github/scripts/issue-version-triage.cjs
index 12900f1d56..ab70b4c6e5 100644
--- a/.github/scripts/issue-version-triage.cjs
+++ b/.github/scripts/issue-version-triage.cjs
@@ -410,9 +410,11 @@ function classifyFeedbackSelection(feedbackType, report) {
// Inspect the whole field, not just its first line. An edited selection can
// contain a conflicting choice or qualifying prose on a later line/block;
// neither field order nor layout makes the first option authoritative.
+ // The original declaration projection already omits hidden comment blocks.
+ // Do not scan comment delimiters again: unexpected HTML is not a choice,
+ // and a repeated-comment regular expression can backtrack exponentially.
const blocks = lexFieldValue(feedbackType, report).filter(token =>
- !["space", "def"].includes(token.type) &&
- !(token.type === "html" && /^(?:\s*<!--[\s\S]*?-->)+\s*$/.test(token.raw || "")));
+ !["space", "def"].includes(token.type));
if (blocks.length !== 1 || blocks[0].type !== "paragraph") return null;
const visible = inlineDeclarationText(blocks[0].tokens);
const normalized = visible.trim().toLowerCase().replace(/\s+/g, " ");
diff --git a/.github/scripts/issue-version-triage.test.cjs b/.github/scripts/issue-version-triage.test.cjs
index 13e7898008..0df893931f 100644
--- a/.github/scripts/issue-version-triage.test.cjs
+++ b/.github/scripts/issue-version-triage.test.cjs
@@ -584,6 +584,61 @@ for (const action of ["opened", "edited", "reopened"]) {
});
}
+test("comment-rich feedback keeps hidden hints separate from the complete visible choice", () => {
+ const comments = "<!-- hint -->".repeat(4000);
+ for (const newline of ["\n", "\r\n"]) {
+ for (const [selection, expected] of [
+ [`${comments}\n\nDocumentation issue`, "documentation"],
+ [`Bug / regression\n\n${comments}`, "bug"],
+ [`${comments}\n\nBug /\nregression`, "bug"],
+ [`Bug / regression\n\n${comments}\n\nDocumentation issue`, null],
+ [`Documentation issue\n\n${comments}\n\nThis is only a question.`, null],
+ [`${comments}\n\n\`<!-- literal -->\``, null],
+ ]) {
+ const body = `### Feedback type\n${selection}\n\n### Pulse version\nunknown`
+ .replaceAll("\n", newline);
+ assert.equal(triage.internals.classifyV6FeedbackType(body), expected);
+ }
+ }
+});
+
+test("repeated comment delimiters cannot become selected feedback or hide later visible choices", () => {
+ const delimiters = "<!--" + "--><!--".repeat(6000);
+ for (const newline of ["\n", "\r\n"]) {
+ for (const [selection, expected] of [
+ [delimiters + "unclosed hint", null],
+ [`Bug / regression\n\n${delimiters}unclosed hint`, "bug"],
+ [delimiters + "-->\n\nDocumentation issue", "documentation"],
+ [`Bug / regression\n\n${delimiters}-->\nDocumentation issue`, null],
+ ]) {
+ const body = `### Feedback type\n${selection}\n\n### Pulse version\nunknown`
+ .replaceAll("\n", newline);
+ assert.equal(triage.internals.classifyV6FeedbackType(body), expected);
+ }
+ }
+});
+
+test("comment-rich intake remains silent and preserves Community labels and topic review", async () => {
+ for (const [selection, addedClass] of [
+ ["Documentation issue", ["documentation"]],
+ ["Bug / regression\n\nDocumentation issue", []],
+ ]) {
+ const preserved = ["needs-human", "needs-retest-on-latest", "operator-reviewed"];
+ const issue = { number: 42, title: "Synthetic comment-rich feedback", state: "open", comments: 0,
+ updated_at: "2026-11-01T06:25:00Z", labels: preserved.map(name => ({ name })),
+ body: `### Feedback type\n${"<!-- hint -->".repeat(4000)}\n\n${selection}\n\n` +
+ "### Pulse version\nunknown\n\n### Additional actionable topics\nKeep the independent notification review." };
+ const { github, calls } = createGithub({ currentIssue: issue });
+ await syncLabels({ github, context: createContext({ issue }), core: createCore() });
+ assert.deepEqual(calls.addLabels.flatMap(call => call.labels), [...addedClass, "needs-decomposition"]);
+ assert.deepEqual(github.currentIssue.labels.map(label => label.name).sort(),
+ [...preserved, ...addedClass, "needs-decomposition"].sort());
+ assert.deepEqual(calls.removeLabel, []);
+ assert.deepEqual(calls.createComment, []);
+ assert.deepEqual(calls.getLatestRelease, []);
+ }
+});
+
test("repeated feedback declarations require one recognised metadata category", () => {
const { classifyV6FeedbackType } = triage.internals;
for (const newline of ["\n", "\r\n"]) {