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.

Read the complete feedback selection before classifying an issue

pulse-triage[bot]adf41432add8
diff --git a/.github/scripts/issue-version-triage.cjs b/.github/scripts/issue-version-triage.cjs
index eda09fc352..95a860cb60 100644
--- a/.github/scripts/issue-version-triage.cjs
+++ b/.github/scripts/issue-version-triage.cjs
@@ -406,11 +406,15 @@ function classifyFeedbackSelection(feedbackType, report) {
// This is a single-choice field, not free-form evidence. A link's target
// or title must not turn documentation/workflow feedback into a bug, and
// prose, images or a withdrawn selection cannot supply a selected option.
- const selected = firstFieldValue(parseReportMarkdown(feedbackType).lines);
- const blocks = lexFieldValue(selected, report);
- const visible = blocks.length === 1 && blocks[0].type === "paragraph"
- ? inlineDeclarationText(blocks[0].tokens) : selected;
- const normalized = visible.trim().toLowerCase().replace(/[ \t]+/g, " ");
+ // 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.
+ const blocks = lexFieldValue(feedbackType, report).filter(token =>
+ !["space", "def"].includes(token.type) &&
+ !(token.type === "html" && /^(?:\s*<!--[\s\S]*?-->)+\s*$/.test(token.raw || "")));
+ if (blocks.length !== 1 || blocks[0].type !== "paragraph") return null;
+ const visible = inlineDeclarationText(blocks[0].tokens);
+ const normalized = visible.trim().toLowerCase().replace(/\s+/g, " ");
switch (normalized) {
case "bug":
case "regression":
diff --git a/.github/scripts/issue-version-triage.test.cjs b/.github/scripts/issue-version-triage.test.cjs
index af51558281..3563df5b06 100644
--- a/.github/scripts/issue-version-triage.test.cjs
+++ b/.github/scripts/issue-version-triage.test.cjs
@@ -491,6 +491,81 @@ test("examples, withdrawn selections and prose do not invent a feedback class",
}
});
+test("feedback classification examines the complete field instead of its first line", () => {
+ for (const newline of ["\n", "\r\n"]) {
+ for (const selection of [
+ "Bug / regression\nDocumentation issue",
+ "Documentation issue\nBug / regression",
+ "Bug / regression\nThis is a question, not a selected form option.",
+ "Documentation issue\n\nBug / regression",
+ "Bug / regression\n\n> Documentation issue",
+ "Bug / regression\n\n```text\nDocumentation issue\n```",
+ "Bug / regression\n\n![context](https://example.invalid/synthetic.png)",
+ "Bug / regression\n\n- Documentation issue",
+ ]) {
+ const body = `### Feedback type\n${selection}\n\n### Pulse version\nunknown`
+ .replaceAll("\n", newline);
+ assert.equal(triage.internals.classifyV6FeedbackType(body), null, selection);
+ }
+ }
+});
+
+test("a complete single choice retains wrapping, hidden comments and shared reference definitions", () => {
+ for (const newline of ["\n", "\r\n"]) {
+ for (const selection of [
+ "Bug /\nregression",
+ "**Bug /\nregression**",
+ "<!-- optional hint -->\n\nBug / regression\n\n<!-- another hint -->",
+ "Bug / <!-- optional\nhint --> regression",
+ "[Bug /\nregression][choice]",
+ ]) {
+ const body = `### Feedback type\n${selection}\n\n### Pulse version\nunknown\n\n` +
+ '[choice]: https://example.invalid/documentation "Documentation issue"';
+ assert.equal(triage.internals.classifyV6FeedbackType(body.replaceAll("\n", newline)), "bug", selection);
+ }
+ }
+});
+
+for (const action of ["opened", "edited", "reopened"]) {
+ test(`${action} ambiguous field content cannot invent labels or lose independent topic review`, async () => {
+ for (const alreadyBug of [false, true]) {
+ const preserved = ["needs-human", "release-blocker", "needs-retest-on-latest", "operator-reviewed", "affects-storage"];
+ if (alreadyBug) preserved.push("bug");
+ const issue = { number: 42, state: "open", title: "Synthetic feedback selection", comments: 0,
+ updated_at: "2026-11-01T05:30:00Z", labels: preserved.map(name => ({ name })),
+ body: "### Feedback type\nBug / regression\nDocumentation issue\n\n### Pulse version\n6.6.0\n\n" +
+ "### Additional actionable topics\nPreserve a separate notification job." };
+ const { github, calls } = createGithub({ currentIssue: issue });
+ const previousBody = issue.body.replace("Preserve a separate notification job.", "None");
+ await syncLabels({ github, context: createContext({ action, issue, previousBody }), core: createCore() });
+ const added = [
+ ...(alreadyBug ? ["affects-6.6.0"] : []),
+ ...(action === "reopened" ? [] : ["needs-decomposition"]),
+ ];
+ assert.deepEqual(github.currentIssue.labels.map(label => label.name).sort(),
+ [...preserved, ...added].sort());
+ assert.deepEqual(calls.addLabels.flatMap(call => call.labels), added);
+ assert.deepEqual(calls.removeLabel, []);
+ assert.deepEqual(calls.createComment, []);
+ assert.deepEqual(calls.getLatestRelease, []);
+ assert.deepEqual(calls.getEvents, []);
+
+ // A later unambiguous selection is processed normally, without a refile
+ // or a public question. Preserve any explicit Community bug decision.
+ github.currentIssue = { ...github.currentIssue,
+ body: issue.body.replace("Bug / regression\nDocumentation issue", "Documentation issue"),
+ updated_at: "2026-11-01T05:31:00Z" };
+ await syncLabels({ github,
+ context: createContext({ action: "edited", issue: github.currentIssue, previousBody: issue.body }),
+ core: createCore() });
+ assert.deepEqual(github.currentIssue.labels.map(label => label.name).sort(),
+ [...preserved, ...added, "documentation"].sort());
+ 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"]) {