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.

Keep secondary issue topics out of primary metadata

pulse-triage[bot]6fbf04bd8a1d
diff --git a/.github/scripts/issue-version-triage.cjs b/.github/scripts/issue-version-triage.cjs
index 0f50b7d5d5..2296802dfc 100644
--- a/.github/scripts/issue-version-triage.cjs
+++ b/.github/scripts/issue-version-triage.cjs
@@ -6,6 +6,39 @@ const BUG_LABEL = "bug";
const DOCS_LABEL = "documentation";
const ENHANCEMENT_LABEL = "enhancement";
+// These headings end a secondary-topic field at its own level or above.
+// Deeper headings and legacy field-looking prose remain that topic's evidence,
+// not a second source of primary version or feedback metadata.
+const FORM_FIELD_NAMES = [
+ "Additional actionable topics",
+ "Describe the bug",
+ "Steps or original sequence",
+ "Expected behavior",
+ "Feedback type",
+ "Pulse version",
+ "Last known working Pulse version",
+ "Agent version",
+ "Image tag or digest",
+ "Running Pulse container image tag or digest",
+ "Install path",
+ "Installation type",
+ "OS / environment",
+ "Installer or helper source",
+ "Upgrade attempt and recovery",
+ "License tier",
+ "What happened?",
+ "Steps or original sequence / usage context",
+ "What did you expect instead?",
+ "Additional context",
+ "Logs, screenshots, or diagnostics",
+ "Confirmations",
+ "Problem",
+ "Current workflow",
+ "Desired outcome",
+ "Alternatives considered",
+];
+const FORM_FIELD_KEYS = new Set(FORM_FIELD_NAMES.map((name) => name.toLowerCase()));
+
function escapeRegExp(value) {
return String(value || "").replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
@@ -114,6 +147,21 @@ function projectDeclarationLines(tokens) {
append(token.raw || "");
}
}
+ let topicDepth = null;
+ for (const line of lines) {
+ if (topicDepth !== null && line.heading !== null &&
+ line.headingDepth <= topicDepth && FORM_FIELD_KEYS.has(line.heading.toLowerCase())) {
+ topicDepth = null;
+ }
+ if (topicDepth !== null) {
+ // All classifiers consume this same scope decision. Keep visible text
+ // intact for decomposition; mask only its ability to declare metadata.
+ line.declaration = false;
+ line.heading = null;
+ } else if (line.heading?.toLowerCase() === "additional actionable topics") {
+ topicDepth = line.headingDepth;
+ }
+ }
return lines;
}
@@ -155,33 +203,7 @@ function additionalActionableTopicDeclarations(body, report = parseReportMarkdow
// Edited reports can move this field beside any other form field. Context
// from those fields must not invent a topic or reopen a completed review.
// Deeper subheadings still belong to the topic, even with a familiar name.
- const values = extractSectionValues(body, "Additional actionable topics", [
- "Describe the bug",
- "Steps or original sequence",
- "Expected behavior",
- "Feedback type",
- "Pulse version",
- "Last known working Pulse version",
- "Agent version",
- "Image tag or digest",
- "Running Pulse container image tag or digest",
- "Install path",
- "Installation type",
- "OS / environment",
- "Installer or helper source",
- "Upgrade attempt and recovery",
- "License tier",
- "What happened?",
- "Steps or original sequence / usage context",
- "What did you expect instead?",
- "Additional context",
- "Logs, screenshots, or diagnostics",
- "Confirmations",
- "Problem",
- "Current workflow",
- "Desired outcome",
- "Alternatives considered",
- ], report);
+ const values = extractSectionValues(body, "Additional actionable topics", FORM_FIELD_NAMES, report);
if (!values.length) return null;
// A reporter may append a second field rather than replace the first.
// Assess each independently: neither an earlier None nor a later empty
diff --git a/.github/scripts/issue-version-triage.test.cjs b/.github/scripts/issue-version-triage.test.cjs
index 75e166b73e..88729cdbc1 100644
--- a/.github/scripts/issue-version-triage.test.cjs
+++ b/.github/scripts/issue-version-triage.test.cjs
@@ -1161,6 +1161,91 @@ test("a form-named topic subheading remains actionable inside the declaration",
}
});
+test("secondary-topic subheadings cannot override primary version or feedback fields", () => {
+ const { extractPulseVersion, classifyV6FeedbackType, classifyAdditionalActionableTopics } = triage.internals;
+ for (const newline of ["\n", "\r\n"]) {
+ for (const level of [1, 2, 3, 4, 5]) {
+ for (const label of [name => name, name => `**[${name}][field]**`]) {
+ const heading = (depth, name) => `${"#".repeat(depth)} ${label(name)}`;
+ const body = [
+ heading(level, "Additional actionable topics"), "Retain the earlier export context too.",
+ heading(level + 1, "Pulse version"), "6.4.5",
+ heading(level + 1, "Feedback type"), "Bug / regression",
+ heading(level, "Feedback type"), "Documentation issue",
+ heading(level, "Pulse version"), "6.6.0", "",
+ "[field]: https://example.invalid/other-version",
+ ].join(newline);
+ assert.equal(extractPulseVersion("Current report", body), "6.6.0", body);
+ assert.equal(classifyV6FeedbackType(body), "documentation", body);
+ assert.equal(classifyAdditionalActionableTopics(body), true, body);
+ }
+ }
+ }
+});
+
+test("legacy declarations inside secondary topics stay evidence, not primary metadata", () => {
+ const { extractPulseVersion, classifyV6FeedbackType, classifyAdditionalActionableTopics } = triage.internals;
+ for (const copied of ["Pulse version: 6.4.5", "**Pulse Version:** `6.4.5`",
+ "- **Pulse version**: 6.4.5", "#### Pulse version\n6.4.5"]) {
+ const body = ["### Additional actionable topics", copied,
+ "Retain this earlier version in the export too.", "#### Feedback type", "Bug / regression"].join("\n");
+ assert.equal(extractPulseVersion("Current report", body), null, copied);
+ assert.equal(extractPulseVersion("Pulse 6.6.0", body), "6.6.0", copied);
+ assert.equal(classifyV6FeedbackType(body), null, copied);
+ assert.equal(classifyAdditionalActionableTopics(body), true, copied);
+ assert.equal(extractPulseVersion("Pulse 6.6.0",
+ `${body}\n### Pulse version\nunknown`), null, copied);
+ }
+});
+
+test("secondary-topic scope lasts through custom headings and ends at a real form boundary", () => {
+ const { extractPulseVersion, classifyAdditionalActionableTopics } = triage.internals;
+ const body = ["### Additional actionable topics", "None", "### Separate export problem",
+ "Pulse version: 6.4.5", "### Additional context", "Pulse version: 6.6.0"].join("\n");
+ assert.equal(extractPulseVersion("Current report", body), "6.6.0");
+ assert.equal(classifyAdditionalActionableTopics(body), true);
+ // A later genuine topic still belongs to the review; a nested copy must not
+ // consume the peer boundary or prevent a subsequent version correction.
+ const repeated = ["### Additional actionable topics", "None",
+ "#### Additional actionable topics", "Pulse version: 6.4.5",
+ "### Additional actionable topics", "Another recovery problem.",
+ "### Pulse version", "6.6.0"].join("\n");
+ assert.equal(extractPulseVersion("Current report", repeated), "6.6.0");
+ assert.equal(classifyAdditionalActionableTopics(repeated), true);
+});
+
+for (const action of ["opened", "edited", "reopened"]) {
+ for (const [name, primaryLabels, primaryFields, topicFields, additions, removals] of [
+ ["real primary version", ["bug"], "### Pulse version\n6.6.0",
+ "#### Pulse version\n6.4.5", ["affects-6.6.0"], ["affects-6.4.5"]],
+ ["missing primary version", ["bug"], "### Additional context\nExisting context.",
+ "Pulse version: 6.4.5", ["needs-version-info"], ["affects-6.4.5"]],
+ ["real primary feedback", ["enhancement"], "### Feedback type\nDocumentation issue\n### Pulse version\nunknown",
+ "#### Feedback type\nBug / regression", ["documentation"], []],
+ ]) {
+ test(`${action} triage keeps secondary metadata scoped: ${name}`, async () => {
+ const preserved = [...primaryLabels, "needs-human", "release-blocker",
+ "needs-retest-on-latest", "operator-reviewed"];
+ const body = topic => `### Additional actionable topics\n${topic}\n\n${primaryFields}\n`;
+ const issue = { number: 2936, title: "Current report", comments: 0,
+ body: body(topicFields), labels: [...preserved, "affects-6.4.5"].map(name => ({ name })) };
+ const { github, calls } = createGithub();
+ await syncLabels({ github, core: createCore(), context: createContext({ action, issue,
+ previousBody: action === "edited" ? body("None") : undefined }) });
+ const expected = [...additions, ...(action === "reopened" ? [] : ["needs-decomposition"])].sort();
+ assert.deepEqual(calls.addLabels.map(call => call.labels), [expected]);
+ assert.deepEqual(calls.removeLabel.map(call => call.name), removals);
+ const final = github.currentIssue.labels.map(label => label.name).sort();
+ assert.deepEqual(final, [...preserved, ...expected,
+ ...(removals.length ? [] : ["affects-6.4.5"])].sort());
+ assert.deepEqual(calls.createComment, []);
+ assert.deepEqual(calls.getLatestRelease, []);
+ assert.deepEqual(calls.paginate, []);
+ assert.deepEqual(calls.getEvents, []);
+ });
+ }
+}
+
test("copied form-named headings cannot hide a later topic", () => {
const { classifyAdditionalActionableTopics } = triage.internals;
for (const copied of [