mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-10 02:25:56 +00:00
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:
@@ -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", () => {
|
||||
|
||||
Reference in New Issue
Block a user