Preserve secondary issue feedback

Contract-Neutral: issue-triage intake only; no product, deployment, or release contract change
Change-source: pulse-maintainer
This commit is contained in:
pulse-triage[bot]
2026-08-29 12:23:37 +01:00
parent b75a5aeec2
commit 6cb5d3046b
10 changed files with 287 additions and 35 deletions

View File

@@ -1,6 +1,7 @@
const VERSION_LABEL_PREFIX = "affects-";
const NEEDS_VERSION_LABEL = "needs-version-info";
const RETEST_LABEL = "needs-retest-on-latest";
const NEEDS_DECOMPOSITION_LABEL = "needs-decomposition";
const RETEST_COMMENT_MARKER = "<!-- issue-version-triage:v1 -->";
const CLOSE_COMMENT_MARKER = "<!-- issue-timeout-close:v1 -->";
const TRIAGE_FOOTER =
@@ -28,6 +29,28 @@ function extractSectionValue(body, heading) {
return value || null;
}
function classifyAdditionalActionableTopics(body) {
const value = extractSectionValue(body, "Additional actionable topics");
if (value === null) return null;
const normalized = value
.replace(/<!--([\s\S]*?)-->/g, "")
.trim()
.toLowerCase()
.replace(/[.!]+$/g, "");
if (!normalized) return false;
return !new Set([
"_no response_",
"n/a",
"na",
"no",
"none",
"none known",
"not applicable",
]).has(normalized);
}
function normalizeVersion(value) {
if (!value) return null;
const match = String(value).match(/\bv?(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)\b/i);
@@ -170,6 +193,14 @@ function buildTriageState(issue, core, latestVersion) {
nextLabels.add(v6FeedbackClass);
}
const hasAdditionalActionableTopics = classifyAdditionalActionableTopics(issue.body);
if (hasAdditionalActionableTopics === true) {
core.info("Issue declares additional actionable topics; decomposition is required.");
nextLabels.add(NEEDS_DECOMPOSITION_LABEL);
} else if (hasAdditionalActionableTopics === false) {
nextLabels.delete(NEEDS_DECOMPOSITION_LABEL);
}
const reportedVersion = extractPulseVersion(issue.title, issue.body);
core.info(`Reported Pulse version: ${reportedVersion || "not found"}`);
core.info(`Latest stable release: ${latestVersion || "unknown"}`);
@@ -179,6 +210,7 @@ function buildTriageState(issue, core, latestVersion) {
nextLabels,
reportedVersion,
v6FeedbackClass,
hasAdditionalActionableTopics,
isBugLike: nextLabels.has(BUG_LABEL),
comparison:
reportedVersion && latestVersion ? compareCore(reportedVersion, latestVersion) : null,
@@ -248,13 +280,27 @@ async function syncLabels({ github, context, core }) {
nextLabels,
reportedVersion,
v6FeedbackClass,
hasAdditionalActionableTopics,
isBugLike,
comparison,
} = buildTriageState(issue, core, latestVersion);
if (hasAdditionalActionableTopics === true) {
await ensureLabel(
github,
context,
NEEDS_DECOMPOSITION_LABEL,
"fbca04",
"Issue declares additional actionable topics that need linked dispositions"
);
}
if (!isBugLike) {
core.info("Issue is not bug-like after classification. Skipping version triage.");
if (v6FeedbackClass && !labelNames.has(v6FeedbackClass)) {
const labelsChanged =
labelNames.size !== nextLabels.size ||
[...labelNames].some((label) => !nextLabels.has(label));
if (labelsChanged) {
await github.rest.issues.setLabels({
owner: context.repo.owner,
repo: context.repo.repo,
@@ -433,6 +479,7 @@ module.exports = {
CLOSE_COMMENT_MARKER,
DOCS_LABEL,
ENHANCEMENT_LABEL,
NEEDS_DECOMPOSITION_LABEL,
NEEDS_VERSION_LABEL,
RETEST_COMMENT_MARKER,
RETEST_COMMENT_GRACE_MS,
@@ -444,6 +491,7 @@ module.exports = {
buildTimeoutCloseCommentBody,
buildTriageState,
canPostRetestComment,
classifyAdditionalActionableTopics,
classifyV6FeedbackType,
compareCore,
extractPulseVersion,

View File

@@ -1,5 +1,7 @@
const test = require("node:test");
const assert = require("node:assert/strict");
const fs = require("node:fs");
const path = require("node:path");
const triage = require("./issue-version-triage.cjs");
@@ -124,6 +126,92 @@ test("syncLabels only adds documentation classification for non-bug v6 feedback"
assert.deepEqual(calls.setLabels[0].labels, ["documentation"]);
});
test("syncLabels marks declared secondary topics for decomposition", async () => {
const { github, calls } = createGithub({ latestVersion: "6.4.1" });
const issue = {
number: 1796,
title: "Availability workflow feedback",
body: [
"## Problem",
"Machine availability is hard to scan.",
"",
"## Additional actionable topics",
"The triage bot should preserve secondary requests.",
].join("\n"),
labels: [{ name: "enhancement" }],
};
await triage.syncLabels({
github,
context: createContext({ issue }),
core: createCore(),
});
assert.deepEqual(calls.createLabel.map((call) => call.name), [
"needs-decomposition",
]);
assert.deepEqual(calls.setLabels[0].labels, [
"enhancement",
"needs-decomposition",
]);
});
test("syncLabels clears decomposition after every declared topic has a disposition", async () => {
const { github, calls } = createGithub({ latestVersion: "6.4.1" });
const issue = {
number: 1796,
title: "Availability workflow feedback",
body: "## Additional actionable topics\nNone.\n",
labels: [{ name: "enhancement" }, { name: "needs-decomposition" }],
};
await triage.syncLabels({
github,
context: createContext({ action: "edited", issue }),
core: createCore(),
});
assert.equal(calls.createLabel.length, 0);
assert.deepEqual(calls.setLabels[0].labels, ["enhancement"]);
});
test("additional topic classification is explicit and fail-quiet for legacy forms", () => {
const { classifyAdditionalActionableTopics } = triage.internals;
assert.equal(classifyAdditionalActionableTopics("## Problem\nOne thing\n"), null);
assert.equal(
classifyAdditionalActionableTopics("## Additional actionable topics\n_No response_\n"),
false
);
assert.equal(
classifyAdditionalActionableTopics("## Additional actionable topics\nNone known.\n"),
false
);
assert.equal(
classifyAdditionalActionableTopics(
"## Additional actionable topics\n- Add a storage filter\n- Reduce log noise\n"
),
true
);
});
test("every actionable issue form exposes the decomposition signal", () => {
const templateDir = path.resolve(__dirname, "../ISSUE_TEMPLATE");
for (const name of [
"bug_report.yml",
"feature_request.yml",
"v6_rc_feedback.yml",
]) {
const form = fs.readFileSync(path.join(templateDir, name), "utf8");
assert.match(form, /id: additional_topics/);
assert.match(form, /label: Additional actionable topics/);
assert.match(
form,
/id: additional_topics[\s\S]*?validations:\s*\n\s+required: true/
);
}
});
test("postRetestComment comments once for older non-maintainer bug reports", async () => {
const { github, calls } = createGithub({ latestVersion: "6.0.1" });
const issue = {