Preserve headed secondary issue topics

Stop the issue-form parser only at known subsequent form fields so reporter-authored Markdown subheadings do not suppress needs-decomposition. Reproduce the public #1875 body shape in the focused test.\n\nChange-source: pulse-maintainer
This commit is contained in:
pulse-triage[bot]
2026-09-04 04:13:04 +01:00
parent eba4993cb5
commit 1f3cc0fe37
2 changed files with 24 additions and 3 deletions
+11 -3
View File
@@ -17,10 +17,13 @@ function escapeRegExp(value) {
return String(value || "").replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
function extractSectionValue(body, heading) {
function extractSectionValue(body, heading, followingHeadings = []) {
if (!body) return null;
const boundary = followingHeadings.length
? followingHeadings.map(escapeRegExp).join("|")
: "[^\\n]+";
const pattern = new RegExp(
`^#+\\s*${escapeRegExp(heading)}\\s*$\\n+([\\s\\S]*?)(?=^#+\\s+|$)`,
`^#+\\s*${escapeRegExp(heading)}\\s*$\\n+([\\s\\S]*?)(?=^#+\\s*(?:${boundary})\\s*$|$)`,
"im"
);
const match = body.match(pattern);
@@ -40,7 +43,12 @@ function stripHTMLComments(value) {
}
function classifyAdditionalActionableTopics(body) {
const value = extractSectionValue(body, "Additional actionable topics");
const value = extractSectionValue(body, "Additional actionable topics", [
"Pulse version",
"Additional context",
"Logs, screenshots, or diagnostics",
"Confirmations",
]);
if (value === null) return null;
const normalized = stripHTMLComments(value)
@@ -199,6 +199,19 @@ test("additional topic classification is explicit and fail-quiet for legacy form
),
true
);
assert.equal(
classifyAdditionalActionableTopics(
[
"### Additional actionable topics",
"### 2. Proxmox VE Agent Install Command",
"The generated command should expose its security controls.",
"",
"### Pulse version",
"v6.4.1",
].join("\n")
),
true
);
});
test("every actionable issue form exposes the decomposition signal", () => {