mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-11-28 16:58:31 +01:00
Keep the existing access-failure and mid-write fences on the metadata this synchroniser still owns. Treat already classified unknown versions as no-ops and preserve independently established affected releases in the queued-event fixture. The first complete proof exposed nine obsolete removal/read-count expectations; retain that failed proof rather than treating it as a pass. Contract-Neutral: Community issue metadata tests only; no product subsystem contract changes. Change-source: pulse-maintainer
4629 lines
230 KiB
JavaScript
4629 lines
230 KiB
JavaScript
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");
|
|
|
|
// The form classifier owns missing-version metadata, not the affected versions
|
|
// established elsewhere in a thread. Expected states retain their original
|
|
// provider spelling; this helper is deliberately independent of the parser.
|
|
function withAffectedVersions(issue, labels) {
|
|
return [...new Set([...labels, ...(issue.labels || []).map(label => label.name)
|
|
.filter(name => /^affects-/i.test(name))])].sort();
|
|
}
|
|
|
|
// GitHub issue forms do not submit markdown-only guidance as report fields.
|
|
// Detailed, optional guidance belongs immediately before the input it helps;
|
|
// test that location rather than requiring every reader to see it expanded.
|
|
function fieldGuidance(form, id) {
|
|
const blocks = form.split(/(?=^ - type: )/m).slice(1);
|
|
const index = blocks.findIndex(block => block.includes(` id: ${id}\n`));
|
|
assert.ok(index >= 0, `missing input ${id}`);
|
|
const preceding = blocks[index - 1] || "";
|
|
return (preceding.startsWith(" - type: markdown\n") ? preceding : "") + blocks[index];
|
|
}
|
|
|
|
for (const [name, summary, evidence] of [
|
|
["bug_report.yml", "bug_description", "logs"],
|
|
["v6_rc_feedback.yml", "summary", "evidence"],
|
|
]) {
|
|
test(`specialist intake guidance stays optional and beside its input: ${name}`, () => {
|
|
const form = fs.readFileSync(path.resolve(__dirname, "../ISSUE_TEMPLATE", name), "utf8");
|
|
const blocks = form.split(/(?=^ - type: )/m).slice(1);
|
|
const disclosures = [];
|
|
for (const block of blocks) {
|
|
if (!block.includes("<details")) continue;
|
|
assert.ok(block.startsWith(" - type: markdown\n"), "details must not be input descriptions");
|
|
assert.doesNotMatch(block, /<details\s+[^>]*\bopen\b/);
|
|
const groups = [...block.matchAll(/<details>\s*<summary>([^<]+)<\/summary>([\s\S]*?)<\/details>/g)];
|
|
assert.equal(groups.length, (block.match(/<details/g) || []).length, "each disclosure must close");
|
|
for (const [, title, content] of groups) {
|
|
assert.ok(title.trim(), "keyboard focus needs a meaningful summary");
|
|
assert.ok(content.trim(), "a disclosure must retain its guidance");
|
|
disclosures.push(title);
|
|
}
|
|
}
|
|
assert.deepEqual(disclosures.sort(), [
|
|
"Failed upgrade: which attempt, stop and recovery?",
|
|
"Several hosts or clusters: preserve which names and IDs repeat",
|
|
"Notification delivery: Test versus ordinary alerts",
|
|
"Pulse CPU, memory or disk writes: comparable measurements",
|
|
"VM or LXC memory: guest versus hypervisor readings",
|
|
].sort());
|
|
for (const [id, titles] of [
|
|
["upgrade_context", ["Failed upgrade:"]],
|
|
[summary, ["Several hosts or clusters:"]],
|
|
[evidence, ["Notification delivery:", "Pulse CPU, memory or disk writes:", "VM or LXC memory:"]],
|
|
]) {
|
|
const guidance = fieldGuidance(form, id);
|
|
for (const title of titles) assert.ok(guidance.includes(`<summary>${title}`), `${id}: ${title}`);
|
|
}
|
|
// Collection and public-disclosure warnings are never hidden in a disclosure.
|
|
const introduction = blocks[0];
|
|
assert.doesNotMatch(introduction, /<details/);
|
|
assert.match(introduction, /do not run it during backups, freeze\/thaw or an unresponsive-host incident/);
|
|
assert.match(introduction, /Anything you attach here is public/);
|
|
const attachment = blocks.find(block => block.includes(` id: ${evidence}\n`));
|
|
assert.match(attachment, /Review files and screenshots locally/);
|
|
assert.doesNotMatch(attachment, /<details|For notification reports|For CPU, memory or disk-write reports/);
|
|
});
|
|
}
|
|
|
|
function createGithub({
|
|
latestVersion = "6.0.1",
|
|
existingLabels = new Set(),
|
|
existingComments = [],
|
|
issues = [],
|
|
currentIssue = null,
|
|
events = [],
|
|
} = {}) {
|
|
const calls = {
|
|
createComment: [],
|
|
createLabel: [],
|
|
getLabel: [],
|
|
getLatestRelease: [],
|
|
paginate: [],
|
|
addLabels: [],
|
|
removeLabel: [],
|
|
getIssue: [],
|
|
getEvents: [],
|
|
};
|
|
|
|
const github = {
|
|
currentIssue,
|
|
rest: {
|
|
issues: {
|
|
async get(payload) {
|
|
calls.getIssue.push(payload);
|
|
return { data: github.currentIssue };
|
|
},
|
|
async listEvents(payload) {
|
|
calls.getEvents.push(payload);
|
|
const start = (payload.page - 1) * payload.per_page;
|
|
return { data: events.slice(start, start + payload.per_page) };
|
|
},
|
|
async getLabel({ name }) {
|
|
calls.getLabel.push(name);
|
|
if (existingLabels.has(name)) {
|
|
return { data: { name } };
|
|
}
|
|
const error = new Error("Not Found");
|
|
error.status = 404;
|
|
throw error;
|
|
},
|
|
async createLabel(payload) {
|
|
calls.createLabel.push(payload);
|
|
existingLabels.add(payload.name);
|
|
return { data: payload };
|
|
},
|
|
async addLabels(payload) {
|
|
calls.addLabels.push(payload);
|
|
if (github.currentIssue) {
|
|
const labels = new Map((github.currentIssue.labels || [])
|
|
.map(label => [label.name.toLowerCase(), label]));
|
|
for (const name of payload.labels) {
|
|
if (!labels.has(name.toLowerCase())) labels.set(name.toLowerCase(), { name });
|
|
}
|
|
github.currentIssue = { ...github.currentIssue, labels: [...labels.values()] };
|
|
}
|
|
return { data: payload };
|
|
},
|
|
async removeLabel(payload) {
|
|
calls.removeLabel.push(payload);
|
|
if (github.currentIssue) {
|
|
github.currentIssue = { ...github.currentIssue,
|
|
labels: (github.currentIssue.labels || [])
|
|
.filter(label => label.name.toLowerCase() !== payload.name.toLowerCase()) };
|
|
}
|
|
return { data: payload };
|
|
},
|
|
async createComment(payload) {
|
|
calls.createComment.push(payload);
|
|
return { data: payload };
|
|
},
|
|
listForRepo: Symbol("listForRepo"),
|
|
listComments: Symbol("listComments"),
|
|
},
|
|
repos: {
|
|
async getLatestRelease() {
|
|
calls.getLatestRelease.push(true);
|
|
return { data: { tag_name: `v${latestVersion}` } };
|
|
},
|
|
},
|
|
},
|
|
async paginate(endpoint) {
|
|
calls.paginate.push(endpoint);
|
|
return endpoint === github.rest.issues.listForRepo ? issues : existingComments;
|
|
},
|
|
};
|
|
|
|
return { github, calls };
|
|
}
|
|
|
|
// Existing fixtures describe a current open report unless a test supplies a
|
|
// different live read. The production helper still makes the actual GET.
|
|
async function syncLabels(args) {
|
|
if (!args.github.currentIssue) {
|
|
args.github.currentIssue = { ...args.context.payload.issue, state: "open" };
|
|
}
|
|
return triage.syncLabels(args);
|
|
}
|
|
|
|
function createContext({ action = "opened", issue, previousBody }) {
|
|
return {
|
|
payload: {
|
|
action,
|
|
issue: { updated_at: "2026-10-08T10:00:00Z", ...issue },
|
|
...(previousBody === undefined ? {} : { changes: { body: { from: previousBody } } }),
|
|
},
|
|
repo: {
|
|
owner: "rcourtman",
|
|
repo: "Pulse",
|
|
},
|
|
};
|
|
}
|
|
|
|
function createCore() {
|
|
return {
|
|
info() {},
|
|
warning() {},
|
|
};
|
|
}
|
|
|
|
// The provider has one label per case-insensitive name. Use a real mutable
|
|
// namespace here: call-only fixtures cannot detect add-then-remove label loss.
|
|
function caseInsensitiveLabelFixture({ reported, labels, repositoryLabels = [] }) {
|
|
const repository = new Map([...labels, ...repositoryLabels].map(name => [name.toLowerCase(), name]));
|
|
const live = new Map(labels.map(name => [name.toLowerCase(), name]));
|
|
const issue = { number: 42, state: "open", title: "Synthetic intake case",
|
|
body: `### Pulse version\n${reported}\n`, updated_at: "2026-10-27T00:00:00Z", comments: 0 };
|
|
const read = () => ({ ...issue, labels: [...live.values()].map(name => ({ name })) });
|
|
const { github, calls } = createGithub();
|
|
github.rest.issues.get = async payload => {
|
|
calls.getIssue.push(payload);
|
|
return { data: read() };
|
|
};
|
|
github.rest.issues.getLabel = async ({ name }) => {
|
|
calls.getLabel.push(name);
|
|
const canonical = repository.get(name.toLowerCase());
|
|
if (!canonical) throw Object.assign(new Error("Not Found"), { status: 404 });
|
|
return { data: { name: canonical } };
|
|
};
|
|
github.rest.issues.createLabel = async payload => {
|
|
calls.createLabel.push(payload);
|
|
if (repository.has(payload.name.toLowerCase())) throw labelNameConflict();
|
|
repository.set(payload.name.toLowerCase(), payload.name);
|
|
return { data: payload };
|
|
};
|
|
github.rest.issues.addLabels = async payload => {
|
|
calls.addLabels.push(payload);
|
|
for (const name of payload.labels) {
|
|
const canonical = repository.get(name.toLowerCase());
|
|
assert.ok(canonical, "only a provider-confirmed label may be applied");
|
|
live.set(name.toLowerCase(), canonical);
|
|
}
|
|
};
|
|
github.rest.issues.removeLabel = async payload => {
|
|
calls.removeLabel.push(payload);
|
|
live.delete(payload.name.toLowerCase());
|
|
};
|
|
return { github, calls, read, initial: read(), names: () => [...live.values()].sort() };
|
|
}
|
|
|
|
for (const [existing, reported] of [
|
|
["affects-6.6.0-rc.1", "6.6.0-RC.1"],
|
|
["affects-6.6.0-RC.1", "6.6.0-rc.1"],
|
|
["AFFECTS-6.6.0-rc.1", "6.6.0-rc.1"],
|
|
]) {
|
|
test(`case-only version differences cannot remove the current label: ${existing}`, async () => {
|
|
const labels = ["bug", existing, "needs-retest-on-latest", "needs-decomposition",
|
|
"needs-human", "release-blocker", "operator-reviewed"];
|
|
const fixture = caseInsensitiveLabelFixture({ reported, labels });
|
|
await triage.syncLabels({ github: fixture.github,
|
|
context: createContext({ issue: fixture.read() }), core: createCore() });
|
|
assert.deepEqual(fixture.names(), withAffectedVersions(fixture.initial, [...labels].sort()));
|
|
assert.deepEqual(fixture.calls.addLabels, []);
|
|
assert.deepEqual(fixture.calls.removeLabel, []);
|
|
assert.deepEqual(fixture.calls.createLabel, []);
|
|
assert.deepEqual(fixture.calls.createComment, []);
|
|
assert.deepEqual(fixture.calls.getLatestRelease, []);
|
|
assert.deepEqual(fixture.calls.paginate, []);
|
|
});
|
|
}
|
|
|
|
test("a differently cased provider label is applied once and survives a second sync", async () => {
|
|
const labels = ["bug", "AFFECTS-6.5.0", "needs-version-info", "needs-retest-on-latest", "operator-reviewed"];
|
|
const fixture = caseInsensitiveLabelFixture({ reported: "6.6.0-rc.1", labels,
|
|
repositoryLabels: ["AFFECTS-6.6.0-RC.1"] });
|
|
for (let pass = 0; pass < 2; pass += 1) {
|
|
await triage.syncLabels({ github: fixture.github,
|
|
context: createContext({ issue: fixture.read() }), core: createCore() });
|
|
assert.deepEqual(fixture.names(), withAffectedVersions(fixture.initial, ["bug", "AFFECTS-6.6.0-RC.1", "needs-retest-on-latest", "operator-reviewed"].sort()));
|
|
assert.deepEqual(fixture.calls.addLabels.map(call => call.labels), [["affects-6.6.0-rc.1"]]);
|
|
assert.deepEqual(fixture.calls.removeLabel.map(call => call.name), ["needs-version-info"]);
|
|
assert.deepEqual(fixture.calls.createLabel, []);
|
|
assert.deepEqual(fixture.calls.createComment, []);
|
|
}
|
|
});
|
|
|
|
test("unknown versions preserve differently cased affected versions and Community labels", async () => {
|
|
const fixture = caseInsensitiveLabelFixture({ reported: "unknown",
|
|
labels: ["bug", "AFFECTS-6.5.0", "affects-6.6.0-RC.1", "affects-6.6", "affects-storage", "operator-reviewed"] });
|
|
await triage.syncLabels({ github: fixture.github,
|
|
context: createContext({ issue: fixture.read() }), core: createCore() });
|
|
assert.deepEqual(fixture.names(), withAffectedVersions(fixture.initial, ["bug", "needs-version-info", "affects-6.6", "affects-storage", "operator-reviewed"].sort()));
|
|
assert.deepEqual(fixture.calls.removeLabel.map(call => call.name), []);
|
|
assert.deepEqual(fixture.calls.createComment, []);
|
|
});
|
|
|
|
test("case-insensitive deltas keep the exact live-label rename fence", async () => {
|
|
const issue = { number: 42, state: "open", title: "Synthetic intake case",
|
|
body: "### Pulse version\n6.6.0-rc.1\n", labels: [{ name: "bug" }, { name: "affects-6.5.0" }] };
|
|
const { github, calls } = createGithub({ currentIssue: issue });
|
|
github.rest.issues.getLabel = async ({ name }) => {
|
|
github.currentIssue = { ...issue, labels: [{ name: "bug" }, { name: "AFFECTS-6.5.0" }] };
|
|
return { data: { name } };
|
|
};
|
|
await triage.syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
assert.equal(calls.getIssue.length, 2 + calls.removeLabel.length);
|
|
assert.deepEqual(calls.addLabels, []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
});
|
|
|
|
for (const bug of ["bug", "Bug", "BUG"]) {
|
|
test(`known-version classification respects provider identities: ${bug}`, async () => {
|
|
const preserved = [bug, "Needs-Human", "Release-Blocker", "Needs-Retest-On-Latest",
|
|
"Needs-Decomposition", "operator-reviewed", "bug-fixed", "needs-version-info-note"];
|
|
const fixture = caseInsensitiveLabelFixture({ reported: "6.6.0",
|
|
labels: [...preserved, "AFFECTS-6.5.0", "NEEDS-VERSION-INFO"],
|
|
repositoryLabels: ["AFFECTS-6.6.0"] });
|
|
for (let pass = 0; pass < 2; pass += 1) {
|
|
await triage.syncLabels({ github: fixture.github,
|
|
context: createContext({ issue: fixture.read() }), core: createCore() });
|
|
assert.deepEqual(fixture.names(), withAffectedVersions(fixture.initial, [...preserved, "AFFECTS-6.6.0"].sort()));
|
|
assert.deepEqual(fixture.calls.addLabels.map(call => call.labels), [["affects-6.6.0"]]);
|
|
assert.deepEqual(fixture.calls.removeLabel.map(call => call.name),
|
|
["NEEDS-VERSION-INFO"]);
|
|
assert.deepEqual(fixture.calls.createLabel, []);
|
|
assert.deepEqual(fixture.calls.createComment, []);
|
|
assert.deepEqual(fixture.calls.getLatestRelease, []);
|
|
assert.deepEqual(fixture.calls.paginate, []);
|
|
}
|
|
});
|
|
}
|
|
|
|
test("unknown-version classification recognises a renamed bug without duplicating missing-version metadata", async () => {
|
|
for (const existing of [false, true]) {
|
|
const preserved = ["Bug", "Needs-Human", "Needs-Retest-On-Latest", "operator-reviewed"];
|
|
const fixture = caseInsensitiveLabelFixture({ reported: "unknown",
|
|
labels: [...preserved, "AFFECTS-6.5.0", ...(existing ? ["Needs-Version-Info"] : [])] });
|
|
for (let pass = 0; pass < 2; pass += 1) {
|
|
await triage.syncLabels({ github: fixture.github,
|
|
context: createContext({ issue: fixture.read() }), core: createCore() });
|
|
assert.deepEqual(fixture.names(), withAffectedVersions(fixture.initial, [...preserved, existing ? "Needs-Version-Info" : "needs-version-info"].sort()));
|
|
assert.deepEqual(fixture.calls.addLabels.map(call => call.labels), existing ? [] : [["needs-version-info"]]);
|
|
assert.deepEqual(fixture.calls.removeLabel.map(call => call.name), []);
|
|
assert.deepEqual(fixture.calls.createComment, []);
|
|
}
|
|
}
|
|
});
|
|
|
|
test("nearby custom label names do not become machine classifications", async () => {
|
|
for (const custom of ["bug-fixed", "debug", "bug ", "documentation"]) {
|
|
const labels = [custom, "Needs-Version-Info", "Needs-Decomposition-Note", "Needs-Human", "AFFECTS-6.5.0"];
|
|
const fixture = caseInsensitiveLabelFixture({ reported: "6.6.0", labels });
|
|
await triage.syncLabels({ github: fixture.github,
|
|
context: createContext({ issue: fixture.read() }), core: createCore() });
|
|
assert.deepEqual(fixture.names(), withAffectedVersions(fixture.initial, [...labels].sort()));
|
|
assert.deepEqual(fixture.calls.addLabels, []);
|
|
assert.deepEqual(fixture.calls.removeLabel, []);
|
|
assert.deepEqual(fixture.calls.getLabel, []);
|
|
assert.deepEqual(fixture.calls.createComment, []);
|
|
}
|
|
});
|
|
|
|
test("a cleared mixed-case review stays cleared while independent version metadata advances", async () => {
|
|
for (const action of ["opened", "edited"]) {
|
|
for (const delayed of [false, true]) {
|
|
const body = "### Pulse version\n6.6.0\n### Additional actionable topics\nAlso retain failed attempts.\n";
|
|
const preserved = ["Bug", "Needs-Human", "Needs-Retest-On-Latest", "Release-Blocker"];
|
|
const eventIssue = { number: 42, state: "open", title: "Synthetic intake case", body,
|
|
updated_at: "2026-10-27T00:00:00Z", comments: 0,
|
|
labels: [...preserved, "Needs-Decomposition"].map(name => ({ name })) };
|
|
const { github, calls } = createGithub({ currentIssue: { ...eventIssue,
|
|
comments: delayed ? 1 : 0, labels: preserved.map(name => ({ name })) } });
|
|
const context = createContext({ action, issue: eventIssue });
|
|
if (action === "edited") context.payload.changes = { body: { from: body.replace("Also retain failed attempts.", "None") } };
|
|
await triage.syncLabels({ github, context, core: createCore() });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["affects-6.6.0"]]);
|
|
assert.deepEqual(calls.getLabel, ["affects-6.6.0"]);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.getEvents, [], "observed label removal already establishes the cleared review");
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.equal(calls.getIssue.length, 2 + calls.removeLabel.length, "independent metadata retains its exact live-state fence");
|
|
}
|
|
}
|
|
});
|
|
|
|
test("an existing mixed-case review needs no label preparation before independent metadata", async () => {
|
|
for (const review of ["Needs-Decomposition", "NEEDS-DECOMPOSITION"]) {
|
|
const issue = { number: 42, state: "open", title: "Synthetic intake case",
|
|
body: "### Pulse version\n6.6.0\n### Additional actionable topics\nAlso retain failed attempts.\n",
|
|
updated_at: "2026-10-27T00:00:00Z", comments: 0,
|
|
labels: ["Bug", review, "Needs-Human", "Needs-Retest-On-Latest"].map(name => ({ name })) };
|
|
const { github, calls } = createGithub({ currentIssue: issue });
|
|
const lookup = github.rest.issues.getLabel;
|
|
github.rest.issues.getLabel = async payload => {
|
|
assert.notEqual(payload.name, "needs-decomposition", "an existing task requires no provider preparation");
|
|
return lookup(payload);
|
|
};
|
|
await triage.syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["affects-6.6.0"]]);
|
|
assert.deepEqual(calls.getLabel, ["affects-6.6.0"]);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.getEvents, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.equal(calls.getIssue.length, 2 + calls.removeLabel.length);
|
|
}
|
|
});
|
|
|
|
test("classification identity does not weaken an intervening bug-label rename fence", async () => {
|
|
const issue = { number: 42, state: "open", title: "Synthetic intake case",
|
|
body: "### Pulse version\n6.6.0\n", labels: ["Bug", "Needs-Version-Info"].map(name => ({ name })) };
|
|
const { github, calls } = createGithub({ currentIssue: issue });
|
|
github.rest.issues.getLabel = async ({ name }) => {
|
|
github.currentIssue = { ...issue, labels: ["BUG", "Needs-Version-Info"].map(name => ({ name })) };
|
|
return { data: { name } };
|
|
};
|
|
await triage.syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
assert.equal(calls.getIssue.length, 2 + calls.removeLabel.length);
|
|
assert.deepEqual(calls.addLabels, []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
});
|
|
|
|
test("syncLabels classifies older bug reports without requesting a retest", async () => {
|
|
const { github, calls } = createGithub({ latestVersion: "6.0.1" });
|
|
const issue = {
|
|
number: 1402,
|
|
title: "Standalone hosts disappear after upgrade",
|
|
body: "## Feedback type\nBug / regression\n\n## Pulse version\n6.0.0-rc.1\n",
|
|
labels: [],
|
|
};
|
|
|
|
await syncLabels({
|
|
github,
|
|
context: createContext({ issue }),
|
|
core: createCore(),
|
|
});
|
|
|
|
assert.equal(calls.addLabels.length, 1);
|
|
assert.deepEqual(calls.addLabels[0].labels, [
|
|
"affects-6.0.0-rc.1",
|
|
"bug",
|
|
]);
|
|
});
|
|
|
|
test("syncLabels only adds documentation classification for non-bug v6 feedback", async () => {
|
|
const { github, calls } = createGithub({ latestVersion: "6.0.1" });
|
|
const issue = {
|
|
number: 1415,
|
|
title: "Docs path is wrong",
|
|
body: "## Feedback type\nDocumentation issue\n\n## Pulse version\n6.0.0-rc.1\n",
|
|
labels: [],
|
|
};
|
|
|
|
await syncLabels({
|
|
github,
|
|
context: createContext({ issue }),
|
|
core: createCore(),
|
|
});
|
|
|
|
assert.equal(calls.addLabels.length, 1);
|
|
assert.deepEqual(calls.addLabels[0].labels, ["documentation"]);
|
|
});
|
|
|
|
|
|
test("feedback classification follows visible selected text, not link destinations or titles", () => {
|
|
const { classifyV6FeedbackType } = triage.internals;
|
|
for (const newline of ["\n", "\r\n"]) {
|
|
for (const [selection, expected] of [
|
|
['[Documentation issue](https://example.invalid/bugs)', "documentation"],
|
|
['[Documentation issue](https://example.invalid/context "Bug / regression")', "documentation"],
|
|
['[**Documentation issue**](https://example.invalid/bugs "Performance issue")', "documentation"],
|
|
['[UX / workflow friction](https://example.invalid/bugs)', "enhancement"],
|
|
['[Other actionable feedback](https://example.invalid/regression)', "enhancement"],
|
|
['[Unknown](https://example.invalid/bugs "Performance issue")', null],
|
|
['Documentation issue [details](https://example.invalid/bugs)', null],
|
|
]) {
|
|
assert.equal(classifyV6FeedbackType([
|
|
"### Feedback type", selection, "", "### Pulse version", "unknown",
|
|
].join(newline)), expected, selection);
|
|
}
|
|
}
|
|
});
|
|
|
|
test("feedback classification accepts each form choice and legacy bug selections", () => {
|
|
const form = fs.readFileSync(path.resolve(__dirname, "../ISSUE_TEMPLATE/v6_rc_feedback.yml"), "utf8");
|
|
const field = form.split(" id: feedback_type\n")[1].split(" - type: ")[0];
|
|
const selections = [...field.matchAll(/^ - (.+)$/gm)].map(match => match[1]);
|
|
const expected = {
|
|
"Bug / regression": "bug",
|
|
"Upgrade / migration issue": "bug",
|
|
"UX / workflow friction": "enhancement",
|
|
"Performance issue": "bug",
|
|
"Documentation issue": "documentation",
|
|
"Other actionable feedback": "enhancement",
|
|
};
|
|
assert.deepEqual(selections.sort(), Object.keys(expected).sort());
|
|
for (const [selection, label] of Object.entries({ ...expected, Bug: "bug", Regression: "bug" })) {
|
|
for (const value of [selection, selection.toUpperCase(), `**${selection}**`,
|
|
`\`${selection}\``, `[${selection}](https://example.invalid/context)`]) {
|
|
assert.equal(triage.internals.classifyV6FeedbackType(`### Feedback type\n${value}\n`), label, value);
|
|
}
|
|
}
|
|
});
|
|
|
|
test("examples, withdrawn selections and prose do not invent a feedback class", () => {
|
|
for (const selection of [
|
|
'',
|
|
'~~Bug / regression~~', '> Bug / regression', '<span>Bug / regression</span>',
|
|
'Not a bug; asking about debugging', 'Unknown; Performance issue elsewhere',
|
|
'_No response_', 'unknown', '',
|
|
]) {
|
|
assert.equal(triage.internals.classifyV6FeedbackType(
|
|
`### Feedback type\n${selection}\n\n### What happened?\nBug / regression\n`), null, selection);
|
|
}
|
|
});
|
|
|
|
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",
|
|
"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);
|
|
}
|
|
}
|
|
});
|
|
|
|
test("copied blocks cannot supply or contradict a feedback selection", () => {
|
|
for (const copied of [
|
|
"> Documentation issue",
|
|
"```text\nDocumentation issue\n```",
|
|
" Documentation issue",
|
|
"<div>Documentation issue</div>",
|
|
]) {
|
|
for (const newline of ["\n", "\r\n"]) {
|
|
for (const selection of [`Bug / regression\n\n${copied}`, `${copied}\n\nBug / regression`]) {
|
|
const body = `### Feedback type\n${selection}\n\n### Pulse version\nunknown`
|
|
.replaceAll("\n", newline);
|
|
assert.equal(triage.internals.classifyV6FeedbackType(body), "bug", selection);
|
|
}
|
|
const body = `### Feedback type\n${copied}\n\n### Pulse version\nunknown`
|
|
.replaceAll("\n", newline);
|
|
assert.equal(triage.internals.classifyV6FeedbackType(body), null, copied);
|
|
}
|
|
}
|
|
});
|
|
|
|
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(),
|
|
withAffectedVersions(issue, [...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(),
|
|
withAffectedVersions(issue, [...preserved, ...added, "documentation"].sort()));
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
}
|
|
});
|
|
}
|
|
|
|
test("comment-rich feedback keeps hidden hints separate from the complete visible choice", () => {
|
|
const comments = "<!-- hint -->".repeat(4000);
|
|
for (const newline of ["\n", "\r\n"]) {
|
|
for (const [selection, expected] of [
|
|
[`${comments}\n\nDocumentation issue`, "documentation"],
|
|
[`Bug / regression\n\n${comments}`, "bug"],
|
|
[`${comments}\n\nBug /\nregression`, "bug"],
|
|
[`Bug / regression\n\n${comments}\n\nDocumentation issue`, null],
|
|
[`Documentation issue\n\n${comments}\n\nThis is only a question.`, null],
|
|
[`${comments}\n\n\`<!-- literal -->\``, null],
|
|
]) {
|
|
const body = `### Feedback type\n${selection}\n\n### Pulse version\nunknown`
|
|
.replaceAll("\n", newline);
|
|
assert.equal(triage.internals.classifyV6FeedbackType(body), expected);
|
|
}
|
|
}
|
|
});
|
|
|
|
test("repeated comment delimiters cannot become selected feedback or hide later visible choices", () => {
|
|
const delimiters = "<!--" + "--><!--".repeat(6000);
|
|
for (const newline of ["\n", "\r\n"]) {
|
|
for (const [selection, expected] of [
|
|
[delimiters + "unclosed hint", null],
|
|
[`Bug / regression\n\n${delimiters}unclosed hint`, "bug"],
|
|
[delimiters + "-->\n\nDocumentation issue", "documentation"],
|
|
[`Bug / regression\n\n${delimiters}-->\nDocumentation issue`, null],
|
|
]) {
|
|
const body = `### Feedback type\n${selection}\n\n### Pulse version\nunknown`
|
|
.replaceAll("\n", newline);
|
|
assert.equal(triage.internals.classifyV6FeedbackType(body), expected);
|
|
}
|
|
}
|
|
});
|
|
|
|
test("comment-rich intake remains silent and preserves Community labels and topic review", async () => {
|
|
for (const [selection, addedClass] of [
|
|
["Documentation issue", ["documentation"]],
|
|
["Bug / regression\n\nDocumentation issue", []],
|
|
]) {
|
|
const preserved = ["needs-human", "needs-retest-on-latest", "operator-reviewed"];
|
|
const issue = { number: 42, title: "Synthetic comment-rich feedback", state: "open", comments: 0,
|
|
updated_at: "2026-11-01T06:25:00Z", labels: preserved.map(name => ({ name })),
|
|
body: `### Feedback type\n${"<!-- hint -->".repeat(4000)}\n\n${selection}\n\n` +
|
|
"### Pulse version\nunknown\n\n### Additional actionable topics\nKeep the independent notification review." };
|
|
const { github, calls } = createGithub({ currentIssue: issue });
|
|
await syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
assert.deepEqual(calls.addLabels.flatMap(call => call.labels), [...addedClass, "needs-decomposition"]);
|
|
assert.deepEqual(github.currentIssue.labels.map(label => label.name).sort(),
|
|
withAffectedVersions(issue, [...preserved, ...addedClass, "needs-decomposition"].sort()));
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
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"]) {
|
|
for (const level of [2, 3, 6]) {
|
|
const body = values => values.map(value =>
|
|
`${"#".repeat(level)} Feedback type${newline}${value}${newline}`).join(newline);
|
|
for (const [values, expected] of [
|
|
[["Bug / regression", "Performance issue", "Upgrade / migration issue"], "bug"],
|
|
[["Bug", "Regression"], "bug"],
|
|
[["Documentation issue", "[**DOCUMENTATION ISSUE**](https://example.invalid/bugs)"], "documentation"],
|
|
[["UX / workflow friction", "Other actionable feedback"], "enhancement"],
|
|
[["Bug / regression", "Documentation issue"], null],
|
|
[["Documentation issue", "UX / workflow friction"], null],
|
|
[["Performance issue", "unknown"], null],
|
|
[["Documentation issue", "_No response_"], null],
|
|
[["UX / workflow friction", "~~Other actionable feedback~~"], null],
|
|
[["Bug / regression", ""], null],
|
|
[["unknown", ""], null],
|
|
]) {
|
|
assert.equal(classifyV6FeedbackType(body(values)), expected, JSON.stringify(values));
|
|
assert.equal(classifyV6FeedbackType(body([...values].reverse())), expected,
|
|
"Field order cannot settle contradictory evidence");
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
test("copied and secondary feedback fields cannot veto an agreeing primary category", () => {
|
|
for (const copied of [
|
|
"```markdown\n### Feedback type\nBug / regression\n```",
|
|
"> ### Feedback type\n> Bug / regression",
|
|
"<!--\n### Feedback type\nBug / regression\n-->",
|
|
"### Additional actionable topics\nAnother job.\n#### Feedback type\nBug / regression",
|
|
]) {
|
|
const body = `### Feedback type\nDocumentation issue\n\n${copied}\n\n` +
|
|
"### Feedback type\n**Documentation issue**\n";
|
|
assert.equal(triage.internals.classifyV6FeedbackType(body), "documentation", copied);
|
|
}
|
|
});
|
|
|
|
for (const action of ["opened", "edited", "reopened"]) {
|
|
test(`${action} consumes repeated feedback without invented categories or version demands`, async () => {
|
|
const preserved = ["needs-human", "needs-retest-on-latest", "release-blocker",
|
|
"stable-regression", "operator-reviewed"];
|
|
for (const values of [
|
|
["Bug / regression", "Documentation issue"],
|
|
["Documentation issue", "UX / workflow friction"],
|
|
["Performance issue", "unknown"],
|
|
["Bug / regression", ""],
|
|
]) {
|
|
for (const selections of [values, [...values].reverse()]) {
|
|
for (const version of ["6.6.0", "unknown"]) {
|
|
const { github, calls } = createGithub();
|
|
const body = selections.map(value => `### Feedback type\n${value}\n`).join("\n") +
|
|
`\n### Pulse version\n${version}\n\n### Additional actionable topics\nA separate saved-history problem.\n`;
|
|
const issue = { number: 42, title: "Synthetic repeated feedback", comments: 0,
|
|
labels: preserved.map(name => ({ name })), body };
|
|
await syncLabels({ github, core: createCore(), context: createContext({ action, issue,
|
|
previousBody: "### Additional actionable topics\nNone\n" }) });
|
|
const expected = [...preserved, ...(action === "reopened" ? [] : ["needs-decomposition"])].sort();
|
|
assert.deepEqual(github.currentIssue.labels.map(label => label.name).sort(),
|
|
withAffectedVersions(issue, expected));
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels),
|
|
action === "reopened" ? [] : [["needs-decomposition"]]);
|
|
assert.deepEqual(calls.getLabel, action === "reopened" ? [] : ["needs-decomposition"]);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
test("ambiguous feedback preserves an existing Community bug and its independent version metadata", async () => {
|
|
for (const version of ["6.6.0", "unknown"]) {
|
|
const { github, calls } = createGithub();
|
|
const preserved = ["Bug", "needs-human", "needs-retest-on-latest", "operator-reviewed"];
|
|
const issue = { number: 42, title: "Synthetic reviewed report", comments: 0,
|
|
labels: [...preserved, "affects-6.5.0"].map(name => ({ name })),
|
|
body: "### Feedback type\nDocumentation issue\n\n### Feedback type\nBug / regression\n\n" +
|
|
`### Pulse version\n${version}\n` };
|
|
await syncLabels({ github, core: createCore(), context: createContext({ issue }) });
|
|
const expected = version === "unknown" ? "needs-version-info" : "affects-6.6.0";
|
|
assert.deepEqual(github.currentIssue.labels.map(label => label.name).sort(),
|
|
withAffectedVersions(issue, [...preserved, expected].sort()));
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [[expected]]);
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name), []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
}
|
|
});
|
|
|
|
test("syncLabels consumes the selected feedback class without invented version demands or contact", async () => {
|
|
for (const action of ["opened", "edited", "reopened"]) {
|
|
for (const [selection, classification] of [
|
|
['[Documentation issue](https://example.invalid/bugs "Performance issue")', "documentation"],
|
|
['[UX / workflow friction](https://example.invalid/bugs)', "enhancement"],
|
|
['[Unknown](https://example.invalid/bugs)', null],
|
|
['', null],
|
|
['~~Bug / regression~~', null],
|
|
]) {
|
|
const { github, calls } = createGithub();
|
|
const labels = ["needs-human", "needs-retest-on-latest", "needs-decomposition", "operator-reviewed"];
|
|
const issue = { number: 2930, title: "Existing feedback", labels: labels.map(name => ({ name })),
|
|
body: `### Feedback type\n${selection}\n\n### Pulse version\nunknown\n` };
|
|
await syncLabels({ github, core: createCore(), context: createContext({ action, issue }) });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), classification ? [[classification]] : [], selection);
|
|
assert.deepEqual(calls.createLabel, [], selection);
|
|
assert.deepEqual(calls.removeLabel, [], selection);
|
|
assert.deepEqual(calls.createComment, [], selection);
|
|
assert.deepEqual(calls.getLatestRelease, [], selection);
|
|
assert.deepEqual(calls.paginate, [], selection);
|
|
}
|
|
}
|
|
});
|
|
|
|
test("an unrecognised feedback selection cannot undo an existing maintainer bug classification", async () => {
|
|
const { github, calls } = createGithub();
|
|
const labels = ["bug", "affects-6.5.0", "needs-human", "needs-retest-on-latest", "needs-decomposition"];
|
|
const issue = { number: 2931, title: "Existing report", labels: labels.map(name => ({ name })),
|
|
body: '### Feedback type\n[Unknown](https://example.invalid/bugs)\n\n### Pulse version\n6.5.0\n' };
|
|
await syncLabels({ github, core: createCore(), context: createContext({ issue }) });
|
|
assert.deepEqual(calls.addLabels, []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
});
|
|
|
|
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 syncLabels({
|
|
github,
|
|
context: createContext({ issue }),
|
|
core: createCore(),
|
|
});
|
|
|
|
assert.deepEqual(calls.createLabel.map((call) => call.name), [
|
|
"needs-decomposition",
|
|
]);
|
|
assert.deepEqual(calls.addLabels[0].labels, [
|
|
"needs-decomposition",
|
|
]);
|
|
});
|
|
|
|
test("syncLabels preserves community decomposition on an empty form field", async () => {
|
|
for (const action of ["edited", "reopened"]) {
|
|
const { github, calls } = createGithub({ latestVersion: "6.4.1" });
|
|
const issue = {
|
|
number: 1796,
|
|
title: "Availability workflow feedback",
|
|
body: "## Additional actionable topics\nNone.\n",
|
|
// A later comment may have raised a distinct topic after this form was filed.
|
|
labels: [{ name: "enhancement" }, { name: "needs-decomposition" }],
|
|
};
|
|
|
|
await syncLabels({
|
|
github,
|
|
context: createContext({ action, issue }),
|
|
core: createCore(),
|
|
});
|
|
|
|
assert.equal(calls.createLabel.length, 0);
|
|
assert.equal(calls.addLabels.length, 0);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
}
|
|
});
|
|
|
|
test("syncLabels adds newly declared topics but respects a completed disposition", async () => {
|
|
const topicBody = "## Additional actionable topics\nAdd a storage filter.\n";
|
|
const emptyBody = "## Additional actionable topics\nNone.\n";
|
|
for (const { action, previousBody, expectedAdd } of [
|
|
{ action: "edited", previousBody: emptyBody, expectedAdd: true },
|
|
{ action: "edited", previousBody: topicBody, expectedAdd: false },
|
|
{ action: "edited", expectedAdd: false },
|
|
{ action: "reopened", expectedAdd: false },
|
|
]) {
|
|
const { github, calls } = createGithub();
|
|
await syncLabels({
|
|
github,
|
|
context: createContext({ action, previousBody, issue: {
|
|
number: 1796,
|
|
title: "Availability workflow feedback",
|
|
body: topicBody,
|
|
labels: [{ name: "enhancement" }],
|
|
} }),
|
|
core: createCore(),
|
|
});
|
|
assert.deepEqual(calls.addLabels.flatMap(call => call.labels),
|
|
expectedAdd ? ["needs-decomposition"] : []);
|
|
}
|
|
});
|
|
|
|
for (const [name, before, after] of [
|
|
["appended", "Add a storage filter.", "Add a storage filter.\nAlso retain failed notification attempts."],
|
|
["replaced", "Add a storage filter.", "Retain failed notification attempts."],
|
|
["revised", "Retain one failed attempt.", "Retain every failed attempt."],
|
|
]) {
|
|
test(`syncLabels requeues ${name} secondary topics after an earlier disposition`, async () => {
|
|
const body = value => `### Additional actionable topics\n${value}\n### Pulse version\n6.5.0\n`;
|
|
const { github, calls } = createGithub();
|
|
await syncLabels({
|
|
github,
|
|
context: createContext({ action: "edited", previousBody: body(before), issue: {
|
|
number: 1796, title: "Monitoring workflow", body: body(after),
|
|
labels: [{ name: "enhancement" }, { name: "operator-reviewed" }],
|
|
} }),
|
|
core: createCore(),
|
|
});
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["needs-decomposition"]]);
|
|
assert.equal(calls.removeLabel.length, 0);
|
|
assert.equal(calls.createComment.length, 0);
|
|
assert.equal(calls.getLatestRelease.length, 0);
|
|
});
|
|
}
|
|
|
|
for (const [name, before, after] of [
|
|
["an unrelated field", "### Summary\nOld wording\n### Additional actionable topics\nAdd a storage filter.\n",
|
|
"### Summary\nNew wording\n### Additional actionable topics\nAdd a storage filter.\n"],
|
|
["whitespace only", "### Additional actionable topics\nRetain every failed attempt.\n",
|
|
"### Additional actionable topics\n\nRetain every\nfailed attempt. \n"],
|
|
["hidden comments only", "### Additional actionable topics\nRetain every failed attempt. <!-- old note -->\n",
|
|
"### Additional actionable topics\nRetain every failed attempt. <!-- new note -->\n"],
|
|
["removing the topics", "### Additional actionable topics\nAdd a storage filter.\n",
|
|
"### Additional actionable topics\nNone.\n"],
|
|
]) {
|
|
test(`syncLabels does not requeue dispositioned topics for ${name}`, async () => {
|
|
const { github, calls } = createGithub();
|
|
await syncLabels({
|
|
github,
|
|
context: createContext({ action: "edited", previousBody: before, issue: {
|
|
number: 1796, title: "Monitoring workflow", body: after,
|
|
labels: [{ name: "enhancement" }, { name: "operator-reviewed" }],
|
|
} }),
|
|
core: createCore(),
|
|
});
|
|
assert.equal(calls.addLabels.length, 0);
|
|
assert.equal(calls.removeLabel.length, 0);
|
|
assert.equal(calls.createComment.length, 0);
|
|
});
|
|
}
|
|
|
|
test("triage guidance preserves revised-topic review", () => {
|
|
const guide = fs.readFileSync(path.resolve(__dirname, "../../docs/ISSUE_TRIAGE.md"), "utf8");
|
|
assert.match(guide.replace(/\s+/g, " "), /adding or revising actionable content/);
|
|
assert.match(guide, /after an earlier topic was dispositioned/);
|
|
});
|
|
|
|
test("a revised topic cannot override a newer Community disposition", async () => {
|
|
const previousBody = "### Additional actionable topics\nRetain one failed attempt.\n";
|
|
const issue = {
|
|
number: 1796, title: "Monitoring workflow", state: "open",
|
|
body: "### Additional actionable topics\nRetain every failed attempt.\n",
|
|
updated_at: "2026-10-08T10:00:00Z", labels: [{ name: "enhancement" }],
|
|
};
|
|
for (const stage of ["before initial read", "during label preparation"]) {
|
|
const { github, calls } = createGithub({ currentIssue: { ...issue } });
|
|
if (stage === "before initial read") {
|
|
github.currentIssue.updated_at = "2026-10-08T11:00:00Z";
|
|
} else {
|
|
const getLabel = github.rest.issues.getLabel;
|
|
github.rest.issues.getLabel = async payload => {
|
|
github.currentIssue = { ...issue, updated_at: "2026-10-08T11:00:00Z" };
|
|
return getLabel(payload);
|
|
};
|
|
}
|
|
await syncLabels({ github, core: createCore(),
|
|
context: createContext({ action: "edited", previousBody, issue }) });
|
|
assert.equal(calls.addLabels.length, 0, stage);
|
|
assert.equal(calls.removeLabel.length, 0, stage);
|
|
assert.equal(calls.createComment.length, 0, stage);
|
|
}
|
|
});
|
|
|
|
test("a review cleared since the queued event stays cleared within the same timestamp second", async () => {
|
|
const previousBody = "### Additional actionable topics\nAn earlier topic.\n";
|
|
const body = "### Additional actionable topics\nAlso retain per-host alert identity.\n";
|
|
for (const action of ["opened", "edited"]) {
|
|
for (const reviewedInEvent of [false, true]) {
|
|
for (const pendingNow of [false, true]) {
|
|
const community = ["enhancement", "needs-human", "needs-retest-on-latest", "operator-reviewed"];
|
|
const issue = { number: 2937, title: "Monitoring workflow", body, comments: 0,
|
|
updated_at: "2026-10-26T19:00:00Z",
|
|
labels: [...community, ...(reviewedInEvent ? ["needs-decomposition"] : [])]
|
|
.map(name => ({ name })) };
|
|
const { github, calls } = createGithub({ currentIssue: { ...issue, state: "open",
|
|
labels: [...community, ...(pendingNow ? ["needs-decomposition"] : [])]
|
|
.map(name => ({ name })) } });
|
|
await syncLabels({ github, core: createCore(),
|
|
context: createContext({ action, issue, previousBody }) });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels),
|
|
!reviewedInEvent && !pendingNow ? [["needs-decomposition"]] : [],
|
|
`${action}: event review=${reviewedInEvent}, current review=${pendingNow}`);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getEvents, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
test("respecting a cleared review does not discard independent current version metadata", async () => {
|
|
const community = ["bug", "needs-human", "needs-retest-on-latest", "operator-reviewed"];
|
|
const issue = { number: 2938, title: "Monitoring workflow", comments: 0,
|
|
updated_at: "2026-10-26T19:00:00Z",
|
|
body: "### Pulse version\n6.6.0\n### Additional actionable topics\nA revised backup topic.\n",
|
|
labels: [...community, "affects-6.5.0", "needs-decomposition"].map(name => ({ name })) };
|
|
const { github, calls } = createGithub({ currentIssue: { ...issue, state: "open",
|
|
labels: [...community, "affects-6.5.0"].map(name => ({ name })) } });
|
|
await syncLabels({ github, core: createCore(), context: createContext({ action: "edited", issue,
|
|
previousBody: "### Pulse version\n6.6.0\n### Additional actionable topics\nAn earlier topic.\n",
|
|
}) });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["affects-6.6.0"]]);
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name), []);
|
|
assert.deepEqual(calls.createLabel.map(call => call.name), ["affects-6.6.0"]);
|
|
assert.deepEqual(calls.getEvents, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
});
|
|
|
|
test("an observed cleared review needs no delayed-comment history to remain cleared", async () => {
|
|
const issue = { number: 2939, title: "Monitoring workflow", comments: 0,
|
|
updated_at: "2026-10-26T19:00:00Z",
|
|
body: "### Additional actionable topics\nRetain per-host alert identity.\n",
|
|
labels: ["enhancement", "needs-decomposition"].map(name => ({ name })) };
|
|
const { github, calls } = createGithub({ currentIssue: { ...issue, state: "open", comments: 1,
|
|
updated_at: "2026-10-26T19:01:00Z", labels: [{ name: "enhancement" }] } });
|
|
github.rest.issues.listEvents = async () => {
|
|
throw new Error("A known removed review must not require speculative history");
|
|
};
|
|
await syncLabels({ github, core: createCore(), context: createContext({ action: "edited", issue,
|
|
previousBody: "### Additional actionable topics\nNone\n",
|
|
}) });
|
|
assert.deepEqual(calls.addLabels, []);
|
|
assert.deepEqual(calls.createLabel, []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getEvents, []);
|
|
});
|
|
|
|
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<!<!-- -->-->\n"
|
|
),
|
|
false
|
|
);
|
|
assert.equal(
|
|
classifyAdditionalActionableTopics(
|
|
"## Additional actionable topics\n- Add a storage filter\n- Reduce log noise\n"
|
|
),
|
|
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("edited form headings accept Markdown indentation and closing hashes", () => {
|
|
const { extractPulseVersion, classifyAdditionalActionableTopics, classifyV6FeedbackType } = triage.internals;
|
|
for (const newline of ["\n", "\r\n"]) {
|
|
for (let level = 1; level <= 6; level += 1) {
|
|
for (let indent = 0; indent <= 3; indent += 1) {
|
|
for (const closing of ["", " #", " ######## \t"]) {
|
|
const heading = (name) => " ".repeat(indent) + "#".repeat(level) + "\t" + name + closing;
|
|
const body = [heading("Pulse version"), "6.5.0", "",
|
|
heading("Feedback type"), "Documentation issue", "",
|
|
heading("Additional actionable topics"), "The second host loses its Docker inventory."]
|
|
.join(newline);
|
|
assert.equal(extractPulseVersion("Upgrade from v6.4.5", body), "6.5.0", body);
|
|
assert.equal(classifyV6FeedbackType(body), "documentation", body);
|
|
assert.equal(classifyAdditionalActionableTopics(body), true, body);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
test("closing hashes and indentation do not let neighbouring fields become topics", () => {
|
|
for (const followingField of ["Pulse version", "Additional context", "Logs, screenshots, or diagnostics", "Confirmations"]) {
|
|
const body = [" ### Additional actionable topics ###", "None", "",
|
|
` ## ${followingField} ####`, "An error outside the declared topic field."].join("\n");
|
|
assert.equal(triage.internals.classifyAdditionalActionableTopics(body), false, body);
|
|
}
|
|
const body = [" ### Additional actionable topics #", "None", "",
|
|
" #### Separate backup problem ###", "Backups belong to the wrong host.", "",
|
|
" ### Pulse version ####", "6.5.0"].join("\n");
|
|
assert.equal(triage.internals.classifyAdditionalActionableTopics(body), true);
|
|
});
|
|
|
|
test("plain hash-prefixed text cannot declare issue-form metadata", () => {
|
|
const { extractPulseVersion, classifyAdditionalActionableTopics, classifyV6FeedbackType } = triage.internals;
|
|
for (const prefix of ["####### ", "###", " ### ", "\t### ", "> ### "]) {
|
|
const body = [prefix + "Pulse version", "6.5.0", "",
|
|
prefix + "Feedback type", "Bug / regression", "",
|
|
prefix + "Additional actionable topics", "Copied template text."].join("\n");
|
|
assert.equal(extractPulseVersion("No version in title", body), null, body);
|
|
assert.equal(classifyV6FeedbackType(body), null, body);
|
|
assert.equal(classifyAdditionalActionableTopics(body), null, body);
|
|
}
|
|
// A seven-hash line inside a topic is ordinary field content, not a boundary.
|
|
assert.equal(classifyAdditionalActionableTopics(
|
|
"### Additional actionable topics\nNone\n####### Pulse version\nA second symptom.\n"
|
|
), true);
|
|
});
|
|
|
|
test("only a separated final hash run closes an issue-form heading", () => {
|
|
for (const suffix of ["#", " ### example", " ## #"]) {
|
|
const body = `### Additional actionable topics${suffix}\nA second bug.\n`;
|
|
assert.equal(triage.internals.classifyAdditionalActionableTopics(body), null, body);
|
|
}
|
|
});
|
|
|
|
test("edited headings stay hidden inside comments and pasted code", () => {
|
|
const { extractPulseVersion, classifyAdditionalActionableTopics, classifyV6FeedbackType } = triage.internals;
|
|
const copied = [" ### Pulse version ###", "6.4.1", " ### Feedback type ###",
|
|
"Bug / regression", " ### Additional actionable topics ###", "Copied example."].join("\n");
|
|
for (const [open, close] of [["<!--", "-->"], ["```markdown", "```"], ["~~~markdown", "~~~"]]) {
|
|
const body = [open, copied, close, " ### Pulse version ###", "unknown",
|
|
" ### Feedback type ###", "Documentation issue", " ### Additional actionable topics ###", "None"]
|
|
.join("\n");
|
|
assert.equal(extractPulseVersion("Upgrade from v6.4.5", body), null, body);
|
|
assert.equal(classifyV6FeedbackType(body), "documentation", body);
|
|
assert.equal(classifyAdditionalActionableTopics(body), false, body);
|
|
}
|
|
});
|
|
|
|
test("edited version headings retain fenced values and authoritative unknowns", () => {
|
|
for (const value of ["6.5.0-rc.1", "unknown", "6.5"]) {
|
|
const body = [" ### Pulse version ###", "```text", value, "```", "",
|
|
" ### Agent version ###", "6.4.5"].join("\n");
|
|
assert.equal(triage.internals.extractPulseVersion("Upgrade from v6.4.5", body),
|
|
value === "6.5.0-rc.1" ? value : null, body);
|
|
}
|
|
});
|
|
|
|
test("label consumer uses edited headings without changing Community-owned state", async () => {
|
|
const { github, calls } = createGithub();
|
|
const issue = { number: 2900, title: "Upgrade from v6.4.5",
|
|
body: " ### Feedback type ###\nBug / regression\n ### Pulse version ###\n6.5.0\n" +
|
|
" ### Additional actionable topics ###\nThe second host loses Docker inventory.\n",
|
|
labels: ["enhancement", "needs-retest-on-latest", "needs-human", "operator-reviewed", "affects-6.4.5"]
|
|
.map(name => ({ name })) };
|
|
await syncLabels({ github, core: createCore(), context: createContext({ issue }) });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels),
|
|
[["affects-6.5.0", "bug", "needs-decomposition"]]);
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name), []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
assert.deepEqual(calls.getIssue.map(call => call.issue_number), Array(2 + calls.removeLabel.length).fill(2900));
|
|
});
|
|
|
|
test("invalid headings cannot create classification or decomposition mutations", async () => {
|
|
const { github, calls } = createGithub();
|
|
const issue = { number: 2901, title: "An example in a documentation report",
|
|
body: "####### Feedback type\nBug / regression\n####### Pulse version\n6.5.0\n" +
|
|
"####### Additional actionable topics\nCopied template text.\n",
|
|
labels: ["documentation", "needs-retest-on-latest", "needs-human", "operator-reviewed"]
|
|
.map(name => ({ name })) };
|
|
await syncLabels({ github, core: createCore(), context: createContext({ issue }) });
|
|
assert.deepEqual(calls.addLabels, []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
});
|
|
|
|
test("topic classification reads later paragraphs after an empty first line", () => {
|
|
for (const firstLine of ["None", "<!-- List distinct topics here. -->", "_No response_"]) {
|
|
const body = [
|
|
"### Additional actionable topics", firstLine, "",
|
|
"The second host also loses its Docker inventory.", "",
|
|
"### Pulse version", "6.5.0",
|
|
].join("\n");
|
|
assert.equal(triage.internals.classifyAdditionalActionableTopics(body), true);
|
|
}
|
|
});
|
|
|
|
const formattedNoTopicResponses = [
|
|
"**None**",
|
|
"*None.*",
|
|
"__N/A__",
|
|
"`none known`",
|
|
"**_No response_**",
|
|
'[None](https://example.invalid/context "not another topic")',
|
|
"None that I know of.",
|
|
"**None** that I know of.",
|
|
"NONE THAT I KNOW OF!",
|
|
'[None that I know of.](https://example.invalid/context "another topic")',
|
|
];
|
|
|
|
test("visible no-topic responses stay empty through ordinary inline formatting", () => {
|
|
for (const value of formattedNoTopicResponses) {
|
|
const body = `### Additional actionable topics\n${value}\n\n### Pulse version\n6.5.0`;
|
|
assert.equal(triage.internals.classifyAdditionalActionableTopics(body), false, value);
|
|
}
|
|
});
|
|
|
|
test("no-topic formatting cannot discard qualifiers, block evidence or images", () => {
|
|
for (const value of [
|
|
"**None**, except the saved target changes after switching organisation.",
|
|
"None that I know of, except another host also loses its disk history.",
|
|
"None that I know of. However, the saved target also changes.",
|
|
"None that I know of.\n\nThe second host also loses its Docker inventory.",
|
|
"None that I know of.\n\n```text\nAnother symptom is recorded here.\n```",
|
|
"",
|
|
"None\n\n**The backup issue also affects another host.**",
|
|
"None\n\n```text\n### Pulse version\n6.5.0\n```",
|
|
"- **None**\n- The saved target also changes.",
|
|
"",
|
|
"~~None~~",
|
|
"`**None**`",
|
|
"\\*None\\*",
|
|
]) {
|
|
const body = `### Additional actionable topics\n${value}\n\n### Pulse version\n6.5.0`;
|
|
assert.equal(triage.internals.classifyAdditionalActionableTopics(body), true, value);
|
|
}
|
|
});
|
|
|
|
test("formatted no-topic edits preserve completed reviews without public contact", async () => {
|
|
const labels = ["enhancement", "needs-human", "needs-retest-on-latest"];
|
|
const body = value => `### Additional actionable topics\n${value}\n\n### Desired outcome\nKeep the current workflow.`;
|
|
for (const value of formattedNoTopicResponses) {
|
|
for (const reviewed of [false, true]) {
|
|
for (const action of ["opened", "edited"]) {
|
|
const { github, calls } = createGithub();
|
|
const issueLabels = reviewed ? [...labels, "needs-decomposition"] : labels;
|
|
const issue = { number: 2926, title: "Existing feature request", body: body(value),
|
|
labels: issueLabels.map(name => ({ name })) };
|
|
await syncLabels({ github, core: createCore(), context: createContext({
|
|
action, issue, previousBody: body("None"),
|
|
}) });
|
|
assert.deepEqual(calls.addLabels, [], `${action}: ${value}`);
|
|
assert.deepEqual(calls.removeLabel, [], value);
|
|
assert.deepEqual(calls.createLabel, [], value);
|
|
assert.deepEqual(calls.createComment, [], value);
|
|
assert.deepEqual(calls.getLatestRelease, [], value);
|
|
assert.deepEqual(calls.paginate, [], value);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
test("a qualified revision after a formatted empty response still requires review", async () => {
|
|
for (const value of formattedNoTopicResponses) {
|
|
const { github, calls } = createGithub();
|
|
const body = topic => `### Additional actionable topics\n${topic}\n\n### Pulse version\n6.5.0`;
|
|
const issue = { number: 2927, title: "Existing report", body: body(`${value}, except backup identity is also wrong.`),
|
|
labels: ["enhancement", "needs-human"].map(name => ({ name })) };
|
|
await syncLabels({ github, core: createCore(), context: createContext({
|
|
action: "edited", issue, previousBody: body(value),
|
|
}) });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["needs-decomposition"]], value);
|
|
assert.deepEqual(calls.removeLabel, [], value);
|
|
assert.deepEqual(calls.createComment, [], value);
|
|
assert.deepEqual(calls.getLatestRelease, [], value);
|
|
assert.deepEqual(calls.paginate, [], value);
|
|
}
|
|
});
|
|
|
|
test("topic classification stops at form fields but retains topic subheadings", () => {
|
|
const { classifyAdditionalActionableTopics } = triage.internals;
|
|
for (const newline of ["\n", "\r\n"]) {
|
|
for (const followingField of ["Pulse version", "Additional context", "Logs, screenshots, or diagnostics", "Confirmations"]) {
|
|
assert.equal(classifyAdditionalActionableTopics([
|
|
"### Additional actionable topics", "None", "",
|
|
`### ${followingField}`, "An error or a second topic outside this field.",
|
|
].join(newline)), false);
|
|
}
|
|
assert.equal(classifyAdditionalActionableTopics([
|
|
"### Additional actionable topics", "None", "",
|
|
"### Separate backup problem", "Backups belong to the wrong host.",
|
|
"### Pulse version", "6.5.0",
|
|
].join(newline)), true);
|
|
}
|
|
});
|
|
|
|
test("every repeated topic field is assessed without inventing topics from empty copies", () => {
|
|
const { classifyAdditionalActionableTopics } = triage.internals;
|
|
for (const newline of ["\n", "\r\n"]) {
|
|
for (const separator of ["", "### Pulse version\n6.6.0\n\n",
|
|
"## Logs, screenshots, or diagnostics\nExisting context only.\n\n"]) {
|
|
for (const [first, second, expected] of [
|
|
["None", "A separate backup identity problem.", true],
|
|
["A separate backup identity problem.", "None", true],
|
|
["None", "_No response_", false],
|
|
["<!-- hidden hint -->", "[None][empty]", false],
|
|
["", "", false],
|
|
]) {
|
|
const body = `### Additional actionable topics\n${first}\n\n${separator}` +
|
|
`### **[Additional actionable topics][field]**\n${second}\n\n` +
|
|
"### Confirmations\nExisting context only.\n\n" +
|
|
"[empty]: https://example.invalid/another-problem\n" +
|
|
"[field]: https://example.invalid/another-problem\n";
|
|
assert.equal(classifyAdditionalActionableTopics(body.replaceAll("\n", newline)), expected, body);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
test("opened intake retains a later topic field and preserves unrelated Community labels", async () => {
|
|
const { github, calls } = createGithub();
|
|
const issue = { number: 2933, title: "Backup posture", labels: ["bug", "needs-human",
|
|
"needs-retest-on-latest", "operator-reviewed"].map(name => ({ name })),
|
|
body: "### Additional actionable topics\nNone\n\n### Pulse version\n6.6.0\n\n" +
|
|
"### Additional actionable topics\nBackup destination identity is also wrong.\n" };
|
|
await syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["affects-6.6.0", "needs-decomposition"]]);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
});
|
|
|
|
test("a revised later topic field creates a new review after the earlier disposition", async () => {
|
|
const first = "### Additional actionable topics\nAn earlier storage topic.\n\n" +
|
|
"### Pulse version\n6.6.0\n\n";
|
|
for (const previous of ["", "### Additional actionable topics\nNone\n",
|
|
"### Additional actionable topics\nA previously reviewed second topic.\n"]) {
|
|
const { github, calls } = createGithub();
|
|
const issue = { number: 2934, title: "Reviewed feedback", labels: [{ name: "enhancement" }],
|
|
body: first + "### Additional actionable topics\nAnother independent workflow problem.\n" };
|
|
await syncLabels({ github, core: createCore(), context: createContext({
|
|
action: "edited", issue, previousBody: first + previous,
|
|
}) });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["needs-decomposition"]], previous);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
}
|
|
});
|
|
|
|
test("empty duplicates, identical copies and reordered fields cannot restore a completed review", async () => {
|
|
const field = value => `### Additional actionable topics\n${value}\n\n`;
|
|
const boundary = "### Pulse version\n6.6.0\n\n";
|
|
const prior = field("A storage problem.") + boundary + field("A navigation problem.");
|
|
const candidates = [
|
|
prior + boundary + field("None"),
|
|
prior + field("<!-- hidden hint -->"),
|
|
field("None") + boundary + prior,
|
|
prior + boundary + field("A storage problem."),
|
|
field("A navigation problem.") + boundary + field("A storage problem."),
|
|
field("A storage\nproblem.") + boundary + field("A navigation problem."),
|
|
];
|
|
for (const body of candidates) {
|
|
const { github, calls } = createGithub();
|
|
const issue = { number: 2935, title: "Reviewed feedback", body,
|
|
labels: ["enhancement", "needs-human", "operator-reviewed"].map(name => ({ name })) };
|
|
await syncLabels({ github, core: createCore(), context: createContext({
|
|
action: "edited", issue, previousBody: prior,
|
|
}) });
|
|
assert.deepEqual(calls.addLabels, [], body);
|
|
assert.deepEqual(calls.removeLabel, [], body);
|
|
assert.deepEqual(calls.createLabel, [], body);
|
|
assert.deepEqual(calls.createComment, [], body);
|
|
assert.deepEqual(calls.getLatestRelease, [], body);
|
|
assert.deepEqual(calls.paginate, [], body);
|
|
}
|
|
});
|
|
|
|
test("repeated empty topic fields cannot close an existing comment-topic review", async () => {
|
|
for (const action of ["opened", "edited", "reopened"]) {
|
|
const { github, calls } = createGithub();
|
|
const body = "### Additional actionable topics\nNone\n\n" +
|
|
"### Pulse version\n6.6.0\n\n### Additional actionable topics\n_No response_\n";
|
|
const issue = { number: 2936, title: "Existing feedback", body,
|
|
labels: ["enhancement", "needs-decomposition"].map(name => ({ name })) };
|
|
await syncLabels({ github, core: createCore(), context: createContext({ action, issue,
|
|
previousBody: "### Additional actionable topics\nAn existing topic.\n",
|
|
}) });
|
|
assert.deepEqual(calls.addLabels, []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
}
|
|
});
|
|
|
|
test("copied topic headings outside genuine fields cannot become later declarations", () => {
|
|
for (const copy of [
|
|
"```markdown\n### Additional actionable topics\nAnother problem.\n```",
|
|
"> ### Additional actionable topics\n> Another problem.",
|
|
"<pre>\n### Additional actionable topics\nAnother problem.\n</pre>",
|
|
"<!--\n### Additional actionable topics\nAnother problem.\n-->",
|
|
"- Copied template\n\n ### Additional actionable topics\n Another problem.",
|
|
]) {
|
|
assert.equal(triage.internals.classifyAdditionalActionableTopics(copy), null, copy);
|
|
assert.equal(triage.internals.classifyAdditionalActionableTopics(
|
|
"### Additional actionable topics\nNone\n\n### Additional context\n" + copy
|
|
), false, copy);
|
|
}
|
|
});
|
|
|
|
function topicBoundaryFields() {
|
|
const fields = new Set(["Additional context"]);
|
|
const directory = path.resolve(__dirname, "../ISSUE_TEMPLATE");
|
|
for (const name of fs.readdirSync(directory).filter(name => /\.ya?ml$/.test(name))) {
|
|
const form = fs.readFileSync(path.join(directory, name), "utf8");
|
|
for (const [, label] of form.matchAll(/^ label: (.+)$/gm)) {
|
|
if (label !== "Additional actionable topics") fields.add(label);
|
|
}
|
|
}
|
|
return [...fields];
|
|
}
|
|
|
|
test("every current form field bounds a reordered topic declaration", () => {
|
|
const { classifyAdditionalActionableTopics } = triage.internals;
|
|
for (const field of topicBoundaryFields()) {
|
|
for (const newline of ["\n", "\r\n"]) {
|
|
for (const level of [2, 3]) {
|
|
for (const empty of ["", "None", "_No response_", "<!-- optional -->"]) {
|
|
const body = ["### Additional actionable topics", empty, "",
|
|
`${"#".repeat(level)} ${field.toUpperCase()}`, "Existing context, not another topic."].join(newline);
|
|
assert.equal(classifyAdditionalActionableTopics(body), false, body);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
test("a form-named topic subheading remains actionable inside the declaration", () => {
|
|
const { classifyAdditionalActionableTopics } = triage.internals;
|
|
for (const field of topicBoundaryFields()) {
|
|
for (const level of [1, 2, 3, 4, 5]) {
|
|
const body = [`${"#".repeat(level)} Additional actionable topics`, "None", "",
|
|
`${"#".repeat(level + 1)} ${field}`, "A separate problem on this surface.", "",
|
|
`${"#".repeat(level)} Pulse version`, "6.5.0"].join("\n");
|
|
assert.equal(classifyAdditionalActionableTopics(body), true, body);
|
|
}
|
|
}
|
|
});
|
|
|
|
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"], []],
|
|
["missing primary version", ["bug"], "### Additional context\nExisting context.",
|
|
"Pulse version: 6.4.5", ["needs-version-info"], []],
|
|
["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, withAffectedVersions(issue, [...preserved, ...expected]));
|
|
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 [
|
|
"```text\n### Agent version\n6.5.0\n```",
|
|
"> ### Agent version\n> 6.5.0",
|
|
"<pre>\n### Agent version\n6.5.0\n</pre>",
|
|
"<!--\n### Agent version\n6.5.0\n-->",
|
|
]) {
|
|
const body = ["### Additional actionable topics", "None", "", copied, "",
|
|
"A separate problem still needs a disposition.", "", "### OS / environment", "API only"].join("\n");
|
|
assert.equal(classifyAdditionalActionableTopics(body), true, body);
|
|
}
|
|
});
|
|
|
|
test("opening or editing neighbouring context cannot invent a decomposition task", async () => {
|
|
for (const field of topicBoundaryFields()) {
|
|
for (const action of ["opened", "edited"]) {
|
|
const { github, calls } = createGithub();
|
|
const body = (value) => `### Additional actionable topics\nNone\n\n### ${field}\n${value}\n`;
|
|
const labels = ["enhancement", "needs-human", "release-blocker", "needs-retest-on-latest", "affects-6.5.0"];
|
|
const issue = { number: 2923, title: "Existing report", body: body("Corrected existing context"),
|
|
labels: labels.map(name => ({ name })) };
|
|
await syncLabels({ github, core: createCore(),
|
|
context: createContext({ action, issue, previousBody: body("Earlier existing context") }) });
|
|
assert.deepEqual(calls.addLabels, [], `${action}: ${field}`);
|
|
assert.deepEqual(calls.removeLabel, [], field);
|
|
assert.deepEqual(calls.createLabel, [], field);
|
|
assert.deepEqual(calls.createComment, [], field);
|
|
assert.deepEqual(calls.getLatestRelease, [], field);
|
|
assert.deepEqual(calls.paginate, [], field);
|
|
}
|
|
}
|
|
});
|
|
|
|
test("feature context edits preserve a cleared review while real topic edits restore it", async () => {
|
|
const { github, calls } = createGithub();
|
|
const body = (context, topic = "None") => [
|
|
"### Additional actionable topics", topic, "",
|
|
"### Desired outcome", context, "",
|
|
"### Alternatives considered", "An existing workaround.",
|
|
].join("\n");
|
|
const labels = ["enhancement", "needs-human", "needs-retest-on-latest"];
|
|
const issue = { number: 2925, title: "Existing feature request", body: body("Clarified outcome"),
|
|
labels: labels.map(name => ({ name })) };
|
|
await syncLabels({ github, core: createCore(), context: createContext({
|
|
action: "edited", issue, previousBody: body("Original outcome"),
|
|
}) });
|
|
assert.deepEqual(calls.addLabels, []);
|
|
assert.deepEqual(calls.createLabel, []);
|
|
|
|
const revised = { ...issue, body: body("Clarified outcome", "Also retain failed attempts in History.") };
|
|
const context = createContext({
|
|
action: "edited", issue: revised, previousBody: issue.body,
|
|
});
|
|
github.currentIssue = { ...context.payload.issue, state: "open" };
|
|
await syncLabels({ github, core: createCore(), context });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["needs-decomposition"]]);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
});
|
|
|
|
test("real revised topics still reopen review without disposing of existing tasks", async () => {
|
|
for (const existingTask of [false, true]) {
|
|
const { github, calls } = createGithub();
|
|
const previousBody = "### Additional actionable topics\nNone\n### Agent version\n6.5.0";
|
|
const body = "### Additional actionable topics\nNone\n#### Installation type\n" +
|
|
"The saved installer selection is also lost.\n### Agent version\n6.5.0";
|
|
const issue = { number: 2924, title: "Existing report", body,
|
|
labels: ["enhancement", "needs-human", "needs-retest-on-latest",
|
|
...(existingTask ? ["needs-decomposition"] : [])].map(name => ({ name })) };
|
|
await syncLabels({ github, core: createCore(),
|
|
context: createContext({ action: "edited", issue, previousBody }) });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), existingTask ? [] : [["needs-decomposition"]]);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
}
|
|
});
|
|
|
|
test("hidden template fields cannot declare topics or override feedback type", () => {
|
|
const { classifyAdditionalActionableTopics, classifyV6FeedbackType } = triage.internals;
|
|
const hidden = ["<!--", "### Additional actionable topics", "A second bug.",
|
|
"### Feedback type", "Bug / regression", "-->"].join("\n");
|
|
assert.equal(classifyAdditionalActionableTopics(hidden), null);
|
|
assert.equal(classifyV6FeedbackType(hidden), null);
|
|
assert.equal(classifyAdditionalActionableTopics(
|
|
`${hidden}\n### Additional actionable topics\nNone\n\n### Pulse version\n6.5.0`
|
|
), false);
|
|
assert.equal(classifyV6FeedbackType(
|
|
`${hidden}\n### Feedback type\nDocumentation issue\n\n### Pulse version\n6.5.0`
|
|
), "documentation");
|
|
assert.equal(classifyV6FeedbackType(
|
|
"### Feedback type\nDocumentation issue\n\n### Describe the bug\nBug / regression"
|
|
), "documentation");
|
|
});
|
|
|
|
test("literal HTML comments in pasted code cannot erase later visible form fields", () => {
|
|
const { extractPulseVersion, classifyAdditionalActionableTopics, classifyV6FeedbackType } = triage.internals;
|
|
for (const newline of ["\n", "\r\n"]) {
|
|
for (const [open, close] of [["```html", "```"], ["~~~~html", "~~~~"],
|
|
[" ````text", " ````"]]) {
|
|
for (const marker of ["<!-- unfinished response", "<!-- closed response -->", "<!<!-- -->-->"]) {
|
|
const body = [open, marker, "### Pulse version", "6.4.1", close, "",
|
|
"### Pulse version", "6.5.0", "### Feedback type", "Documentation issue",
|
|
"### Additional actionable topics", "Missing disk reading"].join(newline);
|
|
assert.equal(extractPulseVersion("Upgrade from v6.4.5", body), "6.5.0", body);
|
|
assert.equal(classifyV6FeedbackType(body), "documentation", body);
|
|
assert.equal(classifyAdditionalActionableTopics(body), true, body);
|
|
}
|
|
}
|
|
for (const indent of [" ", "\t"]) {
|
|
const body = [`${indent}<!-- copied log delimiter`, `${indent}Pulse version: 6.4.1`, "",
|
|
"### Pulse version", "6.5.0", "### Feedback type", "Documentation issue",
|
|
"### Additional actionable topics", "Missing disk reading"].join(newline);
|
|
assert.equal(extractPulseVersion("Upgrade from v6.4.5", body), "6.5.0", body);
|
|
assert.equal(classifyV6FeedbackType(body), "documentation", body);
|
|
assert.equal(classifyAdditionalActionableTopics(body), true, body);
|
|
}
|
|
}
|
|
});
|
|
|
|
test("hidden comments still hide their contents even when they contain code fences", () => {
|
|
const { extractPulseVersion, classifyAdditionalActionableTopics, classifyV6FeedbackType } = triage.internals;
|
|
const hidden = ["<!-- hidden template", "```markdown", "### Pulse version", "6.4.1",
|
|
"### Feedback type", "Bug / regression", "### Additional actionable topics", "Copied topic", "```"];
|
|
const visible = ["### Pulse version", "6.5.0", "### Feedback type", "Documentation issue",
|
|
"### Additional actionable topics", "None"];
|
|
for (const newline of ["\n", "\r\n"]) {
|
|
const closed = [...hidden, " -->", ...visible].join(newline);
|
|
assert.equal(extractPulseVersion("Upgrade from v6.4.5", closed), "6.5.0");
|
|
assert.equal(classifyV6FeedbackType(closed), "documentation");
|
|
assert.equal(classifyAdditionalActionableTopics(closed), false);
|
|
const unfinished = [...hidden, ...visible].join(newline);
|
|
assert.equal(extractPulseVersion("Bug", unfinished), null);
|
|
assert.equal(classifyV6FeedbackType(unfinished), null);
|
|
assert.equal(classifyAdditionalActionableTopics(unfinished), null);
|
|
}
|
|
});
|
|
|
|
test("pasted HTML keeps genuine topic values without turning copied headings into fields", () => {
|
|
const body = ["### Additional actionable topics", "```html", "<!-- unmatched response marker",
|
|
"### Pulse version", "6.4.1", "```", "### Pulse version", "6.5.0"].join("\n");
|
|
assert.equal(triage.internals.classifyAdditionalActionableTopics(body), true);
|
|
assert.equal(triage.internals.extractPulseVersion("Upgrade from v6.4.5", body), "6.5.0");
|
|
});
|
|
|
|
test("inline and quoted HTML literals cannot hide subsequent form declarations", () => {
|
|
const { extractPulseVersion, classifyV6FeedbackType, classifyAdditionalActionableTopics } = triage.internals;
|
|
for (const evidence of [
|
|
"The error includes `<!-- unfinished`.",
|
|
"The error includes ``a ` tick and <!-- unfinished``.",
|
|
"The error includes `<!-- first` and ``<!-- second``.",
|
|
"> ```html\n> <!-- unfinished\n> ### Pulse version\n> 6.4.1\n> ```",
|
|
" > The response includes <!-- unfinished",
|
|
"The literal is \\<!-- unfinished.",
|
|
]) {
|
|
for (const newline of ["\n", "\r\n"]) {
|
|
const body = ["### Existing evidence", evidence, "", "### Pulse version", "6.5.0",
|
|
"### Feedback type", "Documentation issue", "### Additional actionable topics",
|
|
"Storage History remains empty."].join("\n").replaceAll("\n", newline);
|
|
assert.equal(extractPulseVersion("Upgrade from v6.4.5", body), "6.5.0", body);
|
|
assert.equal(classifyV6FeedbackType(body), "documentation", body);
|
|
assert.equal(classifyAdditionalActionableTopics(body), true, body);
|
|
}
|
|
}
|
|
});
|
|
|
|
test("an interrupted inline comment cannot turn an unclosed code fence into visible fields", () => {
|
|
const { extractPulseVersion, classifyV6FeedbackType, classifyAdditionalActionableTopics } = triage.internals;
|
|
for (const evidence of [
|
|
"A literal `<!-- unfinished` followed by <!--",
|
|
"A mismatched `<!-- opener`` remains text before a block quote",
|
|
"An escaped \\` backtick does not protect <!-- unfinished`",
|
|
"An even escape \\\\<!-- remains text before the quote",
|
|
"<!-- a hidden ` backtick is not an opener --> <!-- second hidden`",
|
|
]) {
|
|
const body = [evidence, "> quoted text", "```", "### Pulse version", "6.4.1",
|
|
"### Feedback type", "Bug / regression", "### Additional actionable topics", "Copied topic",
|
|
"-->", "### Pulse version", "unknown", "### Feedback type", "Documentation issue",
|
|
"### Additional actionable topics", "None"].join("\n");
|
|
// GFM's block lexer puts every later line inside the unclosed fence.
|
|
// The previous scanner mistakenly treated an inline opener as a comment
|
|
// across those blocks, then accepted invisible headings after its close.
|
|
assert.equal(extractPulseVersion("Upgrade from v6.4.5", body), null, body);
|
|
assert.equal(classifyV6FeedbackType(body), null, body);
|
|
assert.equal(classifyAdditionalActionableTopics(body), null, body);
|
|
const visible = body + "\n```\n### Pulse version\n6.5.0\n" +
|
|
"### Feedback type\nDocumentation issue\n### Additional actionable topics\nNone";
|
|
assert.equal(extractPulseVersion("Upgrade from v6.4.5", visible), "6.5.0", visible);
|
|
assert.equal(classifyV6FeedbackType(visible), "documentation", visible);
|
|
assert.equal(classifyAdditionalActionableTopics(visible), false, visible);
|
|
}
|
|
});
|
|
|
|
test("syncLabels preserves visible fields after inline HTML without new contact", async () => {
|
|
for (const evidence of ["Error: `<!-- unfinished`", "> <!-- unfinished response"]) {
|
|
const { github, calls } = createGithub();
|
|
const issue = { number: 2808, title: "Upgrade from v6.4.5",
|
|
body: ["### Existing evidence", evidence, "", "### Pulse version", "6.5.0",
|
|
"### Feedback type", "Bug / regression", "### Additional actionable topics", "Missing History"].join("\n"),
|
|
labels: ["needs-human", "needs-retest-on-latest", "operator-reviewed", "needs-version-info"]
|
|
.map(name => ({ name })) };
|
|
await syncLabels({ github, core: createCore(), context: createContext({ issue }) });
|
|
assert.deepEqual(calls.addLabels.flatMap(call => call.labels), ["affects-6.5.0", "bug", "needs-decomposition"]);
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name), ["needs-version-info"]);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
assert.deepEqual(calls.getIssue.map(call => call.issue_number), Array(2 + calls.removeLabel.length).fill(2808));
|
|
}
|
|
});
|
|
|
|
test("syncLabels consumes real fields after pasted HTML without contact or state changes", async () => {
|
|
const { github, calls } = createGithub();
|
|
const issue = { number: 2801, title: "Upgrade from v6.4.5",
|
|
body: ["```html", "<!-- incomplete response", "### Pulse version", "6.4.1", "```",
|
|
"### Pulse version", "6.5.0", "### Feedback type", "Bug / regression",
|
|
"### Additional actionable topics", "Missing disk reading"].join("\n"),
|
|
labels: ["needs-human", "needs-retest-on-latest", "operator-reviewed", "needs-version-info"]
|
|
.map(name => ({ name })) };
|
|
await syncLabels({ github, core: createCore(), context: createContext({ issue }) });
|
|
assert.deepEqual(calls.addLabels.flatMap(call => call.labels), ["affects-6.5.0", "bug", "needs-decomposition"]);
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name), ["needs-version-info"]);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
assert.deepEqual(calls.getIssue.map(call => call.issue_number), Array(2 + calls.removeLabel.length).fill(2801));
|
|
});
|
|
|
|
test("a hidden hint or empty topic field is not an actionable declaration", () => {
|
|
for (const value of ["", "<!-- A second bug. -->", "None\n\n<!-- Another topic. -->"]) {
|
|
assert.equal(triage.internals.classifyAdditionalActionableTopics(
|
|
`### Additional actionable topics\n${value}\n\n### Pulse version\n6.5.0`
|
|
), false);
|
|
}
|
|
});
|
|
|
|
test("syncLabels surfaces newly added later-line topics without resetting Community state", async () => {
|
|
const previousBody = "### Additional actionable topics\nNone\n\n### Pulse version\n6.5.0";
|
|
const body = "### Additional actionable topics\nNone\n\n" +
|
|
"Backup attribution is also wrong.\n\n### Pulse version\n6.5.0";
|
|
for (const action of ["opened", "edited", "reopened"]) {
|
|
const { github, calls } = createGithub();
|
|
const issue = { number: 2800, title: "Host inventory report", body,
|
|
labels: [{ name: "enhancement" }, { name: "needs-retest-on-latest" }, { name: "needs-human" }] };
|
|
await syncLabels({ github, core: createCore(),
|
|
context: createContext({ action, issue, previousBody }) });
|
|
assert.deepEqual(calls.addLabels.flatMap(call => call.labels),
|
|
action === "reopened" ? [] : ["needs-decomposition"]);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
assert.deepEqual(calls.getIssue.map(call => call.issue_number), action === "reopened" ? [2800] : [2800, 2800]);
|
|
}
|
|
});
|
|
|
|
test("syncLabels ignores hidden bug examples and topic hints", async () => {
|
|
const { github, calls } = createGithub();
|
|
const issue = { number: 2801, title: "Documentation wording",
|
|
body: "<!--\n### Feedback type\nBug / regression\n" +
|
|
"### Additional actionable topics\nAnother bug.\n-->\n" +
|
|
"### Feedback type\nDocumentation issue\n\n" +
|
|
"### Additional actionable topics\nNone\n\n### Pulse version\n6.5.0",
|
|
labels: [{ name: "needs-retest-on-latest" }, { name: "needs-decomposition" }] };
|
|
await syncLabels({ github, core: createCore(), context: createContext({ issue }) });
|
|
assert.deepEqual(calls.addLabels.flatMap(call => call.labels), ["documentation"]);
|
|
assert.deepEqual(calls.createLabel.map(call => call.name), []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
});
|
|
|
|
test("fenced examples cannot declare issue metadata", () => {
|
|
const { extractPulseVersion, classifyAdditionalActionableTopics, classifyV6FeedbackType } = triage.internals;
|
|
for (const fence of ["```", "~~~~", " ````"]) {
|
|
for (const newline of ["\n", "\r\n"]) {
|
|
const body = ["### Existing evidence", `${fence}markdown`,
|
|
"### Pulse version", "6.4.1", "### Feedback type", "Bug / regression",
|
|
"### Additional actionable topics", "A copied example, not a new topic.",
|
|
fence].join(newline);
|
|
assert.equal(extractPulseVersion("No declared version", body), null, body);
|
|
assert.equal(extractPulseVersion("Bug on v6.5.0", body), "6.5.0", body);
|
|
assert.equal(classifyV6FeedbackType(body), null, body);
|
|
assert.equal(classifyAdditionalActionableTopics(body), null, body);
|
|
}
|
|
}
|
|
});
|
|
|
|
test("only matching complete fences end pasted examples", () => {
|
|
const { extractPulseVersion, classifyV6FeedbackType } = triage.internals;
|
|
for (const { open, falseClose } of [
|
|
{ open: "````text", falseClose: "```" },
|
|
{ open: "```text", falseClose: "~~~" },
|
|
{ open: "~~~text", falseClose: "```" },
|
|
{ open: "```text", falseClose: "``` still part of the log" },
|
|
{ open: "```text", falseClose: "" },
|
|
]) {
|
|
const body = [open, "Log text", falseClose, "### Pulse version", "6.4.1",
|
|
"### Feedback type", "Regression"].join("\n");
|
|
assert.equal(extractPulseVersion("Unknown", body), null, body);
|
|
assert.equal(classifyV6FeedbackType(body), null, body);
|
|
}
|
|
});
|
|
|
|
test("real declarations after fenced examples remain authoritative", () => {
|
|
const { extractPulseVersion, classifyAdditionalActionableTopics, classifyV6FeedbackType } = triage.internals;
|
|
for (const fence of ["```", "~~~"]) {
|
|
const body = [fence, "Pulse version: 6.4.1", "### Pulse version", "6.4.1",
|
|
"### Feedback type", "Regression", "### Additional actionable topics", "Copied topic", fence,
|
|
"### Feedback type", "Documentation issue", "### Additional actionable topics", "None",
|
|
"### Pulse version", "6.5.0"].join("\n");
|
|
assert.equal(extractPulseVersion("Upgrade from v6.4.5", body), "6.5.0", body);
|
|
assert.equal(classifyV6FeedbackType(body), "documentation", body);
|
|
assert.equal(classifyAdditionalActionableTopics(body), false, body);
|
|
}
|
|
});
|
|
|
|
test("indented log fields cannot declare a legacy version", () => {
|
|
for (const indent of [" ", "\t"]) {
|
|
const body = `${indent}Pulse version: 6.4.1\n${indent}Agent version: 6.4.1\n`;
|
|
assert.equal(triage.internals.extractPulseVersion("No declared version", body), null, body);
|
|
assert.equal(triage.internals.extractPulseVersion("Bug on v6.5.0", body), "6.5.0", body);
|
|
}
|
|
});
|
|
|
|
test("real version fields preserve fenced values without borrowing later evidence", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
for (const field of ["### Pulse version", "Pulse | Version"]) {
|
|
for (const fence of ["````", "~~~"]) {
|
|
assert.equal(extractPulseVersion("Upgrade from v6.4.5", [field, `${fence}text`,
|
|
"V6.5.0-rc.1", fence, "### Agent version", "6.4.5"].join("\n")), "6.5.0-rc.1");
|
|
assert.equal(extractPulseVersion("Upgrade from v6.4.5", [field, "unknown", `${fence}text`,
|
|
"Agent version: 6.5.0", fence].join("\n")), null);
|
|
assert.equal(extractPulseVersion("Upgrade from v6.4.5", [field, "6.4", `${fence}text`,
|
|
"6.5.0", fence].join("\n")), null);
|
|
}
|
|
}
|
|
});
|
|
|
|
test("structured product-named versions remain declared evidence", () => {
|
|
assert.equal(triage.internals.extractPulseVersion("Bug",
|
|
"### Pulse version\nPulse v6.4.5-beta.1\n### Agent version\n6.4.5"), "6.4.5-beta.1");
|
|
assert.equal(triage.internals.extractPulseVersion("Bug",
|
|
"### Pulse version\nConfirmed on a modified main build around v6.4.5-rc.2\n"), null);
|
|
});
|
|
|
|
test("fenced headings do not truncate genuine secondary topics", () => {
|
|
const body = ["### Additional actionable topics", "The generated command also needs review:",
|
|
"```markdown", "### Pulse version", "A heading in the example, not a new field.", "```",
|
|
"The command must preserve both mounts.", "### Pulse version", "6.5.0"].join("\n");
|
|
assert.equal(triage.internals.classifyAdditionalActionableTopics(body), true);
|
|
});
|
|
|
|
test("feedback keeps its selected value separate from fenced examples", () => {
|
|
const body = ["### Feedback type", "Documentation issue", "```text", "Regression example",
|
|
"### Pulse version", "6.4.1", "```", "### Pulse version", "6.5.0"].join("\n");
|
|
assert.equal(triage.internals.classifyV6FeedbackType(body), "documentation");
|
|
assert.equal(triage.internals.extractPulseVersion("Bug", body), "6.5.0");
|
|
});
|
|
|
|
test("syncLabels cannot classify copied issue templates or disturb Community state", async () => {
|
|
const { github, calls } = createGithub();
|
|
const issue = { number: 2806, title: "Documentation wording",
|
|
body: "```markdown\n### Feedback type\nBug / regression\n### Pulse version\n6.4.1\n" +
|
|
"### Additional actionable topics\nCopied example\n```\n",
|
|
labels: ["enhancement", "needs-retest-on-latest", "needs-human", "needs-decomposition"]
|
|
.map(name => ({ name })) };
|
|
await syncLabels({ github, core: createCore(), context: createContext({ issue }) });
|
|
assert.deepEqual(calls.addLabels, []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
assert.deepEqual(calls.getIssue.map(call => call.issue_number), [2806]);
|
|
});
|
|
|
|
test("syncLabels keeps structured unknown separate from a quoted agent version", async () => {
|
|
const { github, calls } = createGithub();
|
|
const issue = { number: 2807, title: "Upgrade from v6.4.5",
|
|
body: "### Pulse version\nunknown\n```text\nAgent version: 6.5.0\n```\n",
|
|
labels: ["bug", "needs-retest-on-latest", "needs-decomposition", "operator-reviewed"]
|
|
.map(name => ({ name })) };
|
|
await syncLabels({ github, core: createCore(), context: createContext({ issue }) });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["needs-version-info"]]);
|
|
assert.deepEqual(calls.createLabel.map(call => call.name), ["needs-version-info"]);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
});
|
|
|
|
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("bug and pre-release forms accept truthful evidence for installs that never started", () => {
|
|
const templateDir = path.resolve(__dirname, "../ISSUE_TEMPLATE");
|
|
for (const name of ["bug_report.yml", "v6_rc_feedback.yml"]) {
|
|
const form = fs.readFileSync(path.join(templateDir, name), "utf8");
|
|
assert.match(form, /id: pulse_version[\s\S]*?failed install[\s\S]*?"unknown"/);
|
|
assert.match(form, /id: installer_source[\s\S]*?Installer or helper source[\s\S]*?required: false/);
|
|
assert.match(form, /Do not paste a command containing a token or other secret/);
|
|
assert.match(form, /for an install that never started/);
|
|
}
|
|
});
|
|
|
|
test("both bug forms keep an optional failed-upgrade timeline without unsafe collection", () => {
|
|
for (const name of ["bug_report.yml", "v6_rc_feedback.yml"]) {
|
|
const form = fs.readFileSync(path.resolve(__dirname, "../ISSUE_TEMPLATE", name), "utf8");
|
|
const timeline = fieldGuidance(form, "upgrade_context");
|
|
assert.ok(timeline, name);
|
|
assert.match(timeline, /label: Upgrade attempt and recovery/);
|
|
assert.match(timeline, /required: false/);
|
|
for (const distinction of [
|
|
"starting version, intended version or asset", "original time and timezone",
|
|
"last recorded updater/installer result or exit code",
|
|
"whole LXC, VM or host stopping", "recovery you already performed",
|
|
"A verified download signature is not a completed upgrade",
|
|
"a later boot does not explain the stop",
|
|
"Today's running version does not establish the version at failure",
|
|
'blank or "unknown" is valid', "not full journals",
|
|
"Do not rerun the update, reboot, restore, run Diagnostics or delete rollback backups",
|
|
"Keep backups private and preserve the original evidence",
|
|
]) {
|
|
assert.ok(timeline.includes(distinction), `${name}: ${distinction}`);
|
|
}
|
|
const version = form.split(" id: pulse_version\n")[1].split(" - type: ")[0];
|
|
assert.match(version, /Version running when the problem occurred, or "unknown"/);
|
|
assert.match(version, /target and later recovered version separate/);
|
|
}
|
|
});
|
|
|
|
test("bug and pre-release forms accept unsafe one-off failures without a second run", () => {
|
|
const templateDir = path.resolve(__dirname, "../ISSUE_TEMPLATE");
|
|
for (const name of ["bug_report.yml", "v6_rc_feedback.yml"]) {
|
|
const form = fs.readFileSync(path.join(templateDir, name), "utf8");
|
|
assert.match(form, /do not repeat/i);
|
|
assert.match(form, /original sequence/i);
|
|
assert.match(form, /second reproduction is not required/);
|
|
assert.match(form, /data loss, an outage, duplicate changes, or excessive notifications/);
|
|
}
|
|
});
|
|
|
|
test("pre-release evidence keeps screenshots visible and asks only running containers for image identity", () => {
|
|
const form = fs.readFileSync(
|
|
path.resolve(__dirname, "../ISSUE_TEMPLATE/v6_rc_feedback.yml"),
|
|
"utf8"
|
|
);
|
|
assert.match(form, /id: image_ref[\s\S]*?For a running Docker, Compose, or Kubernetes container/);
|
|
assert.match(form, /id: image_ref[\s\S]*?Leave blank for LXC, bare metal, and failed installs/);
|
|
assert.match(form, /for a running container I also gave its Pulse image tag or digest/);
|
|
const evidenceField = form.split(" id: evidence\n")[1].split(" - type: checkboxes\n")[0];
|
|
assert.match(evidenceField, /Attach screenshots or paste relevant redacted logs/);
|
|
assert.doesNotMatch(evidenceField, /render:/);
|
|
});
|
|
|
|
for (const name of ["bug_report.yml", "v6_rc_feedback.yml"]) {
|
|
test(`report intake collection safety: ${name}`, () => {
|
|
const form = fs.readFileSync(path.resolve(__dirname, "../ISSUE_TEMPLATE", name), "utf8");
|
|
const introduction = form.split(" - type: markdown\n")[1].split(" - type: ")[0];
|
|
assert.match(introduction, /Run Diagnostics.*live API and guest-agent requests/);
|
|
assert.match(introduction, /do not run it during backups, freeze\/thaw or an unresponsive-host incident/);
|
|
assert.match(introduction, /Prefer existing observations/);
|
|
assert.match(introduction, /downloads that result without running checks again/);
|
|
assert.doesNotMatch(introduction, /Export for GitHub \(sanitized\)/);
|
|
});
|
|
}
|
|
|
|
for (const name of ["bug_report.yml", "v6_rc_feedback.yml"]) {
|
|
test(`report intake excludes unreleased branch-tip guidance: ${name}`, () => {
|
|
const form = fs.readFileSync(path.resolve(__dirname, "../ISSUE_TEMPLATE", name), "utf8");
|
|
// Safety instructions must remain self-contained for installed versions.
|
|
// A main/master link can describe runtime behaviour they do not ship.
|
|
assert.doesNotMatch(form, /https:\/\/github\.com\/[^/\s)]+\/[^/\s)]+\/(?:blob|tree)\/(?:main|master)\//);
|
|
assert.match(form, /only collect diagnostics if Pulse is running and collection is safe/);
|
|
assert.match(form, /downloads that result without running checks again/);
|
|
assert.match(form, /Review files and screenshots locally before posting/);
|
|
});
|
|
}
|
|
|
|
for (const [name, field] of [
|
|
["bug_report.yml", "logs"],
|
|
["v6_rc_feedback.yml", "evidence"],
|
|
["feature_request.yml", "additional_context"],
|
|
]) {
|
|
test(`report intake privacy at attachment point: ${name}`, () => {
|
|
const form = fs.readFileSync(path.resolve(__dirname, "../ISSUE_TEMPLATE", name), "utf8");
|
|
const introduction = form.split(" - type: markdown\n")[1].split(" - type: ")[0];
|
|
const attachment = form.split(` id: ${field}\n`)[1].split(" - type: ")[0];
|
|
assert.match(introduction, /Anything you attach here is public/);
|
|
assert.match(introduction, /even when an export is labelled "sanitized"/);
|
|
for (const sensitive of ["session cookies", "secret URLs", "private host", "personal details", "errors", ".env", "private keys", "Copy as cURL", "full network exports"]) {
|
|
assert.ok(introduction.includes(sensitive), `${name} must warn about ${sensitive}`);
|
|
}
|
|
assert.match(attachment, /Review files and screenshots locally/);
|
|
assert.match(attachment, /identifying details.*errors/);
|
|
assert.doesNotMatch(attachment, /render:/);
|
|
assert.doesNotMatch(attachment, /required: true/);
|
|
});
|
|
}
|
|
|
|
for (const [name, field] of [
|
|
["bug_report.yml", "logs"],
|
|
["v6_rc_feedback.yml", "evidence"],
|
|
]) {
|
|
const evidenceField = () => {
|
|
const form = fs.readFileSync(path.resolve(__dirname, "../ISSUE_TEMPLATE", name), "utf8");
|
|
return fieldGuidance(form, field);
|
|
};
|
|
|
|
test(`performance report measurement context stays optional: ${name}`, () => {
|
|
const attachment = evidenceField();
|
|
assert.match(attachment, /For CPU, memory or disk-write reports/);
|
|
assert.match(attachment, /existing readings or safe, passive observations/);
|
|
assert.match(attachment, /Pulse process, its container or the whole host/);
|
|
for (const context of ["units", "measurement window", "uptime", "allocated CPUs", "memory limit", "fleet size", "polling interval", "open dashboards"]) {
|
|
assert.ok(attachment.includes(context), `${name} must distinguish ${context}`);
|
|
}
|
|
assert.match(attachment, /where relevant and known/);
|
|
assert.match(attachment, /process-start CPU average is not a recent sampling window/);
|
|
assert.match(attachment, /database size is not a write rate/);
|
|
assert.match(attachment, /Existing screenshots are useful/);
|
|
assert.match(attachment, /write "unavailable" when safe collection is not possible/);
|
|
assert.doesNotMatch(attachment, /required: true|render:/);
|
|
});
|
|
|
|
test(`performance report attachment safety: ${name}`, () => {
|
|
const attachment = evidenceField();
|
|
assert.match(attachment, /Do not restart, create load or change polling or retention just to measure/);
|
|
assert.match(attachment, /Do not attach raw profiles, heap dumps, databases or full process command lines/);
|
|
assert.match(attachment, /summarise only relevant counters after local review/);
|
|
});
|
|
|
|
test(`baseline memory regressions need no continuing growth or restart: ${name}`, () => {
|
|
const attachment = evidenceField();
|
|
assert.match(attachment, /higher steady baseline from growth during one uninterrupted run/);
|
|
assert.match(attachment, /worth reporting even if usage stays flat/);
|
|
assert.match(attachment, /already available versions, uptime, workload and enabled collectors\/features/);
|
|
assert.match(attachment, /not proof of recovery compared with a days-old run/);
|
|
assert.match(attachment, /Unknown context is valid/);
|
|
assert.match(attachment, /do not restart, downgrade or change features to create a comparison/);
|
|
assert.doesNotMatch(attachment, /required: true|render:/);
|
|
});
|
|
|
|
test(`guest memory comparisons retain optional target and sample context: ${name}`, () => {
|
|
const attachment = evidenceField();
|
|
assert.match(attachment, /For CPU, memory or disk-write reports about Pulse itself/);
|
|
const guest = attachment.split("For VM or LXC memory disagreements,")[1];
|
|
assert.ok(guest, "guest readings must not inherit Pulse process-only guidance");
|
|
assert.match(guest, /overview, History, alert, Patrol or another tool/);
|
|
assert.match(guest, /inside the affected guest or on its hypervisor node/);
|
|
assert.match(guest, /original times, units and memory source or sample age only if already known or displayed/);
|
|
assert.match(guest, /consistent private aliases.*"unknown" for missing details/);
|
|
assert.match(guest, /Available memory, buff\/cache and a process's RSS measure different things/);
|
|
assert.match(guest, /RSS alone is not total guest usage/);
|
|
assert.match(guest, /cache-inclusive hypervisor footprint does not establish guest pressure/);
|
|
assert.match(guest, /A Proxmox VM API connection may still obtain QEMU guest-agent \(QGA\) readings without a Pulse agent/);
|
|
assert.doesNotMatch(attachment, /required: true|render:/);
|
|
});
|
|
|
|
test(`guest memory context does not ask for new collection or workload changes: ${name}`, () => {
|
|
const guest = evidenceField().split("For VM or LXC memory disagreements,")[1];
|
|
assert.ok(guest, "a guest comparison needs its own collection boundary");
|
|
assert.match(guest, /Use existing observations only/);
|
|
assert.match(guest, /Do not run commands, Diagnostics or guest-agent probes, install an agent, change memory settings or workloads, or repeat a backup just to answer/);
|
|
});
|
|
}
|
|
|
|
test("guest memory triage preserves original evidence rather than inferring past provenance", () => {
|
|
const guide = fs.readFileSync(path.resolve(__dirname, "../../docs/ISSUE_TRIAGE.md"), "utf8").replace(/\s+/g, " ");
|
|
const guest = guide.split("For VM or LXC memory disagreements,")[1].split("For notification reports,")[0];
|
|
assert.match(guest, /same target and episode/);
|
|
assert.match(guest, /inside the affected guest or on its hypervisor node/);
|
|
assert.match(guest, /original times, units and selected memory source or sample age if already known/);
|
|
assert.match(guest, /unknown is valid, and existing reports need no refile/);
|
|
assert.match(guest, /RSS alone is not total guest usage/);
|
|
assert.match(guest, /A Proxmox VM API connection may still obtain QEMU guest-agent \(QGA\) readings without a Pulse agent/);
|
|
assert.match(guest, /not measured zero or verified recovery/);
|
|
assert.match(guest, /live memory source cannot establish the source of a historical sample/);
|
|
assert.match(guest, /Reconcile the full thread before asking only for a consequential remaining distinction/);
|
|
assert.match(guest, /Do not request commands, Diagnostics or guest-agent probes, an agent install, memory or workload changes, or another backup/);
|
|
});
|
|
|
|
test("performance report triage retains measurement boundaries without demanding unsafe evidence", () => {
|
|
const guide = fs.readFileSync(path.resolve(__dirname, "../../docs/ISSUE_TRIAGE.md"), "utf8");
|
|
assert.match(guide, /Pulse process, container or whole host/);
|
|
assert.match(guide, /process-start CPU average is not a recent window/);
|
|
assert.match(guide, /database\nsize is not a write rate/);
|
|
assert.match(guide, /without making new collection a condition of reporting/);
|
|
assert.match(guide, /Do not request raw\nprofiles, heap dumps, databases or full process command lines/);
|
|
});
|
|
|
|
test("older-version reports cannot trigger event or scheduled retest posting", async () => {
|
|
const issue = {
|
|
number: 1200,
|
|
title: "Upgrade regression",
|
|
body: "## Feedback type\nRegression\n\n## Pulse version\n6.3.1\n",
|
|
labels: [{ name: "bug" }],
|
|
author_association: "NONE",
|
|
created_at: "2026-09-08T08:55:00Z",
|
|
};
|
|
const { github, calls } = createGithub({ latestVersion: "6.4.1", issues: [issue] });
|
|
const args = { github, context: createContext({ issue }), core: createCore() };
|
|
await triage.postRetestComment(args);
|
|
assert.deepEqual(await triage.postEligibleRetestComments({
|
|
...args, nowMs: Date.parse("2026-09-08T09:01:00Z"),
|
|
}), { eligibleCount: 0, postedCount: 0 });
|
|
// Retirement must not merely shift the public write to a different API.
|
|
for (const values of Object.values(calls)) assert.equal(values.length, 0);
|
|
});
|
|
|
|
test("label sync preserves community-owned retest state regardless of version", async () => {
|
|
for (const version of ["6.3.1", "6.4.1", "_No response_"]) {
|
|
const { github, calls } = createGithub({ latestVersion: "6.4.1" });
|
|
await syncLabels({
|
|
github, core: createCore(),
|
|
context: createContext({ issue: {
|
|
number: 1200, title: "Bug", body: `## Pulse version\n${version}\n`,
|
|
labels: [{ name: "bug" }, { name: "needs-retest-on-latest" }],
|
|
} }),
|
|
});
|
|
assert.ok(!calls.addLabels[0].labels.includes("needs-retest-on-latest"));
|
|
assert.ok(!calls.removeLabel.some(call => call.name === "needs-retest-on-latest"));
|
|
assert.equal(calls.createComment.length, 0);
|
|
}
|
|
});
|
|
|
|
test("postRetestComment skips reopened issues", async () => {
|
|
const { github, calls } = createGithub({ latestVersion: "6.0.1" });
|
|
const issue = {
|
|
number: 1471,
|
|
title: "Disk temperature at 0°C",
|
|
body: "## Feedback type\nBug / regression\n\n## Pulse version\n5.1.31\n",
|
|
labels: [],
|
|
author_association: "NONE",
|
|
};
|
|
|
|
await triage.postRetestComment({
|
|
github,
|
|
context: createContext({ action: "reopened", issue }),
|
|
core: createCore(),
|
|
});
|
|
|
|
assert.equal(calls.createComment.length, 0);
|
|
});
|
|
|
|
test("postRetestComment skips maintainer-authored issues", async () => {
|
|
const { github, calls } = createGithub({ latestVersion: "6.0.1" });
|
|
const issue = {
|
|
number: 1300,
|
|
title: "Maintainer split issue on 5.1.9",
|
|
body: "## Feedback type\nBug / regression\n\n## Pulse version\n5.1.9\n",
|
|
labels: [],
|
|
author_association: "OWNER",
|
|
};
|
|
|
|
await triage.postRetestComment({
|
|
github,
|
|
context: createContext({ action: "opened", issue }),
|
|
core: createCore(),
|
|
});
|
|
|
|
assert.equal(calls.createComment.length, 0);
|
|
});
|
|
|
|
test("normalizeVersion accepts a capitalised V prefix", () => {
|
|
const { normalizeVersion } = triage.internals;
|
|
|
|
// Regression: issue #1538 reported "V6.0.4" under the "Pulse version"
|
|
// heading and was wrongly labelled needs-version-info. The heading regexes
|
|
// are case-insensitive and captured "V6.0.4" correctly, but handed it to a
|
|
// case-sensitive normalizeVersion, so every extraction path returned null.
|
|
assert.equal(normalizeVersion("V6.0.4"), "6.0.4");
|
|
assert.equal(normalizeVersion("v6.0.4"), "6.0.4");
|
|
assert.equal(normalizeVersion("6.0.4"), "6.0.4");
|
|
assert.equal(normalizeVersion("V6.1.0-rc.4"), "6.1.0-rc.4");
|
|
|
|
assert.equal(normalizeVersion("V6"), null);
|
|
assert.equal(normalizeVersion("### Pulse version"), null);
|
|
});
|
|
|
|
test("extractPulseVersion reads a capitalised version under its heading", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
|
|
assert.equal(
|
|
extractPulseVersion("[Bug]: something broke", "### Pulse version\nV6.0.4\n"),
|
|
"6.0.4"
|
|
);
|
|
});
|
|
|
|
test("structured Pulse version never falls back to an upgrade source or agent version", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
for (const version of ["6.4", "6", "_No response_", ""]) {
|
|
assert.equal(extractPulseVersion(
|
|
"[Bug]: upgrade from rcourtman/pulse:v5.1.35 to rcourtman/pulse:6 failed",
|
|
`### Pulse version\n\n${version}\n\n### Agent version\n5.1.30\n`,
|
|
), null);
|
|
}
|
|
assert.equal(extractPulseVersion("upgrade from v5.1.35", "### Pulse version\r\n\r\nV6.4.1\r\n\r\n### Agent version\r\n5.1.30"), "6.4.1");
|
|
assert.equal(extractPulseVersion("bug on v6.4.1", "legacy free-form report"), "6.4.1");
|
|
assert.equal(extractPulseVersion("bug on v5.1.35", "### Pulse version"), null);
|
|
});
|
|
|
|
test("legacy version fields keep unknown and incomplete values authoritative", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
for (const field of ["Pulse version:", "**Pulse Version:**", "Pulse | Version", "## Pulse - Version"]) {
|
|
for (const value of ["unknown", "_No response_", "6.4", "6"]) {
|
|
for (const neighbour of ["### Agent version\n6.5.0", "Operating system: Debian 13.0.0"]) {
|
|
const body = `${field}\n${value}\n\n${neighbour}`;
|
|
assert.equal(extractPulseVersion("upgrade from v6.4.5", body), null, body);
|
|
}
|
|
}
|
|
}
|
|
for (const value of ["unknown", "6.4", "_No response_"]) {
|
|
assert.equal(extractPulseVersion("upgrade from v6.4.5", `Pulse version: ${value}; Agent version 6.5.0`), null);
|
|
}
|
|
});
|
|
|
|
test("legacy version fields stop at their first visible value", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
for (const value of [
|
|
"### Agent version\n6.5.0",
|
|
"Agent version: 6.5.0",
|
|
"**OS / environment:** Debian 13.0.0",
|
|
"Agent version\n6.5.0",
|
|
"Not available; the agent runs 6.5.0",
|
|
"```text\nunknown\n```\n### Agent version\n6.5.0",
|
|
"",
|
|
]) {
|
|
assert.equal(extractPulseVersion("upgrade from v6.4.5", `Pulse | Version\n\n${value}`), null, value);
|
|
}
|
|
// Prose mentioning a field is not itself a version declaration.
|
|
assert.equal(extractPulseVersion("Bug", "I cannot find the Pulse version.\nAgent version: 6.5.0"), null);
|
|
});
|
|
|
|
test("legacy version extraction ignores hidden template versions and headings", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
assert.equal(extractPulseVersion("install", "Pulse version: unknown <!-- example: v6.4.5 -->"), null);
|
|
assert.equal(extractPulseVersion("upgrade from v6.4.5", "<!-- ### Pulse version\n6.4.5 -->\nPulse version: unknown"), null);
|
|
assert.equal(extractPulseVersion("Bug", "Pulse | Version\n<!-- example\n6.4.5\n-->\nV6.5.0-rc.1"), "6.5.0-rc.1");
|
|
assert.equal(extractPulseVersion("Bug", "<!-- ### Pulse version\n6.4.5 -->\n**Pulse Version:** 6.5.0"), "6.5.0");
|
|
});
|
|
|
|
test("legacy version formats still classify actual version values", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
for (const body of [
|
|
"Pulse version: V6.5.0-rc.1",
|
|
"**Pulse Version:** `v6.5.0-rc.1`",
|
|
"- **Pulse version**: 6.5.0-rc.1",
|
|
"Pulse | Version\n\nV6.5.0-rc.1\nAgent version: 6.4.5",
|
|
"## Pulse - Version\r\n\r\n```text\r\n6.5.0-rc.1\r\n```\r\n",
|
|
"Pulse version: rcourtman/pulse:6.5.0-rc.1",
|
|
"Pulse | Version\n`rcourtman/pulse:6.5.0-rc.1`",
|
|
]) {
|
|
assert.equal(extractPulseVersion("upgrade from v6.4.5", body), "6.5.0-rc.1", body);
|
|
}
|
|
});
|
|
|
|
test("legacy joint server-agent versions remain reporter evidence", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
const body = "**Pulse version:** server + pulse-agent v6.3.2 (Docker, `rcourtman/pulse:v6.3.2`)\n**Host OS:** Unraid 7.3.2\n**Agent:** Unified Agent v6.3.2, x86_64";
|
|
assert.equal(extractPulseVersion("[Bug]: Unraid missing disks", body), "6.3.2");
|
|
assert.equal(extractPulseVersion("Bug", "Pulse version: server V6.5.0"), "6.5.0");
|
|
assert.equal(extractPulseVersion("Bug", "Pulse version: unknown; server + pulse-agent v6.3.2"), null);
|
|
});
|
|
|
|
test("legacy unknown-version sync cannot fabricate release evidence or contact", async () => {
|
|
for (const body of [
|
|
"Pulse version: unknown\n### Agent version\n6.5.0",
|
|
"Pulse | Version\nunknown\nOperating system: Debian 13.0.0",
|
|
"Pulse version: unknown <!-- example: v6.4.5 -->",
|
|
]) {
|
|
const { github, calls } = createGithub();
|
|
const issue = {
|
|
number: 2805, title: "Upgrade from v6.4.5", body,
|
|
labels: ["bug", "needs-retest-on-latest", "needs-decomposition", "operator-reviewed"].map(name => ({ name })),
|
|
};
|
|
await syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["needs-version-info"]]);
|
|
assert.deepEqual(calls.createLabel.map(call => call.name), ["needs-version-info"]);
|
|
assert.equal(calls.removeLabel.length, 0);
|
|
assert.equal(calls.getLatestRelease.length, 0);
|
|
assert.equal(calls.createComment.length, 0);
|
|
}
|
|
});
|
|
|
|
test("legacy known-version sync updates only classification labels", async () => {
|
|
const { github, calls } = createGithub();
|
|
const issue = {
|
|
number: 2805, title: "Upgrade from v6.4.5", body: "**Pulse Version:** 6.5.0",
|
|
labels: ["bug", "affects-6.4.5", "needs-version-info", "needs-retest-on-latest", "needs-decomposition", "operator-reviewed"].map(name => ({ name })),
|
|
};
|
|
await syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["affects-6.5.0"]]);
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name), ["needs-version-info"]);
|
|
assert.equal(calls.getLatestRelease.length, 0);
|
|
assert.equal(calls.createComment.length, 0);
|
|
});
|
|
|
|
test("ambiguous upgrade version requests information without a retest comment", async () => {
|
|
const { github, calls } = createGithub({ latestVersion: "6.4.1" });
|
|
const issue = {
|
|
number: 1913,
|
|
title: "[Bug]: upgrade from rcourtman/pulse:v5.1.35 to rcourtman/pulse:6 failed",
|
|
body: "### Pulse version\n\n6.4\n\n### Agent version\nnone\n",
|
|
labels: [{ name: "bug" }],
|
|
author_association: "NONE",
|
|
};
|
|
const args = { github, context: createContext({ issue }), core: createCore() };
|
|
await syncLabels(args);
|
|
await triage.postRetestComment(args);
|
|
const labels = calls.addLabels.at(-1).labels;
|
|
assert.ok(labels.includes("needs-version-info"));
|
|
assert.ok(!labels.includes("affects-5.1.35"));
|
|
assert.ok(!labels.includes("needs-retest-on-latest"));
|
|
assert.equal(calls.createComment.length, 0);
|
|
});
|
|
|
|
test("queued label sync cannot overwrite newer Community label decisions", async () => {
|
|
for (const communityAdded of [true, false]) {
|
|
const { github } = createGithub();
|
|
const live = new Set(["bug", "affects-6.0.0", "needs-version-info"]);
|
|
if (communityAdded) live.add("needs-retest-on-latest");
|
|
live.add("operator-reviewed");
|
|
github.rest.issues.setLabels = async ({ labels }) => {
|
|
live.clear();
|
|
labels.forEach(label => live.add(label));
|
|
};
|
|
github.rest.issues.addLabels = async ({ labels }) => labels.forEach(label => live.add(label));
|
|
github.rest.issues.removeLabel = async ({ name }) => live.delete(name);
|
|
github.rest.issues.get = async () => ({ data: {
|
|
...github.currentIssue, labels: [...live].map(name => ({ name })),
|
|
} });
|
|
await syncLabels({ github, core: createCore(), context: createContext({ issue: {
|
|
number: 1200, title: "Bug", body: "## Pulse version\n6.0.1\n",
|
|
labels: ["bug", "affects-6.0.0", "needs-version-info",
|
|
...(!communityAdded ? ["needs-retest-on-latest"] : [])].map(name => ({ name })),
|
|
} }) });
|
|
assert.equal(live.has("needs-retest-on-latest"), communityAdded);
|
|
assert.ok(live.has("operator-reviewed"));
|
|
assert.ok(live.has("affects-6.0.1"));
|
|
assert.ok(live.has("affects-6.0.0"));
|
|
assert.ok(!live.has("needs-version-info"));
|
|
}
|
|
});
|
|
|
|
test("missing-version retirement tolerates an absent label but propagates access failures", async () => {
|
|
for (const status of [404, 403]) {
|
|
const { github } = createGithub();
|
|
github.rest.issues.removeLabel = async () => { throw Object.assign(new Error("API failure"), { status }); };
|
|
const run = syncLabels({ github, core: createCore(), context: createContext({ issue: {
|
|
number: 1200, title: "Bug", body: "## Pulse version\n6.0.1\n",
|
|
labels: [{ name: "bug" }, { name: "affects-6.0.0" }, { name: "needs-version-info" }],
|
|
} }) });
|
|
if (status === 404) await assert.doesNotReject(run);
|
|
else await assert.rejects(run, { status: 403 });
|
|
}
|
|
});
|
|
|
|
// Different software versions can coexist in the same upgrade report. Only
|
|
// the affected server field may add an affects-* label; existing labels can
|
|
// reflect separate observations and need whole-thread review before removal.
|
|
test("stable-to-preview intake keeps baseline, agent and platform versions out of labels", async () => {
|
|
for (const [running, expected] of [
|
|
["6.5.0-rc.1", "affects-6.5.0-rc.1"],
|
|
["unknown", "needs-version-info"],
|
|
]) {
|
|
const { github, calls } = createGithub({ latestVersion: "6.5.0" });
|
|
const issue = {
|
|
number: 2400,
|
|
title: "[v6 pre-release]: upgraded from 6.4.5",
|
|
body: [
|
|
"### Feedback type", "Bug / regression",
|
|
"### Pulse version", running,
|
|
"### Last known working Pulse version", "6.4.1",
|
|
"### Agent version", "6.4.5",
|
|
"### Install path", "Upgrade from a stable v6 release",
|
|
"### OS / environment", "Debian 12 / SCALE 26.0.0-BETA.3",
|
|
"### Additional actionable topics", "None",
|
|
].join("\n\n"),
|
|
labels: [],
|
|
};
|
|
await syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
assert.deepEqual(calls.addLabels.flatMap((call) => call.labels).sort(), [expected, "bug"].sort());
|
|
assert.equal(calls.createComment.length, 0);
|
|
}
|
|
});
|
|
|
|
test("interrupted-upgrade targets and recovered versions cannot supply the failing version", async () => {
|
|
for (const [failing, expected] of [
|
|
["6.4.5", "affects-6.4.5"],
|
|
["unknown", "needs-version-info"],
|
|
]) {
|
|
for (const formTitle of ["[Bug]:", "[v6 pre-release]:"]) {
|
|
const { github, calls } = createGithub({ latestVersion: "6.5.0" });
|
|
const bugForm = formTitle === "[Bug]:";
|
|
const issue = {
|
|
number: 2785,
|
|
title: `${formTitle} interrupted upgrade to 6.5.0`,
|
|
body: [
|
|
...(!bugForm ? ["### Feedback type", "Bug / regression"] : []),
|
|
"### Pulse version", failing,
|
|
"### Last known working Pulse version", "6.4.1",
|
|
"### Agent version", "6.5.0",
|
|
"### Upgrade attempt and recovery",
|
|
"Attempt: 6.4.5 → 6.5.0; automatic timer; 6 October 04:20 UTC",
|
|
"Last recorded result: signature verified, then Broken pipe; exit unknown",
|
|
"Observed stop: whole LXC; stop time/cause unknown",
|
|
"Recovery already performed: booted 7 October; current version 6.5.0",
|
|
"### Additional actionable topics", "None",
|
|
].join("\n\n"),
|
|
// GitHub applies the bug form's label; the preview form declares its
|
|
// classification in Feedback type instead. Reproduce both inputs.
|
|
labels: bugForm ? [{ name: "bug" }] : [],
|
|
};
|
|
await syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
assert.deepEqual(calls.addLabels.flatMap((call) => call.labels).sort(),
|
|
(bugForm ? [expected] : [expected, "bug"]).sort());
|
|
assert.equal(calls.createComment.length, 0);
|
|
assert.equal(calls.getLatestRelease.length, 0);
|
|
}
|
|
}
|
|
});
|
|
|
|
test("delayed events classify the current report and labels, not an old version", async () => {
|
|
const eventIssue = {
|
|
number: 2800,
|
|
title: "Bug after upgrade from 6.4.5",
|
|
body: "### Pulse version\nunknown\n",
|
|
labels: [{ name: "bug" }],
|
|
updated_at: "2026-10-08T10:00:00Z",
|
|
};
|
|
const currentIssue = {
|
|
...eventIssue,
|
|
state: "open",
|
|
body: "### Pulse version\n6.5.0\n",
|
|
labels: ["bug", "affects-6.4.5", "needs-version-info",
|
|
"needs-retest-on-latest", "operator-reviewed"].map(name => ({ name })),
|
|
updated_at: "2026-10-08T11:00:00Z",
|
|
};
|
|
const { github, calls } = createGithub({ currentIssue });
|
|
await syncLabels({ github, context: createContext({ issue: eventIssue }), core: createCore() });
|
|
|
|
assert.deepEqual(calls.getIssue, Array(2 + calls.removeLabel.length).fill({ owner: "rcourtman", repo: "Pulse", issue_number: 2800 }));
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["affects-6.5.0"]]);
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name), ["needs-version-info"]);
|
|
assert.equal(calls.getLatestRelease.length, 0);
|
|
assert.equal(calls.createComment.length, 0);
|
|
});
|
|
|
|
test("a delayed declaration cannot restore a cleared decomposition task", async () => {
|
|
const eventIssue = {
|
|
number: 2801,
|
|
title: "Two report topics",
|
|
body: "### Additional actionable topics\nA separate workflow problem\n",
|
|
labels: [],
|
|
updated_at: "2026-10-08T10:00:00Z",
|
|
};
|
|
for (const body of [eventIssue.body, "### Additional actionable topics\nNone\n"]) {
|
|
const { github, calls } = createGithub({ currentIssue: {
|
|
...eventIssue, state: "open", body, updated_at: "2026-10-08T11:00:00Z",
|
|
} });
|
|
await syncLabels({ github, context: createContext({ issue: eventIssue }), core: createCore() });
|
|
assert.equal(calls.addLabels.length, 0);
|
|
assert.equal(calls.removeLabel.length, 0);
|
|
assert.equal(calls.createComment.length, 0);
|
|
}
|
|
});
|
|
|
|
test("current feedback classification supersedes a queued bug declaration", async () => {
|
|
const eventIssue = {
|
|
number: 2802, title: "Feedback", labels: [],
|
|
body: "### Feedback type\nBug / regression\n### Pulse version\n6.4.5\n",
|
|
};
|
|
const { github, calls } = createGithub({ currentIssue: {
|
|
...eventIssue, state: "open",
|
|
body: "### Feedback type\nDocumentation issue\n### Pulse version\n6.5.0\n",
|
|
} });
|
|
await syncLabels({ github, context: createContext({ issue: eventIssue }), core: createCore() });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["documentation"]]);
|
|
assert.equal(calls.removeLabel.length, 0);
|
|
assert.equal(calls.createComment.length, 0);
|
|
});
|
|
|
|
test("a failed current-issue read stops without stale classification or mutation", async () => {
|
|
for (const status of [403, 404, 500]) {
|
|
const { github, calls } = createGithub();
|
|
github.rest.issues.get = async () => {
|
|
throw Object.assign(new Error("Read failed"), { status });
|
|
};
|
|
await assert.rejects(syncLabels({ github, core: createCore(), context: createContext({ issue: {
|
|
number: 2803, title: "Old bug", body: "### Pulse version\n6.4.5\n",
|
|
labels: [{ name: "bug" }],
|
|
} }) }), { status });
|
|
assert.equal(calls.getLabel.length, 0);
|
|
assert.equal(calls.createLabel.length, 0);
|
|
assert.equal(calls.addLabels.length, 0);
|
|
assert.equal(calls.removeLabel.length, 0);
|
|
assert.equal(calls.getLatestRelease.length, 0);
|
|
assert.equal(calls.createComment.length, 0);
|
|
}
|
|
});
|
|
|
|
test("a closed report or pull request receives no issue metadata changes", async () => {
|
|
const eventIssue = {
|
|
number: 2804, title: "Bug", body: "### Pulse version\n6.5.0\n",
|
|
labels: [{ name: "bug" }],
|
|
};
|
|
for (const current of [{ state: "closed" }, { state: "open", pull_request: {} }]) {
|
|
const { github, calls } = createGithub({ currentIssue: { ...eventIssue, ...current } });
|
|
await syncLabels({ github, core: createCore(), context: createContext({ issue: eventIssue }) });
|
|
assert.equal(calls.getLabel.length, 0);
|
|
assert.equal(calls.addLabels.length, 0);
|
|
assert.equal(calls.removeLabel.length, 0);
|
|
assert.equal(calls.getLatestRelease.length, 0);
|
|
assert.equal(calls.createComment.length, 0);
|
|
}
|
|
});
|
|
|
|
test("a mismatched current issue identity fails closed", async () => {
|
|
const { github, calls } = createGithub({ currentIssue: {
|
|
number: 9999, state: "open", title: "Another report",
|
|
body: "### Pulse version\n6.5.0\n", labels: [{ name: "bug" }],
|
|
} });
|
|
await assert.rejects(syncLabels({ github, core: createCore(), context: createContext({ issue: {
|
|
number: 2805, title: "Bug", labels: [{ name: "bug" }],
|
|
} }) }), /Current issue identity did not match/);
|
|
assert.equal(calls.getLabel.length, 0);
|
|
assert.equal(calls.addLabels.length, 0);
|
|
assert.equal(calls.removeLabel.length, 0);
|
|
assert.equal(calls.createComment.length, 0);
|
|
});
|
|
|
|
|
|
test("quoted and multiline inline-code versions cannot replace a legacy declaration", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
for (const newline of ["\n", "\r\n"]) {
|
|
for (const copied of [
|
|
"> Copied old log\nPulse version: 6.4.5",
|
|
"Pasted text: `\nPulse version: 6.4.5\n`",
|
|
"Pasted text: **`\nPulse version: 6.4.5\n`**",
|
|
"- Copied old log\n Pulse version: 6.4.5",
|
|
"<pre>\nPulse version: 6.4.5\n</pre>",
|
|
]) {
|
|
const body = (copied + "\n\nPulse version: **`6.5.0`**").replaceAll("\n", newline);
|
|
assert.equal(extractPulseVersion("Upgrade from v6.4.5", body), "6.5.0", body);
|
|
assert.equal(extractPulseVersion("Bug", copied.replaceAll("\n", newline)), null, copied);
|
|
}
|
|
}
|
|
});
|
|
|
|
test("raw HTML and nested headings cannot declare form metadata", () => {
|
|
const { extractPulseVersion, classifyV6FeedbackType, classifyAdditionalActionableTopics } = triage.internals;
|
|
const fields = "### Pulse version\n6.4.5\n### Feedback type\nBug / regression\n" +
|
|
"### Additional actionable topics\nCopied template text.";
|
|
for (const copied of [
|
|
"<div>\n" + fields + "\n</div>",
|
|
"<pre>\n" + fields + "\n</pre>",
|
|
"<script>\n" + fields + "\n</script>",
|
|
fields.split("\n").map(line => "> " + line).join("\n"),
|
|
"- Copied template\n\n" + fields.split("\n").map(line => " " + line).join("\n"),
|
|
]) {
|
|
assert.equal(extractPulseVersion("No declared version", copied), null, copied);
|
|
assert.equal(classifyV6FeedbackType(copied), null, copied);
|
|
assert.equal(classifyAdditionalActionableTopics(copied), null, copied);
|
|
const body = copied + "\n\n### Pulse version\nunknown\n### Feedback type\nDocumentation issue\n" +
|
|
"### Additional actionable topics\nNone";
|
|
assert.equal(extractPulseVersion("Upgrade from v6.4.5", body), null, body);
|
|
assert.equal(classifyV6FeedbackType(body), "documentation", body);
|
|
assert.equal(classifyAdditionalActionableTopics(body), false, body);
|
|
}
|
|
});
|
|
|
|
test("the actual label consumer keeps copied declarations from changing report or Community state", async () => {
|
|
const { github, calls } = createGithub();
|
|
const issue = { number: 2902, title: "Pasted old installer output",
|
|
body: "> Copied log\nPulse version: 6.4.5\n\n" +
|
|
"<div>\n### Feedback type\nBug / regression\n### Additional actionable topics\nExample\n</div>\n\n" +
|
|
"Pulse version: `6.5.0`",
|
|
labels: ["bug", "affects-6.4.5", "needs-version-info", "needs-retest-on-latest", "needs-human", "operator-reviewed"]
|
|
.map(name => ({ name })) };
|
|
await syncLabels({ github, core: createCore(), context: createContext({ issue }) });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["affects-6.5.0"]]);
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name), ["needs-version-info"]);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
assert.deepEqual(calls.getIssue.map(call => call.issue_number), Array(2 + calls.removeLabel.length).fill(2902));
|
|
});
|
|
|
|
|
|
test("triage workflow prepares and checks the exact parser before writing labels", () => {
|
|
const workflow = fs.readFileSync(path.resolve(__dirname, "../workflows/issue-version-label-sync.yml"), "utf8");
|
|
const install = workflow.indexOf("run: npm ci --ignore-scripts --no-audit --no-fund --prefix .github/scripts");
|
|
const check = workflow.indexOf("run: npm run test:triage --prefix .github/scripts");
|
|
const write = workflow.indexOf("- name: Sync issue version metadata");
|
|
assert.ok(install >= 0 && check > install && write > check);
|
|
assert.match(workflow, /node-version: '24'/);
|
|
assert.match(workflow, /actions\/setup-node@[0-9a-f]{40}/);
|
|
assert.match(workflow, /persist-credentials: false/);
|
|
for (const file of ["package.json", "package-lock.json", "issue-version-triage.test.cjs", "triage-comment-policy.test.cjs"]) {
|
|
assert.ok(workflow.includes(`.github/scripts/${file}`), file);
|
|
}
|
|
assert.ok(workflow.includes("docs/ISSUE_TRIAGE.md"));
|
|
assert.ok(workflow.includes(".github/ISSUE_TEMPLATE"));
|
|
assert.ok(workflow.includes(".github/workflows"));
|
|
assert.doesNotMatch(workflow, /npm install|--ignore-scripts=false|\$\{\{ github\.event\.issue\.body/);
|
|
});
|
|
|
|
test("the standalone triage graph reuses the existing exact parser without transitive or lifecycle additions", () => {
|
|
const manifest = JSON.parse(fs.readFileSync(path.join(__dirname, "package.json"), "utf8"));
|
|
const lock = JSON.parse(fs.readFileSync(path.join(__dirname, "package-lock.json"), "utf8"));
|
|
assert.equal(manifest.private, true);
|
|
assert.deepEqual(manifest.dependencies, { marked: "17.0.6" });
|
|
assert.deepEqual(lock.packages[""].dependencies, manifest.dependencies);
|
|
assert.deepEqual(Object.keys(lock.packages).sort(), ["", "node_modules/marked"]);
|
|
const parser = lock.packages["node_modules/marked"];
|
|
assert.equal(parser.version, manifest.dependencies.marked);
|
|
assert.equal(parser.resolved, "https://registry.npmjs.org/marked/-/marked-17.0.6.tgz");
|
|
assert.match(parser.integrity, /^sha512-/);
|
|
assert.equal(parser.hasInstallScript, undefined);
|
|
assert.equal(parser.dependencies, undefined);
|
|
assert.equal(parser.optionalDependencies, undefined);
|
|
});
|
|
|
|
|
|
// Exercise the real mutation consumer, not just its Markdown classifier. A
|
|
// successful first read cannot authorize a stale write after label preparation.
|
|
for (const [scenario, changes] of [
|
|
["closure", { state: "closed" }],
|
|
["body correction", { body: "### Pulse version\n6.6.0\n" }],
|
|
["title correction", { title: "Corrected report" }],
|
|
["review activity", { updated_at: "2026-10-14T10:01:00Z" }],
|
|
["classification removal", { labels: [] }],
|
|
["human ownership", { labels: [{ name: "bug" }, { name: "needs-human" }] }],
|
|
["pull request", { pull_request: {} }],
|
|
]) {
|
|
test(`label preparation cannot outlive a report's ${scenario}`, async () => {
|
|
const issue = {
|
|
number: 2910, state: "open", title: "Current bug",
|
|
body: "### Pulse version\n6.5.0\n### Additional actionable topics\nA separate History problem\n",
|
|
updated_at: "2026-10-14T10:00:00Z",
|
|
labels: ["bug", "affects-6.4.5", "needs-version-info"].map(name => ({ name })),
|
|
};
|
|
const { github, calls } = createGithub({ currentIssue: structuredClone(issue) });
|
|
const read = github.rest.issues.get;
|
|
github.rest.issues.get = async payload => ({ data: structuredClone((await read(payload)).data) });
|
|
github.rest.issues.getLabel = async ({ name }) => {
|
|
calls.getLabel.push(name);
|
|
github.currentIssue = { ...github.currentIssue, ...structuredClone(changes) };
|
|
return { data: { name } };
|
|
};
|
|
const messages = [];
|
|
await syncLabels({ github, context: createContext({ issue }), core: { info: text => messages.push(text) } });
|
|
assert.equal(calls.getIssue.length, 2 + calls.removeLabel.length);
|
|
assert.equal(calls.addLabels.length, 0);
|
|
assert.equal(calls.removeLabel.length, 0);
|
|
assert.equal(calls.createComment.length, 0);
|
|
assert.equal(calls.getLatestRelease.length, 0);
|
|
assert.equal(calls.paginate.length, 0);
|
|
assert.ok(messages.includes("Issue changed during metadata preparation. Skipping outdated label delta."));
|
|
});
|
|
}
|
|
|
|
test("a non-bug classification also requires a current report before its write", async () => {
|
|
const issue = { number: 2911, state: "open", title: "Feedback", labels: [],
|
|
body: "### Feedback type\nDocumentation issue\n" };
|
|
const { github, calls } = createGithub({ currentIssue: issue });
|
|
const read = github.rest.issues.get;
|
|
github.rest.issues.get = async payload => {
|
|
const result = await read(payload);
|
|
return { data: calls.getIssue.length === 1 ? result.data : { ...issue, state: "closed" } };
|
|
};
|
|
await syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
assert.equal(calls.getIssue.length, 2 + calls.removeLabel.length);
|
|
assert.equal(calls.addLabels.length, 0);
|
|
assert.equal(calls.removeLabel.length, 0);
|
|
});
|
|
|
|
for (const status of [403, 404, 500]) {
|
|
test(`a failed pre-write read (${status}) cannot use the initial snapshot`, async () => {
|
|
const issue = { number: 2912, state: "open", title: "Bug", labels: [{ name: "bug" }],
|
|
body: "### Pulse version\n6.5.0\n" };
|
|
const { github, calls } = createGithub({ currentIssue: issue });
|
|
const read = github.rest.issues.get;
|
|
github.rest.issues.get = async payload => {
|
|
const result = await read(payload);
|
|
if (calls.getIssue.length === 2) throw Object.assign(new Error("Read failed"), { status });
|
|
return result;
|
|
};
|
|
await assert.rejects(syncLabels({ github, context: createContext({ issue }), core: createCore() }), { status });
|
|
assert.equal(calls.getIssue.length, 2 + calls.removeLabel.length);
|
|
assert.equal(calls.addLabels.length, 0);
|
|
assert.equal(calls.removeLabel.length, 0);
|
|
assert.equal(calls.createComment.length, 0);
|
|
});
|
|
}
|
|
|
|
test("a mismatched pre-write issue identity fails closed", async () => {
|
|
const issue = { number: 2913, state: "open", title: "Bug", labels: [{ name: "bug" }],
|
|
body: "### Pulse version\n6.5.0\n" };
|
|
const { github, calls } = createGithub({ currentIssue: issue });
|
|
const read = github.rest.issues.get;
|
|
github.rest.issues.get = async payload => {
|
|
const result = await read(payload);
|
|
return { data: calls.getIssue.length === 1 ? result.data : { ...issue, number: 9999 } };
|
|
};
|
|
await assert.rejects(syncLabels({ github, context: createContext({ issue }), core: createCore() }),
|
|
/Current issue identity did not match/);
|
|
assert.equal(calls.addLabels.length, 0);
|
|
assert.equal(calls.removeLabel.length, 0);
|
|
});
|
|
|
|
test("the pre-write comparison treats label order as irrelevant", async () => {
|
|
const issue = { number: 2914, state: "open", title: "Bug",
|
|
labels: ["bug", "needs-human", "needs-retest-on-latest", "affects-6.4.5"].map(name => ({ name })),
|
|
body: "### Pulse version\n6.5.0\n" };
|
|
const { github, calls } = createGithub({ currentIssue: issue });
|
|
const read = github.rest.issues.get;
|
|
github.rest.issues.get = async payload => {
|
|
const result = await read(payload);
|
|
return { data: { ...result.data, labels: [...result.data.labels].reverse() } };
|
|
};
|
|
await syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["affects-6.5.0"]]);
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name), []);
|
|
});
|
|
|
|
test("a report with no label delta needs no additional pre-write read", async () => {
|
|
const issue = { number: 2915, state: "open", title: "Bug",
|
|
labels: ["bug", "affects-6.5.0", "needs-human"].map(name => ({ name })),
|
|
body: "### Pulse version\n6.5.0\n" };
|
|
const { github, calls } = createGithub({ currentIssue: issue });
|
|
await syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
assert.equal(calls.getIssue.length, 1);
|
|
assert.equal(calls.addLabels.length, 0);
|
|
assert.equal(calls.removeLabel.length, 0);
|
|
});
|
|
|
|
test("unknown current versions preserve affected-version evidence for whole-thread review", async () => {
|
|
const preserved = ["bug", "needs-retest-on-latest", "needs-decomposition",
|
|
"needs-human", "operator-reviewed", "affects-main", "affects-storage"];
|
|
for (const body of [
|
|
"### Pulse version\nunknown\n",
|
|
"Pulse version: unknown; agent version 6.5.0",
|
|
"### Pulse version\n6.5\n### Agent version\n6.5.0",
|
|
"### Pulse version\n_No response_\n",
|
|
"### Pulse version\n\n### Agent version\n6.5.0",
|
|
"The running version is unavailable.",
|
|
]) {
|
|
const { github, calls } = createGithub();
|
|
const issue = { number: 2916, title: "Upgrade from v6.4.5", body,
|
|
labels: [...preserved, "affects-6.4.5", "affects-6.6.0-beta.3"].map(name => ({ name })) };
|
|
await syncLabels({ github, context: createContext({ action: "edited", issue }), core: createCore() });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["needs-version-info"]], body);
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name), [], body);
|
|
assert.equal(calls.getIssue.length, 2 + calls.removeLabel.length);
|
|
assert.equal(calls.getLatestRelease.length, 0);
|
|
assert.equal(calls.createComment.length, 0);
|
|
}
|
|
});
|
|
|
|
test("a delayed known-version event leaves already unknown metadata and affected versions alone", async () => {
|
|
const eventIssue = { number: 2917, title: "Bug", body: "### Pulse version\n6.4.5\n",
|
|
labels: [{ name: "bug" }, { name: "affects-6.4.5" }] };
|
|
const { github, calls } = createGithub({ currentIssue: {
|
|
...eventIssue, state: "open", body: "### Pulse version\nunknown\n",
|
|
updated_at: "2026-10-14T11:00:00Z",
|
|
labels: [...eventIssue.labels, { name: "needs-retest-on-latest" }, { name: "needs-version-info" }],
|
|
} });
|
|
await syncLabels({ github, context: createContext({ action: "edited", issue: eventIssue }), core: createCore() });
|
|
assert.equal(calls.addLabels.length, 0);
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name), []);
|
|
assert.equal(calls.getIssue.length, 1, "an already classified unknown version has no metadata delta");
|
|
assert.equal(calls.createComment.length, 0);
|
|
});
|
|
|
|
test("an already unknown version needs no write even when affected versions exist", async () => {
|
|
const issue = { number: 2918, title: "Bug", body: "### Pulse version\nunknown\n",
|
|
labels: ["bug", "affects-6.5.0", "needs-version-info"].map(name => ({ name })) };
|
|
const { github, calls } = createGithub();
|
|
github.rest.issues.getLabel = async () => {
|
|
github.currentIssue = { ...github.currentIssue, body: "### Pulse version\n6.5.0\n" };
|
|
return { data: {} };
|
|
};
|
|
await syncLabels({ github, context: createContext({ action: "edited", issue }), core: createCore() });
|
|
assert.equal(calls.getIssue.length, 1);
|
|
assert.equal(calls.addLabels.length, 0);
|
|
assert.equal(calls.removeLabel.length, 0);
|
|
});
|
|
|
|
test("unknown versions do not remove metadata from non-bug feedback", async () => {
|
|
const { github, calls } = createGithub();
|
|
const issue = { number: 2919, title: "Documentation", body: "### Pulse version\nunknown\n",
|
|
labels: ["documentation", "affects-6.5.0", "needs-retest-on-latest"].map(name => ({ name })) };
|
|
await syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
assert.equal(calls.addLabels.length, 0);
|
|
assert.equal(calls.removeLabel.length, 0);
|
|
assert.equal(calls.getIssue.length, 1);
|
|
});
|
|
|
|
test("already unknown-version metadata is a no-op without an extra live read", async () => {
|
|
const { github, calls } = createGithub({ existingLabels: new Set(["needs-version-info"]) });
|
|
const issue = { number: 2920, title: "Bug", body: "### Pulse version\nunknown\n",
|
|
labels: ["bug", "needs-version-info", "needs-human", "affects-main"].map(name => ({ name })) };
|
|
await syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
assert.equal(calls.addLabels.length, 0);
|
|
assert.equal(calls.removeLabel.length, 0);
|
|
assert.equal(calls.getIssue.length, 1);
|
|
});
|
|
|
|
test("attempted server archives separate release versions from packaging", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
for (const version of ["6.5.0", "6.5.0-rc.1", "6.6.0-beta.3", "6.6.0-dev.branch-2"]) {
|
|
for (const filename of [
|
|
...["386", "amd64", "arm64", "armv6", "armv7"].map(arch =>
|
|
`pulse-v${version}-linux-${arch}.tar.gz`),
|
|
`pulse-v${version}.tar.gz`,
|
|
`pulse-${version}.tgz`,
|
|
]) {
|
|
for (const body of [
|
|
`### Pulse version\n${filename}\n### Agent version\nnone`,
|
|
`Pulse version: **\`${filename}\`**`,
|
|
]) {
|
|
assert.equal(extractPulseVersion("Failed install", body), version, filename);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
test("non-server artifacts cannot supply an attempted server version", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
for (const filename of [
|
|
"pulse-agent-v6.6.0-beta.3-linux-amd64.tar.gz",
|
|
"pulse-agent-helper-v6.6.0-beta.3-linux-amd64.tar.gz",
|
|
"pulse-agent-runner-v6.6.0-beta.3-linux-amd64.tar.gz",
|
|
"pulse-mcp-v6.6.0-beta.3-windows-amd64.zip",
|
|
"pulse-provider-msp-v6.6.0-beta.3.tar.gz",
|
|
"pulse-v6.6.0-beta.3-linux-amd64.tar.gz.sha256",
|
|
"pulse-v6.6.0-beta.3-linux-amd64.tar.gz.sig",
|
|
"pulse-v6.6.0-beta.3-linux-amd64.tar.gz.sshsig",
|
|
"pulse-v6.6.0-beta.3-release.sbom.spdx.json.sha256",
|
|
"install.sh",
|
|
]) {
|
|
assert.equal(extractPulseVersion("Upgrade from v6.4.5",
|
|
`### Pulse version\n${filename}\n### Agent version\n6.5.0`), null, filename);
|
|
}
|
|
});
|
|
|
|
test("Pro server artifacts retain their declared version without borrowing agent evidence", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
for (const version of ["6.5.0", "6.6.0-beta.3", "6.6.0-rc.6"]) {
|
|
for (const artifact of [
|
|
`pulse-pro-v${version}-linux-amd64.tar.gz`,
|
|
`pulse-pro-v${version}-linux-arm64.tar.gz`,
|
|
`license.pulserelay.pro/pulse-pro:${version}`,
|
|
]) {
|
|
for (const value of [artifact, `**\`${artifact}\`**`, `[${artifact}](https://example.invalid/6.4.5)`]) {
|
|
for (const field of ["### Pulse version\n", "Pulse version: ", "- **Pulse version**: "]) {
|
|
for (const newline of ["\n", "\r\n"]) {
|
|
const body = `${field}${value}\n\n### Agent version\n6.4.5`.replaceAll("\n", newline);
|
|
assert.equal(extractPulseVersion("Upgrade from v6.4.5", body), version, body);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
for (const value of [
|
|
"pulse-pro-agent-v6.6.0-rc.6-linux-amd64.tar.gz",
|
|
"pulse-pro-v6.6.0-rc.6-linux-amd64.tar.gz.sshsig",
|
|
"pulse-pro-v6.6.0-rc.6-linux-amd64.tar.gz.sha256",
|
|
"pulse-pro-v6.6.0-rc.6-linux-amd64.tar.gz.sig",
|
|
"unknown; downloaded pulse-pro-v6.6.0-rc.6-linux-amd64.tar.gz",
|
|
"[unknown](https://example.invalid/pulse-pro-v6.6.0-rc.6-linux-amd64.tar.gz)",
|
|
]) {
|
|
assert.equal(extractPulseVersion("Upgrade from v6.4.5",
|
|
`### Pulse version\n${value}\n### Agent version\n6.4.5`), null, value);
|
|
}
|
|
});
|
|
|
|
for (const value of [
|
|
"pulse-pro-v6.6.0-rc.6-linux-amd64.tar.gz",
|
|
"pulse-pro-v6.6.0-rc.6-linux-arm64.tar.gz",
|
|
"license.pulserelay.pro/pulse-pro:6.6.0-rc.6",
|
|
]) {
|
|
test(`Pro server intake updates only silent version metadata: ${value}`, async () => {
|
|
const { github, calls } = createGithub();
|
|
const issue = { number: 2923, title: "Failed install", labels: [
|
|
"bug", "affects-6.4.5", "needs-version-info", "needs-human", "release-blocker",
|
|
"needs-decomposition", "needs-retest-on-latest",
|
|
].map(name => ({ name })),
|
|
body: `### Pulse version\n${value}\n### Agent version\n6.4.5` };
|
|
await syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["affects-6.6.0-rc.6"]]);
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name), ["needs-version-info"]);
|
|
assert.deepEqual(calls.createLabel.map(call => call.name), ["affects-6.6.0-rc.6"]);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
assert.equal(calls.getIssue.length, 2 + calls.removeLabel.length);
|
|
});
|
|
}
|
|
|
|
test("archive recognition neither borrows a later filename nor shortens bare prereleases", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
assert.equal(extractPulseVersion("Upgrade from v6.4.5",
|
|
"### Pulse version\nunknown; downloaded pulse-v6.6.0-beta.3-linux-amd64.tar.gz"), null);
|
|
for (const version of ["6.6.0-dev.branch-2", "6.6.0-beta.3-linux-amd64", "6.6.0-custom.tgz"]) {
|
|
assert.equal(extractPulseVersion("Bug", `### Pulse version\n${version}`), version);
|
|
}
|
|
});
|
|
|
|
for (const [filename, version] of [
|
|
["pulse-v6.6.0-beta.3-linux-amd64.tar.gz", "6.6.0-beta.3"],
|
|
["pulse-v6.6.0-beta.3-linux-armv7.tar.gz", "6.6.0-beta.3"],
|
|
["pulse-v6.6.0-beta.3.tar.gz", "6.6.0-beta.3"],
|
|
["pulse-6.6.0-beta.3.tgz", "6.6.0-beta.3"],
|
|
["pulse-v6.5.0-linux-amd64.tar.gz", "6.5.0"],
|
|
]) {
|
|
test(`archive intake reconciles exact-version labels silently: ${filename}`, async () => {
|
|
const { github, calls } = createGithub();
|
|
const oldArtifactLabel = `affects-${filename.replace(/^pulse-v?/, "")}`;
|
|
const issue = { number: 2921, title: "[Bug]: Failed install",
|
|
body: `### Pulse version\n${filename}\n### Agent version\nnone`,
|
|
labels: ["bug", "affects-6.4.5", oldArtifactLabel, "needs-version-info", "needs-human",
|
|
"needs-retest-on-latest"].map(name => ({ name })) };
|
|
await syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [[`affects-${version}`]]);
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name),
|
|
["needs-version-info"]);
|
|
assert.deepEqual(calls.createLabel.map(call => call.name), [`affects-${version}`]);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
assert.equal(calls.getIssue.length, 2 + calls.removeLabel.length);
|
|
});
|
|
}
|
|
|
|
test("declared versions use visible release-link text, including nested inline formatting", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
for (const [value, expected] of [
|
|
["[v6.5.0](https://github.com/rcourtman/Pulse/releases/tag/v6.4.5)", "6.5.0"],
|
|
["**[6.5.0](https://github.com/rcourtman/Pulse/releases/tag/v6.5.0)**", "6.5.0"],
|
|
["_[`v6.5.0`](https://github.com/rcourtman/Pulse/releases/tag/v6.5.0)_", "6.5.0"],
|
|
["[6\\.5\\.0](https://github.com/rcourtman/Pulse/releases/tag/v6.5.0)", "6.5.0"],
|
|
["[pulse-v6.6.0-beta.3-linux-amd64.tar.gz](https://github.com/rcourtman/Pulse/releases/tag/v6.6.0-beta.3)", "6.6.0-beta.3"],
|
|
]) {
|
|
for (const body of [
|
|
`### Pulse version\n${value}\n### Agent version\n6.4.5`,
|
|
`Pulse version: ${value}`,
|
|
`- **Pulse version**: ${value}`,
|
|
]) {
|
|
for (const newline of ["\n", "\r\n"]) {
|
|
assert.equal(extractPulseVersion("Upgrade from v6.4.5", body.replaceAll("\n", newline)), expected, body);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
test("formatted field headings retain visible declarations and field boundaries", () => {
|
|
const { classifyAdditionalActionableTopics, classifyV6FeedbackType, extractPulseVersion } = triage.internals;
|
|
for (const format of [
|
|
value => `**${value}**`,
|
|
value => `_${value}_`,
|
|
value => `***${value}***`,
|
|
value => `[${value}](https://example.invalid/ignored "Not a field name")`,
|
|
value => `**[${value}][field]**`,
|
|
value => `${value} <!-- optional hint -->`,
|
|
]) {
|
|
const definitions = '\n\n[field]: https://example.invalid/ignored "Not a field name"';
|
|
for (const newline of ["\n", "\r\n"]) {
|
|
const body = [
|
|
`### ${format("Feedback type")}`, "Documentation issue", "",
|
|
`### ${format("Additional actionable topics")}`, "None", "",
|
|
`### ${format("Logs, screenshots, or diagnostics")}`, "A primary-topic screenshot is supplied here.", "",
|
|
`### ${format("Pulse version")}`, "unknown", "",
|
|
"### Agent version", "6.5.0", definitions,
|
|
].join("\n").replaceAll("\n", newline);
|
|
assert.equal(classifyV6FeedbackType(body), "documentation", body);
|
|
assert.equal(classifyAdditionalActionableTopics(body), false, body);
|
|
assert.equal(extractPulseVersion("v6.4.5 upgrade fails", body), null, body);
|
|
assert.equal(classifyAdditionalActionableTopics(body.replace("\nNone", "\nA second target loses its identity.")), true, body);
|
|
assert.equal(extractPulseVersion("v6.4.5 upgrade fails", body.replace("unknown", "6.6.0")), "6.6.0", body);
|
|
}
|
|
}
|
|
});
|
|
|
|
test("legacy version labels use visible formatting without borrowing a title or agent version", () => {
|
|
for (const label of [
|
|
"_Pulse version_",
|
|
"***Pulse version***",
|
|
'[Pulse version](https://example.invalid/6.4.1 "Agent version")',
|
|
"**[Pulse version][field]**",
|
|
"[Pulse version][]",
|
|
"[Pulse version]",
|
|
]) {
|
|
for (const [value, expected] of [["`6.6.0`", "6.6.0"], ["unknown", null], ["6.6", null]]) {
|
|
for (const field of [`${label}: ${value}`, `- ${label}: ${value}`, `${label}\n\n${value}`]) {
|
|
// A shortcut followed by a colon is a reference definition, not a
|
|
// rendered link label. Its standalone visible form remains covered.
|
|
if (label === "[Pulse version]" && field.includes(":")) continue;
|
|
const body = `${field}\n\n### Agent version\n9.9.9\n\n` +
|
|
"[field]: https://example.invalid/6.4.1\n[Pulse version]: https://example.invalid/6.4.1";
|
|
for (const newline of ["\n", "\r\n"]) {
|
|
assert.equal(triage.internals.extractPulseVersion("[Bug]: 6.4.1 prior image",
|
|
body.replaceAll("\n", newline)), expected, body);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
test("literal or withdrawn legacy labels remain evidence rather than version declarations", () => {
|
|
for (const label of [
|
|
"`Pulse version`",
|
|
"**`Pulse version`**",
|
|
"~~Pulse version~~",
|
|
"",
|
|
'[Context](https://example.invalid/ignored "Pulse version")',
|
|
"<span>Pulse version</span>",
|
|
"<!-- Pulse version -->Context",
|
|
]) {
|
|
for (const field of [`${label}: 6.6.0`, `- ${label}: 6.6.0`]) {
|
|
assert.equal(triage.internals.extractPulseVersion("Unversioned report", field), null, field);
|
|
}
|
|
}
|
|
const field = "[Pulse version](https://example.invalid/6.4.1): 6.6.0";
|
|
for (const body of ["> " + field, "```markdown\n" + field + "\n```", " " + field]) {
|
|
assert.equal(triage.internals.extractPulseVersion("Unversioned report", body), null, body);
|
|
}
|
|
assert.equal(triage.internals.extractPulseVersion("Unversioned report",
|
|
"[Pulse version]: https://example.invalid/6.6.0"), null);
|
|
});
|
|
|
|
test("the silent consumer respects linked legacy versions while preserving Community decisions", async () => {
|
|
for (const [value, additions, removals] of [
|
|
["6.6.0", ["affects-6.6.0"], ["needs-version-info"]],
|
|
["unknown", [], []],
|
|
]) {
|
|
const { github, calls } = createGithub();
|
|
const issue = { number: 42, title: "[Bug]: 6.4.1 prior image",
|
|
body: `- **[Pulse version][field]**: ${value}\n\n### Agent version\n9.9.9\n\n` +
|
|
"[field]: https://example.invalid/6.4.1",
|
|
labels: ["bug", "affects-6.4.1", "needs-version-info", "needs-human", "release-blocker",
|
|
"needs-decomposition", "needs-retest-on-latest"].map(name => ({ name })) };
|
|
await syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), additions.length ? [additions] : []);
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name), removals);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.getEvents, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
assert.equal(calls.getIssue.length, (additions.length ? 2 : 1) + calls.removeLabel.length);
|
|
}
|
|
});
|
|
|
|
test("heading destinations, literal examples and withdrawn text cannot declare fields", () => {
|
|
for (const format of [
|
|
value => `\`${value}\``,
|
|
value => `**\`${value}\`**`,
|
|
value => `~~${value}~~`,
|
|
value => ``,
|
|
value => `[Context](https://example.invalid/ignored "${value}")`,
|
|
value => `<span>${value}</span>`,
|
|
value => `<!-- ${value} -->Context`,
|
|
]) {
|
|
const body = `### ${format("Additional actionable topics")}\nAnother target fails.\n\n` +
|
|
`### ${format("Pulse version")}\n6.5.0\n\n` +
|
|
`### ${format("Feedback type")}\nBug / regression\n`;
|
|
assert.equal(triage.internals.classifyAdditionalActionableTopics(body), null, body);
|
|
assert.equal(triage.internals.classifyV6FeedbackType(body), null, body);
|
|
assert.equal(triage.internals.extractPulseVersion("Unversioned report", body), null, body);
|
|
}
|
|
for (const wrap of [body => `\`\`\`markdown\n${body}\n\`\`\``,
|
|
body => body.split("\n").map(line => `> ${line}`).join("\n"),
|
|
body => `<!--\n${body}\n-->`]) {
|
|
const body = wrap("### **Additional actionable topics**\nAnother target fails.\n\n### _Pulse version_\n6.5.0");
|
|
assert.equal(triage.internals.classifyAdditionalActionableTopics(body), null, body);
|
|
assert.equal(triage.internals.extractPulseVersion("Unversioned report", body), null, body);
|
|
}
|
|
});
|
|
|
|
test("silent metadata consumes formatted headings without losing topics or inventing missing evidence", async () => {
|
|
for (const [topic, expected] of [
|
|
["Another target loses its backup identity.", ["affects-6.6.0", "needs-decomposition"]],
|
|
["None", ["affects-6.6.0"]],
|
|
]) {
|
|
const { github, calls } = createGithub();
|
|
const issue = { number: 42, title: "v6.4.5 upgrade fails",
|
|
body: `### **Additional actionable topics**\n${topic}\n\n` +
|
|
"### _Logs, screenshots, or diagnostics_\nPrimary-topic evidence.\n\n" +
|
|
"### [Pulse version](https://example.invalid/6.4.5)\n6.6.0\n\n### Agent version\n6.4.5",
|
|
labels: ["bug", "affects-6.4.5", "needs-version-info", "needs-human", "release-blocker",
|
|
"needs-retest-on-latest"].map(name => ({ name })) };
|
|
await syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [expected]);
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name), ["needs-version-info"]);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
assert.equal(calls.getIssue.length, 2 + calls.removeLabel.length);
|
|
}
|
|
});
|
|
|
|
test("link targets, titles, images and literal Markdown cannot invent a declared version", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
for (const value of [
|
|
"[unknown](https://github.com/rcourtman/Pulse/releases/tag/v6.5.0)",
|
|
'[unknown](https://github.com/rcourtman/Pulse "6.5.0")',
|
|
"",
|
|
"~~[6.5.0](https://github.com/rcourtman/Pulse/releases/tag/v6.5.0)~~",
|
|
"`[6.5.0](https://github.com/rcourtman/Pulse/releases/tag/v6.5.0)`",
|
|
"<span>6.5.0</span>",
|
|
"[release](https://github.com/rcourtman/Pulse/releases/tag/v6.5.0) 6.4.5",
|
|
"[6.5.0](unterminated",
|
|
]) {
|
|
assert.equal(extractPulseVersion("Upgrade from v6.4.5",
|
|
`### Pulse version\n${value}\n### Agent version\n6.5.0`), null, value);
|
|
}
|
|
});
|
|
|
|
test("the label consumer accepts a linked version without fetching links or contacting the reporter", async () => {
|
|
for (const [visible, expected] of [["**`v6.5.0`**", "6.5.0"], ["unknown", null]]) {
|
|
const { github, calls } = createGithub();
|
|
const issue = { number: 2922, title: "[Bug]: Upgrade from v6.4.5",
|
|
body: `### Pulse version\n[${visible}](https://github.com/rcourtman/Pulse/releases/tag/v6.6.0-rc.5)\n### Agent version\n6.4.5`,
|
|
labels: ["bug", "affects-6.4.5", "needs-version-info", "needs-human", "release-blocker",
|
|
"needs-decomposition", "needs-retest-on-latest"].map(name => ({ name })) };
|
|
await syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), expected ? [["affects-6.5.0"]] : []);
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name), expected
|
|
? ["needs-version-info"] : []);
|
|
assert.deepEqual(calls.createLabel.map(call => call.name), expected ? ["affects-6.5.0"] : ["needs-version-info"]);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
assert.equal(calls.getIssue.length, (expected ? 2 : 1) + calls.removeLabel.length);
|
|
}
|
|
});
|
|
|
|
|
|
test("title fallback cannot borrow a platform or agent release as the Pulse server version", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
for (const title of [
|
|
"[Bug]: vSphere 8.0.3 enrichment fails",
|
|
"[Bug]: TrueNAS SCALE 25.10.3 reconnects",
|
|
"[Bug]: Debian 13.0.0 install failure",
|
|
"[Bug]: pulse-agent 6.5.0 loses disk data",
|
|
"[v6 pre-release]: Pulse agent v6.6.0-rc.6 loses disk data",
|
|
"Pulse unknown; agent 6.5.0 remains connected",
|
|
]) {
|
|
assert.equal(extractPulseVersion(title, "Legacy report without a declared server version."), null, title);
|
|
}
|
|
});
|
|
|
|
test("title fallback retains explicit Pulse and neutral version-leading declarations", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
for (const [title, expected] of [
|
|
["[Bug]: Pulse 6.5.0 loses readings", "6.5.0"],
|
|
["vSphere 8.0.3 enrichment fails in Pulse v6.5.0", "6.5.0"],
|
|
["[Bug]: TrueNAS 25.10.3 in Pulse Pro version: V6.6.0-rc.6", "6.6.0-rc.6"],
|
|
["[Bug]: rcourtman/pulse:6.5.0 loses readings", "6.5.0"],
|
|
["[Bug]: license.pulserelay.pro/pulse-pro:6.6.0-rc.6 loses readings", "6.6.0-rc.6"],
|
|
["v6.4.3-rc.1 (LXC): Pulse degrades", "6.4.3-rc.1"],
|
|
["[Bug]: v6.6.0-rc.6 loses readings", "6.6.0-rc.6"],
|
|
["Bug on v6.5.0", "6.5.0"],
|
|
]) {
|
|
assert.equal(extractPulseVersion(title, "Legacy report."), expected, title);
|
|
assert.equal(extractPulseVersion(title, "### Pulse version\nunknown"), null, title);
|
|
assert.equal(extractPulseVersion(title, "### Pulse version\n6.4.5"), "6.4.5", title);
|
|
}
|
|
assert.equal(extractPulseVersion("Upgrade from Pulse 6.4.5 to Pulse 6.5.0", "Legacy report."), null);
|
|
});
|
|
|
|
test("version-field transitions do not assert a failing source or target release", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
for (const value of [
|
|
"6.5.0 → 6.6.0-rc.1",
|
|
"v6.5.0->v6.6.0-rc.1",
|
|
"6.5.0 => unknown",
|
|
"6.5.0 to latest",
|
|
"6.5.0 → 6.6.0-rc.1",
|
|
"**6.5.0** to **6.6.0-rc.1**",
|
|
"`6.5.0 → 6.6.0-rc.1` (recovered to 6.5.0)",
|
|
"[6.5.0](https://example.invalid/6.4.5) → [6.6.0-rc.1](https://example.invalid/6.4.5)",
|
|
"server 6.5.0 → server 6.6.0-rc.1",
|
|
"rcourtman/pulse:6.5.0 → rcourtman/pulse:6.6.0-rc.1",
|
|
"pulse-pro-v6.5.0-linux-amd64.tar.gz → pulse-pro-v6.6.0-rc.1-linux-amd64.tar.gz",
|
|
]) {
|
|
for (const field of ["### Pulse version\n", "Pulse version: ", "- **Pulse version**: "]) {
|
|
for (const newline of ["\n", "\r\n"]) {
|
|
const body = `${field}${value}\n\n### Agent version\n6.5.0\n\n` +
|
|
"### Upgrade attempt and recovery\nRecovered to 6.5.0; failing executable unknown.";
|
|
assert.equal(extractPulseVersion("Pulse 6.4.5 upgrade failed",
|
|
body.replaceAll("\n", newline)), null, body);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
test("title transitions stay ambiguous without discarding a separately declared failing runtime", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
for (const title of [
|
|
"Pulse 6.5.0 → 6.6.0-rc.1 failed",
|
|
"[Bug]: v6.5.0 to v6.6.0-rc.1 failed",
|
|
"[Bug]: rcourtman/pulse:6.5.0 => rcourtman/pulse:6.6.0-rc.1",
|
|
"6.5.0 → unknown after recovery",
|
|
]) {
|
|
assert.equal(extractPulseVersion(title, "Legacy report."), null, title);
|
|
assert.equal(extractPulseVersion(title, "### Pulse version\n6.6.0-rc.1"), "6.6.0-rc.1", title);
|
|
}
|
|
for (const [value, expected] of [
|
|
["6.6.0-rc.1 (upgraded from 6.5.0)", "6.6.0-rc.1"],
|
|
["6.5.0 to reproduce the backup failure", "6.5.0"],
|
|
["rcourtman/pulse:6.6.0-rc.1; agent 6.5.0", "6.6.0-rc.1"],
|
|
]) {
|
|
assert.equal(extractPulseVersion("Upgrade from v6.4.5", `### Pulse version\n${value}`), expected);
|
|
}
|
|
assert.equal(extractPulseVersion("TrueNAS 25.04.0 → 25.10.0 fails in Pulse 6.5.0",
|
|
"Legacy report."), "6.5.0");
|
|
});
|
|
|
|
test("transition metadata consumer preserves Community state without inferring a release or contacting the reporter", async () => {
|
|
for (const [title, body] of [
|
|
["Upgrade failed", "### Pulse version\n6.5.0 → 6.6.0-rc.1\n### Agent version\n6.5.0"],
|
|
["Pulse 6.5.0 to 6.6.0-rc.1 failed", "Legacy report."],
|
|
]) {
|
|
const { github, calls } = createGithub();
|
|
const issue = { number: 2928, title, body,
|
|
labels: ["bug", "affects-6.5.0", "needs-human", "release-blocker", "needs-decomposition",
|
|
"needs-retest-on-latest", "operator-reviewed"].map(name => ({ name })) };
|
|
await syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["needs-version-info"]]);
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name), []);
|
|
assert.deepEqual(calls.createLabel.map(call => call.name), ["needs-version-info"]);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
assert.equal(calls.getIssue.length, 2 + calls.removeLabel.length);
|
|
}
|
|
});
|
|
|
|
test("title-version label consumer corrects only its own metadata without contact or release inference", async () => {
|
|
for (const [title, body, version] of [
|
|
["[Bug]: vSphere 8.0.3 enrichment fails", "Legacy report.", null],
|
|
["vSphere 8.0.3 enrichment fails in Pulse 6.5.0", "Legacy report.", "6.5.0"],
|
|
["[Bug]: TrueNAS SCALE 25.10.3 reconnects", "### Pulse version\n6.5.0", "6.5.0"],
|
|
]) {
|
|
const { github, calls } = createGithub();
|
|
const issue = { number: 2925, title, body,
|
|
labels: ["bug", "affects-8.0.3", "needs-human", "release-blocker", "needs-decomposition",
|
|
"needs-retest-on-latest", "operator-reviewed"].map(name => ({ name })) };
|
|
await syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
const expectedLabel = version ? `affects-${version}` : "needs-version-info";
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [[expectedLabel]]);
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name), []);
|
|
assert.deepEqual(calls.createLabel.map(call => call.name), [expectedLabel]);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
assert.equal(calls.getIssue.length, 2 + calls.removeLabel.length);
|
|
}
|
|
});
|
|
|
|
test("version fields retain document-wide full, collapsed and shortcut reference links", () => {
|
|
for (const [value, definitions, expected] of [
|
|
["[6.5.0][release]", '[release]: https://example.invalid/6.4.5 "6.4.5"', "6.5.0"],
|
|
["[6.5.0][]", "[6.5.0]: https://example.invalid/6.4.5", "6.5.0"],
|
|
["[6.5.0]", "[6.5.0]: https://example.invalid/6.4.5", "6.5.0"],
|
|
["**[`v6.5.0`][ReLeAsE]**", "[release]: https://example.invalid/6.4.5", "6.5.0"],
|
|
["[pulse-pro-v6.6.0-rc.6-linux-arm64.tar.gz][release]",
|
|
"[release]: https://example.invalid/6.4.5", "6.6.0-rc.6"],
|
|
["[unknown][release]", '[release]: https://example.invalid/6.5.0 "6.5.0"', null],
|
|
]) {
|
|
for (const field of ["### Pulse version\n", "Pulse version: ", "- **Pulse version**: "]) {
|
|
const report = `${field}${value}\n\n### Agent version\n6.4.5`;
|
|
for (const body of [`${definitions}\n\n${report}`, `${report}\n\n${definitions}`]) {
|
|
for (const newline of ["\n", "\r\n"]) {
|
|
assert.equal(triage.internals.extractPulseVersion("Upgrade from v6.4.5",
|
|
body.replaceAll("\n", newline)), expected, body);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
test("reference definitions cannot invent values from destinations, examples or hidden content", () => {
|
|
for (const [value, definitions] of [
|
|
["[release][6.5.0]", "[6.5.0]: https://example.invalid/6.5.0"],
|
|
["![6.5.0][release]", "[release]: https://example.invalid/6.5.0"],
|
|
["~~[6.5.0][release]~~", "[release]: https://example.invalid/6.5.0"],
|
|
["`[6.5.0][release]`", "[release]: https://example.invalid/6.5.0"],
|
|
["[6.5.0][release]", "<!--\n[release]: https://example.invalid/6.5.0\n-->"],
|
|
["[6.5.0][release]", "```markdown\n[release]: https://example.invalid/6.5.0\n```"],
|
|
["[6.5.0][release]", " [release]: https://example.invalid/6.5.0"],
|
|
["[6.5.0][release]", "[other]: https://example.invalid/6.5.0"],
|
|
]) {
|
|
assert.equal(triage.internals.extractPulseVersion("Upgrade from v6.4.5",
|
|
`### Pulse version\n${value}\n\n### Agent version\n6.4.5\n\n${definitions}`), null, value);
|
|
}
|
|
});
|
|
|
|
test("reference-linked feedback follows every visible form choice, not its definition", () => {
|
|
for (const [selection, expected] of [
|
|
["Bug / regression", "bug"], ["Upgrade / migration issue", "bug"],
|
|
["Performance issue", "bug"], ["Documentation issue", "documentation"],
|
|
["UX / workflow friction", "enhancement"], ["Other actionable feedback", "enhancement"],
|
|
]) {
|
|
for (const [value, definitions] of [
|
|
[`[${selection}][choice]`, '[choice]: https://example.invalid/bug "Bug / regression"'],
|
|
[`[${selection}][]`, `[${selection}]: https://example.invalid/bug`],
|
|
[`[${selection}]`, `[${selection}]: https://example.invalid/bug`],
|
|
]) {
|
|
const report = `### Feedback type\n${value}\n\n### Pulse version\nunknown`;
|
|
for (const body of [`${definitions}\n\n${report}`, `${report}\n\n${definitions}`]) {
|
|
assert.equal(triage.internals.classifyV6FeedbackType(body), expected, body);
|
|
}
|
|
}
|
|
}
|
|
for (const value of ["[choice][bug]", "![Bug / regression][bug]",
|
|
"~~[Bug / regression][bug]~~", "`[Bug / regression][bug]`"]) {
|
|
assert.equal(triage.internals.classifyV6FeedbackType(
|
|
`### Feedback type\n${value}\n\n### Pulse version\nunknown\n\n[bug]: https://example.invalid/bug`), null, value);
|
|
}
|
|
});
|
|
|
|
test("linked no-topic responses stay empty without discarding qualifications or evidence", () => {
|
|
for (const value of ["[None][topic]", "[None][]", "[None]", "**[`None`][topic]**"]) {
|
|
const definitions = '[topic]: https://example.invalid/bug "Bug / regression"\n[None]: https://example.invalid/bug';
|
|
for (const [topic, expected] of [[value, false],
|
|
[`${value}, except the saved target also changes.`, true],
|
|
[`${value}\n\nThe installer also loses its selection.`, true]]) {
|
|
const report = `### Additional actionable topics\n${topic}\n\n### Desired outcome\nKeep the current workflow.`;
|
|
for (const body of [`${definitions}\n\n${report}`, `${report}\n\n${definitions}`]) {
|
|
assert.equal(triage.internals.classifyAdditionalActionableTopics(body), expected, body);
|
|
}
|
|
}
|
|
}
|
|
for (const topic of ["![None][topic]", "~~[None][topic]~~", "`[None][topic]`", "[None][undefined]"]) {
|
|
assert.equal(triage.internals.classifyAdditionalActionableTopics(
|
|
`### Additional actionable topics\n${topic}\n\n### Pulse version\n6.5.0\n\n[topic]: https://example.invalid/bug`), true, topic);
|
|
}
|
|
});
|
|
|
|
test("the silent consumer uses linked declarations without invented tasks or reporter contact", async () => {
|
|
for (const [selection, version, expectedLabels] of [
|
|
["Documentation issue", "unknown", ["documentation"]],
|
|
["Bug / regression", "6.5.0", ["affects-6.5.0", "bug"]],
|
|
]) {
|
|
const { github, calls } = createGithub();
|
|
const issue = { number: 2928, title: "Current feedback", labels: ["needs-human",
|
|
"release-blocker", "needs-retest-on-latest", "operator-reviewed"].map(name => ({ name })),
|
|
body: `### Feedback type\n[${selection}][choice]\n\n### Pulse version\n[${version}][release]\n\n` +
|
|
"### Additional actionable topics\n[None][topic]\n\n### What happened?\nCurrent report.\n\n" +
|
|
'[choice]: https://example.invalid/bug "Bug / regression"\n' +
|
|
'[release]: https://example.invalid/6.4.5 "6.4.5"\n[topic]: https://example.invalid/bug' };
|
|
await syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [expectedLabels]);
|
|
assert.deepEqual(calls.createLabel.map(call => call.name),
|
|
version === "6.5.0" ? ["affects-6.5.0"] : []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
assert.equal(calls.getIssue.length, 2 + calls.removeLabel.length);
|
|
}
|
|
});
|
|
|
|
test("unversioned server images and companion binaries cannot borrow a later version", () => {
|
|
const values = [
|
|
"rcourtman/pulse:latest; agent 6.5.0",
|
|
"license.pulserelay.pro/pulse-pro:latest; TrueNAS 25.10.3",
|
|
"rcourtman/pulse:6.6; agent 6.5.0",
|
|
"pulse:unknown; server 6.5.0 after recovery",
|
|
"pulse:latest (previously 6.4.5)",
|
|
"registry.6.4.5.invalid/pulse:latest; agent 6.5.0",
|
|
"pulse-agent v6.5.0",
|
|
"pulse-agent-helper 6.5.0",
|
|
"pulse-agent-runner:6.5.0",
|
|
"pulse-mcp 6.5.0",
|
|
"pulse-provider-msp 6.5.0",
|
|
"pulse-pro-agent v6.5.0",
|
|
];
|
|
for (const value of values) {
|
|
for (const field of ["### Pulse version\n", "Pulse version: ", "- **Pulse version**: "]) {
|
|
for (const newline of ["\n", "\r\n"]) {
|
|
const body = `${field}${value}\n\n### Agent version\n6.4.5`;
|
|
assert.equal(triage.internals.extractPulseVersion("Pulse 6.4.5 upgrade failed",
|
|
body.replaceAll("\n", newline)), null, body);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
test("a complete server token supplies its own version, not a registry or later number", () => {
|
|
for (const [value, expected] of [
|
|
["v6.6.0-rc.6; agent 6.5.0", "6.6.0-rc.6"],
|
|
["Pulse v6.6.0-rc.6; TrueNAS 25.10.3", "6.6.0-rc.6"],
|
|
["server + pulse-agent v6.3.2", "6.3.2"],
|
|
["pulse-v6.6.0-rc.6", "6.6.0-rc.6"],
|
|
["pulse_v6.6.0-rc.6", "6.6.0-rc.6"],
|
|
["pulse-pro-v6.6.0-rc.6", "6.6.0-rc.6"],
|
|
["registry.6.4.5.invalid/pulse:6.6.0-rc.6; agent 6.5.0", "6.6.0-rc.6"],
|
|
["registry.6.4.5.invalid/pulse-pro:v6.6.0-rc.6", "6.6.0-rc.6"],
|
|
["**[registry.6.4.5.invalid/pulse:6.6.0-rc.6](https://example.invalid/6.5.0)**", "6.6.0-rc.6"],
|
|
["registry.6.4.5.invalid/pulse:6.5.0 → 6.6.0-rc.6", null],
|
|
["registry.6.4.5.invalid/pulse-pro:6.5.0 to latest", null],
|
|
]) {
|
|
assert.equal(triage.internals.extractPulseVersion("Upgrade from v6.4.5",
|
|
`### Pulse version\n${value}\n\n### Agent version\n6.4.5`), expected, value);
|
|
}
|
|
});
|
|
|
|
test("silent triage flags ambiguous form evidence without retiring whole-thread affected versions", async () => {
|
|
for (const action of ["opened", "edited", "reopened"]) {
|
|
for (const [value, borrowedVersion] of [
|
|
["rcourtman/pulse:latest; agent 6.5.0", "6.5.0"],
|
|
["license.pulserelay.pro/pulse-pro:latest; TrueNAS 25.10.3", "25.10.3"],
|
|
["pulse-agent v6.5.0", "6.5.0"],
|
|
["rcourtman/pulse:6.6; agent 6.5.0", "6.5.0"],
|
|
]) {
|
|
const { github, calls } = createGithub();
|
|
const preserved = ["bug", "needs-human", "release-blocker", "needs-decomposition",
|
|
"needs-retest-on-latest", "operator-reviewed"];
|
|
const issue = { number: 2929, title: "Pulse 6.4.5 upgrade failed",
|
|
body: `### Pulse version\n${value}\n\n### Agent version\n6.4.5`,
|
|
labels: [...preserved, `affects-${borrowedVersion}`].map(name => ({ name })) };
|
|
await syncLabels({ github, context: createContext({ action, issue }), core: createCore() });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["needs-version-info"]], value);
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name), [], value);
|
|
assert.deepEqual(calls.createLabel.map(call => call.name), ["needs-version-info"], value);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
assert.equal(calls.getIssue.length, 2 + calls.removeLabel.length);
|
|
}
|
|
}
|
|
});
|
|
// Spy on the locked parser, not a production counter or elapsed-time threshold.
|
|
// The complete report should be lexed once, even when fields use definitions
|
|
// elsewhere in it. Field-sized lexing remains necessary and is not counted.
|
|
for (const action of ["opened", "edited", "reopened"]) {
|
|
test(`one Markdown snapshot supplies the ${action} label decision`, async () => {
|
|
const { Lexer } = require("marked");
|
|
const originalLex = Lexer.prototype.lex;
|
|
const previousBody = [
|
|
"### Feedback type", "[selected]", "### Pulse version", "[server]",
|
|
"### Additional actionable topics", "[topics]", "",
|
|
"[selected]: https://example.invalid/type", // label still supplies text
|
|
"[server]: https://example.invalid/old", "[topics]: https://example.invalid/old",
|
|
].join("\n").replace("[selected]\n", "Documentation issue\n")
|
|
.replace("[server]\n", "6.4.5\n").replace("[topics]\n", "None\n");
|
|
const body = [
|
|
"### Feedback type", "[Bug / regression][selected]",
|
|
"### Pulse version", "[6.5.0][server]",
|
|
"### Additional actionable topics", "[Another workflow problem][topics]",
|
|
"### Logs, screenshots, or diagnostics", "```text",
|
|
"Pulse version: 9.9.9", "### Feedback type", "Documentation issue", "```", "",
|
|
"[selected]: https://example.invalid/Documentation-issue",
|
|
"[server]: https://example.invalid/6.4.5", "[topics]: https://example.invalid/None",
|
|
].join("\n");
|
|
const counts = new Map([[body, 0], [previousBody, 0]]);
|
|
Lexer.prototype.lex = function (source) {
|
|
if (counts.has(source)) counts.set(source, counts.get(source) + 1);
|
|
return originalLex.call(this, source);
|
|
};
|
|
const { github, calls } = createGithub();
|
|
const issue = { number: 2930, title: "Upgrade from 6.4.5", body,
|
|
labels: ["bug", "affects-6.4.5", "needs-human", "release-blocker",
|
|
"needs-retest-on-latest"].map(name => ({ name })) };
|
|
try {
|
|
await syncLabels({ github, context: createContext({ action, issue,
|
|
previousBody: action === "edited" ? previousBody : undefined }), core: createCore() });
|
|
} finally {
|
|
Lexer.prototype.lex = originalLex;
|
|
}
|
|
assert.equal(counts.get(body), 1, "full current report parses per decision");
|
|
assert.equal(counts.get(previousBody), action === "edited" ? 1 : 0,
|
|
"previous declaration is parsed only when the edited event needs comparison");
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [action === "reopened"
|
|
? ["affects-6.5.0"] : ["affects-6.5.0", "needs-decomposition"]]);
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name), []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
assert.equal(calls.getIssue.length, 2 + calls.removeLabel.length);
|
|
});
|
|
}
|
|
|
|
test("Markdown snapshots never leak reference definitions between reports or revisions", async () => {
|
|
const { Lexer } = require("marked");
|
|
const originalLex = Lexer.prototype.lex;
|
|
const body = (version, topic, hasReleaseDefinition = true) => [
|
|
"### Feedback type", "[Bug / regression][type]", "### Pulse version", version,
|
|
"### Additional actionable topics", topic, "", "[type]: https://example.invalid/type",
|
|
...(hasReleaseDefinition ? ["[release]: https://example.invalid/6.4.5"] : []),
|
|
"[topic]: https://example.invalid/topic",
|
|
].join("\n");
|
|
const bodies = [body("[6.5.0][release]", "[Another topic][topic]"),
|
|
body("[6.6.0][release]", "[None][topic]", false), body("[6.6.0-rc.6][release]", "None")];
|
|
const counts = new Map(bodies.map(value => [value, 0]));
|
|
Lexer.prototype.lex = function (source) {
|
|
if (counts.has(source)) counts.set(source, counts.get(source) + 1);
|
|
return originalLex.call(this, source);
|
|
};
|
|
const results = bodies.map((value, i) => {
|
|
const { github, calls } = createGithub();
|
|
const issue = { number: i === 1 ? 2932 : 2931, title: "Bug", body: value,
|
|
labels: [{ name: "bug" }, { name: "needs-human" }] };
|
|
return { github, calls, issue };
|
|
});
|
|
try {
|
|
await Promise.all(results.map(({ github, issue }) => syncLabels({
|
|
github, context: createContext({ issue }), core: createCore(),
|
|
})));
|
|
} finally {
|
|
Lexer.prototype.lex = originalLex;
|
|
}
|
|
assert.deepEqual([...counts.values()], [1, 1, 1]);
|
|
assert.deepEqual(results.map(({ calls }) => calls.addLabels[0].labels), [
|
|
["affects-6.5.0", "needs-decomposition"], ["needs-version-info"], ["affects-6.6.0-rc.6"],
|
|
]);
|
|
for (const { calls } of results) {
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
}
|
|
});
|
|
|
|
test("non-rendered reference definitions cannot invent secondary topics at the end of a report", () => {
|
|
for (const value of ["", "None", "[None][empty]", "**[None][empty]**"]) {
|
|
for (const newline of ["\n", "\r\n"]) {
|
|
const body = `### Additional actionable topics\n${value}\n\n` +
|
|
"[empty]: https://example.invalid/another-bug\n";
|
|
assert.equal(triage.internals.classifyAdditionalActionableTopics(body.replaceAll("\n", newline)), false);
|
|
}
|
|
}
|
|
for (const value of ["Another bug", "None, except another workflow problem", "[Another bug][empty]"]) {
|
|
assert.equal(triage.internals.classifyAdditionalActionableTopics(
|
|
`### Additional actionable topics\n${value}\n\n[empty]: https://example.invalid/None\n`
|
|
), true, value);
|
|
}
|
|
});
|
|
|
|
test("literal reference-definition examples remain visible evidence for topic review", () => {
|
|
for (const example of [
|
|
"```markdown\n[example]: https://example.invalid/topic\n```",
|
|
" [example]: https://example.invalid/topic",
|
|
"`[example]: https://example.invalid/topic`",
|
|
]) {
|
|
assert.equal(triage.internals.classifyAdditionalActionableTopics(
|
|
`### Additional actionable topics\nNone\n\n${example}\n`
|
|
), true, example);
|
|
}
|
|
});
|
|
|
|
function labelNameConflict() {
|
|
return Object.assign(new Error("Validation Failed"), {
|
|
status: 422,
|
|
response: { data: { errors: [{ resource: "Label", field: "name", code: "already_exists" }] } },
|
|
});
|
|
}
|
|
|
|
for (const [label, classification, body] of [
|
|
["affects-6.7.0", "bug", "### Pulse version\n6.7.0\n"],
|
|
["needs-version-info", "bug", "### Pulse version\nunknown\n"],
|
|
["needs-decomposition", "enhancement", "### Additional actionable topics\nAlso retain failed attempts.\n"],
|
|
]) {
|
|
test(`label-creation race preserves both reports' metadata: ${label}`, async () => {
|
|
const existingLabels = new Set();
|
|
let missingReads = 0;
|
|
let releaseReads;
|
|
const bothMissing = new Promise(resolve => { releaseReads = resolve; });
|
|
const preserved = [classification, "needs-human", "release-blocker",
|
|
"needs-retest-on-latest", "operator-reviewed"];
|
|
const workers = [2933, 2934].map(number => {
|
|
const { github, calls } = createGithub({ existingLabels });
|
|
const getLabel = github.rest.issues.getLabel;
|
|
const createLabel = github.rest.issues.createLabel;
|
|
github.rest.issues.getLabel = async payload => {
|
|
if (!existingLabels.has(payload.name)) {
|
|
// Both jobs must have observed absence before either can create it.
|
|
calls.getLabel.push(payload.name);
|
|
missingReads += 1;
|
|
if (missingReads === 2) releaseReads();
|
|
await bothMissing;
|
|
throw Object.assign(new Error("Not Found"), { status: 404 });
|
|
}
|
|
return getLabel(payload);
|
|
};
|
|
github.rest.issues.createLabel = async payload => {
|
|
if (existingLabels.has(payload.name)) {
|
|
calls.createLabel.push(payload);
|
|
throw labelNameConflict();
|
|
}
|
|
return createLabel(payload);
|
|
};
|
|
const issue = { number, title: "Monitoring report", body,
|
|
labels: preserved.map(name => ({ name })) };
|
|
return { github, calls, issue };
|
|
});
|
|
const results = await Promise.allSettled(workers.map(({ github, issue }) =>
|
|
syncLabels({ github, context: createContext({ issue }), core: createCore() })));
|
|
assert.deepEqual(results.map(result => result.status), ["fulfilled", "fulfilled"]);
|
|
assert.equal(missingReads, 2);
|
|
assert.deepEqual([...existingLabels], [label]);
|
|
assert.equal(workers.reduce((sum, worker) => sum + worker.calls.getLabel.length, 0), 3);
|
|
for (const { calls } of workers) {
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [[label]]);
|
|
assert.equal(calls.createLabel.length, 1, "never replay label creation");
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
assert.equal(calls.getIssue.length, 2 + calls.removeLabel.length, "recheck report before applying metadata");
|
|
}
|
|
});
|
|
}
|
|
|
|
test("label-creation reconciliation requires the exact current label", async () => {
|
|
for (const current of [{ name: "affects-6.7.0" }, { name: "AFFECTS-6.7.0" },
|
|
{ name: "affects-6.6.0" }, {}, null]) {
|
|
const { github, calls } = createGithub();
|
|
const conflict = labelNameConflict();
|
|
github.rest.issues.getLabel = async ({ name }) => {
|
|
calls.getLabel.push(name);
|
|
if (calls.getLabel.length === 1) throw Object.assign(new Error("Not Found"), { status: 404 });
|
|
return { data: current };
|
|
};
|
|
github.rest.issues.createLabel = async payload => {
|
|
calls.createLabel.push(payload);
|
|
throw conflict;
|
|
};
|
|
const issue = { number: 2935, title: "Monitoring report", body: "### Pulse version\n6.7.0\n",
|
|
labels: [{ name: "bug" }] };
|
|
const result = syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
const matches = current?.name?.toLowerCase() === "affects-6.7.0";
|
|
if (matches) await result;
|
|
else await assert.rejects(result, error => error === conflict);
|
|
assert.equal(calls.getLabel.length, 2);
|
|
assert.equal(calls.createLabel.length, 1);
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), matches ? [["affects-6.7.0"]] : []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
}
|
|
});
|
|
|
|
test("label-creation non-conflict failures are not retried or hidden", async () => {
|
|
for (const [status, errors] of [
|
|
[401], [403], [429], [500], [422], [422, "unavailable"], [422, []],
|
|
[422, [{ resource: "Label", field: "name", code: "invalid" }]],
|
|
[422, [{ resource: "Issue", field: "name", code: "already_exists" }]],
|
|
[422, [{ resource: "Label", field: "description", code: "already_exists" }]],
|
|
[422, [{ resource: "Label", field: "name", code: "already_exists" },
|
|
{ resource: "Label", field: "color", code: "invalid" }]],
|
|
]) {
|
|
const { github, calls } = createGithub();
|
|
const failure = Object.assign(new Error("Creation failed"), {
|
|
status, response: { data: { errors } },
|
|
});
|
|
github.rest.issues.createLabel = async payload => {
|
|
calls.createLabel.push(payload);
|
|
throw failure;
|
|
};
|
|
const issue = { number: 2936, title: "Monitoring report", body: "### Pulse version\n6.7.0\n",
|
|
labels: [{ name: "bug" }] };
|
|
await assert.rejects(syncLabels({ github, context: createContext({ issue }), core: createCore() }),
|
|
error => error === failure);
|
|
assert.equal(calls.getLabel.length, 1);
|
|
assert.equal(calls.createLabel.length, 1);
|
|
assert.deepEqual(calls.addLabels, []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
}
|
|
});
|
|
|
|
test("label-creation reconciliation read failures stop report mutations", async () => {
|
|
for (const status of [403, 404, 503]) {
|
|
const { github, calls } = createGithub();
|
|
const failure = Object.assign(new Error("Read failed"), { status });
|
|
github.rest.issues.getLabel = async ({ name }) => {
|
|
calls.getLabel.push(name);
|
|
if (calls.getLabel.length === 1) throw Object.assign(new Error("Not Found"), { status: 404 });
|
|
throw failure;
|
|
};
|
|
github.rest.issues.createLabel = async payload => {
|
|
calls.createLabel.push(payload);
|
|
throw labelNameConflict();
|
|
};
|
|
const issue = { number: 2937, title: "Monitoring report", body: "### Pulse version\n6.7.0\n",
|
|
labels: [{ name: "bug" }] };
|
|
await assert.rejects(syncLabels({ github, context: createContext({ issue }), core: createCore() }),
|
|
error => error === failure);
|
|
assert.equal(calls.getLabel.length, 2);
|
|
assert.equal(calls.createLabel.length, 1);
|
|
assert.deepEqual(calls.addLabels, []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
}
|
|
});
|
|
|
|
test("label-creation reconciliation still respects a newer Community decision", async () => {
|
|
const issue = { number: 2938, title: "Monitoring report", body: "### Pulse version\n6.7.0\n",
|
|
state: "open", updated_at: "2026-10-08T10:00:00Z", labels: [{ name: "bug" }] };
|
|
const { github, calls } = createGithub({ currentIssue: issue });
|
|
github.rest.issues.getLabel = async ({ name }) => {
|
|
calls.getLabel.push(name);
|
|
if (calls.getLabel.length === 1) throw Object.assign(new Error("Not Found"), { status: 404 });
|
|
github.currentIssue = { ...issue, updated_at: "2026-10-08T11:00:00Z",
|
|
labels: [...issue.labels, { name: "needs-human" }] };
|
|
return { data: { name } };
|
|
};
|
|
github.rest.issues.createLabel = async payload => {
|
|
calls.createLabel.push(payload);
|
|
throw labelNameConflict();
|
|
};
|
|
await syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
assert.equal(calls.getLabel.length, 2);
|
|
assert.equal(calls.createLabel.length, 1);
|
|
assert.equal(calls.getIssue.length, 2 + calls.removeLabel.length);
|
|
assert.deepEqual(calls.addLabels, []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
});
|
|
|
|
function delayedTopicFixture({ action = "opened", events = [], currentChanges = {}, eventChanges = {} } = {}) {
|
|
const issue = {
|
|
number: 2900,
|
|
title: "Notification delivery",
|
|
body: "### Additional actionable topics\nAlso retain per-host notification identity.\n",
|
|
labels: [{ name: "enhancement" }],
|
|
updated_at: "2026-10-26T06:00:00Z",
|
|
comments: 0,
|
|
...eventChanges,
|
|
};
|
|
const { github, calls } = createGithub({ events, currentIssue: {
|
|
...issue, state: "open", comments: 1, updated_at: "2026-10-26T06:01:00Z", ...currentChanges,
|
|
} });
|
|
return { github, calls, args: { github, core: createCore(), context: createContext({
|
|
issue, action, previousBody: "### Additional actionable topics\nNone.\n",
|
|
}) } };
|
|
}
|
|
|
|
for (const action of ["opened", "edited"]) {
|
|
test(`a comment before ${action} processing cannot lose a declared topic review`, async () => {
|
|
const { args, calls } = delayedTopicFixture({ action });
|
|
await triage.syncLabels(args);
|
|
assert.deepEqual(calls.getEvents, [{ owner: "rcourtman", repo: "Pulse", issue_number: 2900,
|
|
per_page: 100, page: 1 }]);
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["needs-decomposition"]]);
|
|
assert.equal(calls.getIssue.length, 2 + calls.removeLabel.length, "the final current-report guard still runs");
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
});
|
|
}
|
|
|
|
test("a revised topic after an earlier review survives a later comment", async () => {
|
|
const { args, calls } = delayedTopicFixture({ action: "edited", events: [{
|
|
event: "unlabeled", label: { name: "needs-decomposition" }, created_at: "2026-10-26T05:59:59Z",
|
|
}] });
|
|
args.context.payload.changes.body.from = "### Additional actionable topics\nRetain one host name.\n";
|
|
await triage.syncLabels(args);
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["needs-decomposition"]]);
|
|
});
|
|
|
|
for (const created_at of ["2026-10-26T06:00:00Z", "2026-10-26T06:00:01Z"]) {
|
|
test(`a completed review at ${created_at} cannot be restored by a comment-delayed event`, async () => {
|
|
const { args, calls } = delayedTopicFixture({ events: [{
|
|
event: "unlabeled", label: { name: "Needs-Decomposition" }, created_at,
|
|
}] });
|
|
await triage.syncLabels(args);
|
|
assert.deepEqual(calls.addLabels, []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
});
|
|
}
|
|
|
|
test("review history is paginated before allowing a delayed declaration", async () => {
|
|
const unrelated = { event: "labeled", label: { name: "unrelated" }, created_at: "2026-10-26T05:00:00Z" };
|
|
for (const cleared of [false, true]) {
|
|
const events = [...Array(100).fill(unrelated), ...(cleared ? [{
|
|
event: "unlabeled", label: { name: "needs-decomposition" }, created_at: "2026-10-26T06:00:30Z",
|
|
}] : [])];
|
|
const { args, calls } = delayedTopicFixture({ events });
|
|
await triage.syncLabels(args);
|
|
assert.deepEqual(calls.getEvents.map(call => call.page), [1, 2]);
|
|
assert.deepEqual(calls.addLabels.flatMap(call => call.labels), cleared ? [] : ["needs-decomposition"]);
|
|
}
|
|
});
|
|
|
|
test("a comment and unrelated label changes do not dispose of a declared topic", async () => {
|
|
const { args, calls } = delayedTopicFixture({
|
|
currentChanges: { labels: [{ name: "enhancement" }, { name: "operator-reviewed" }, { name: "needs-human" }] },
|
|
events: [{ event: "unlabeled", label: { name: "unrelated" }, created_at: "2026-10-26T06:00:20Z" }],
|
|
});
|
|
await triage.syncLabels(args);
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["needs-decomposition"]]);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
});
|
|
|
|
for (const event of ["closed", "reopened", "transferred", "converted_to_discussion"]) {
|
|
test(`an intervening ${event} event prevents comment-delayed restoration`, async () => {
|
|
const { args, calls } = delayedTopicFixture({ events: [{ event, created_at: "2026-10-26T06:00:30Z" }] });
|
|
await triage.syncLabels(args);
|
|
assert.deepEqual(calls.addLabels, []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
});
|
|
}
|
|
|
|
test("history newer than the current report snapshot is not permission to restore a task", async () => {
|
|
const { args, calls } = delayedTopicFixture({ events: [{
|
|
event: "labeled", created_at: "2026-10-26T06:01:01Z", label: { name: "unrelated" },
|
|
}] });
|
|
await triage.syncLabels(args);
|
|
assert.deepEqual(calls.addLabels, []);
|
|
});
|
|
|
|
test("only a readable, unchanged declaration with a later comment needs review history", async () => {
|
|
for (const options of [
|
|
{ currentChanges: { body: "### Additional actionable topics\nA different topic.\n" } },
|
|
{ currentChanges: { title: "A different report title" } },
|
|
{ currentChanges: { comments: 0 } },
|
|
{ currentChanges: { comments: undefined } },
|
|
{ eventChanges: { comments: undefined } },
|
|
{ eventChanges: { comments: -1 } },
|
|
{ currentChanges: { updated_at: "unknown" } },
|
|
{ currentChanges: { updated_at: 1792994460000 } },
|
|
{ eventChanges: { updated_at: null } },
|
|
{ currentChanges: { updated_at: "2026-10-26T05:59:59Z" } },
|
|
{ action: "reopened" },
|
|
{ action: "edited", eventChanges: { body: "### Additional actionable topics\nNone.\n" } },
|
|
]) {
|
|
const { args, calls } = delayedTopicFixture(options);
|
|
await triage.syncLabels(args);
|
|
assert.deepEqual(calls.getEvents, [], JSON.stringify(options));
|
|
assert.deepEqual(calls.addLabels, [], JSON.stringify(options));
|
|
}
|
|
const { args, calls } = delayedTopicFixture({ action: "edited" });
|
|
args.context.payload.changes.body.from = args.context.payload.issue.body;
|
|
await triage.syncLabels(args);
|
|
assert.deepEqual(calls.getEvents, []);
|
|
assert.deepEqual(calls.addLabels, []);
|
|
});
|
|
|
|
test("current or already queued declarations do not add a history read", async () => {
|
|
for (const currentChanges of [
|
|
{ comments: 0, updated_at: "2026-10-26T06:00:00Z" },
|
|
{ labels: [{ name: "enhancement" }, { name: "needs-decomposition" }] },
|
|
]) {
|
|
const { args, calls } = delayedTopicFixture({ currentChanges });
|
|
await triage.syncLabels(args);
|
|
assert.deepEqual(calls.getEvents, []);
|
|
assert.deepEqual(calls.addLabels.flatMap(call => call.labels),
|
|
currentChanges.labels ? [] : ["needs-decomposition"]);
|
|
}
|
|
});
|
|
|
|
for (const status of [403, 404, 500]) {
|
|
test(`a review-history ${status} fails without mutation or an alternate read`, async () => {
|
|
const { args, github, calls } = delayedTopicFixture();
|
|
github.rest.issues.listEvents = async payload => {
|
|
calls.getEvents.push(payload);
|
|
const error = new Error("history unavailable");
|
|
error.status = status;
|
|
throw error;
|
|
};
|
|
await assert.rejects(triage.syncLabels(args), error => error.status === status);
|
|
assert.equal(calls.getEvents.length, 1);
|
|
assert.deepEqual(calls.createLabel, []);
|
|
assert.deepEqual(calls.addLabels, []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
});
|
|
}
|
|
|
|
test("malformed or incomplete review history never becomes an empty successful read", async () => {
|
|
for (const data of [null, {}, [null], [{ event: "unlabeled", created_at: "2026-10-26T06:00:30Z" }],
|
|
[{ event: "labeled", created_at: "unknown" }], [{ event: "labeled", created_at: 1792994430000 }],
|
|
Array(101).fill({ event: "labeled", created_at: "2026-10-26T06:00:30Z" })]) {
|
|
const { args, github, calls } = delayedTopicFixture();
|
|
github.rest.issues.listEvents = async () => ({ data });
|
|
await assert.rejects(triage.syncLabels(args), /Issue review history/);
|
|
assert.deepEqual(calls.createLabel, []);
|
|
assert.deepEqual(calls.addLabels, []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
}
|
|
});
|
|
|
|
test("the bounded review-history limit stops without writes or another route", async () => {
|
|
const event = { event: "labeled", created_at: "2026-10-26T05:00:00Z", label: { name: "unrelated" } };
|
|
const { args, calls } = delayedTopicFixture({ events: Array(1000).fill(event) });
|
|
await assert.rejects(triage.syncLabels(args), /exceeded the bounded event read/);
|
|
assert.equal(calls.getEvents.length, 10);
|
|
assert.deepEqual(calls.createLabel, []);
|
|
assert.deepEqual(calls.addLabels, []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
});
|
|
|
|
test("the final report guard still rejects changes during history collection", async () => {
|
|
const { args, github, calls } = delayedTopicFixture();
|
|
github.rest.issues.listEvents = async payload => {
|
|
calls.getEvents.push(payload);
|
|
github.currentIssue = { ...github.currentIssue, updated_at: "2026-10-26T06:02:00Z",
|
|
labels: [...github.currentIssue.labels, { name: "needs-human" }] };
|
|
return { data: [] };
|
|
};
|
|
await triage.syncLabels(args);
|
|
assert.deepEqual(calls.addLabels, []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
});
|
|
|
|
function topicPreparationRace({ action = "opened", initialComments = 0, events = [], changes = {}, eventChanges = {} } = {}) {
|
|
const fixture = delayedTopicFixture({ action, events, eventChanges, currentChanges: {
|
|
comments: initialComments,
|
|
updated_at: initialComments ? "2026-10-26T06:01:00Z" : "2026-10-26T06:00:00Z",
|
|
} });
|
|
const { github, calls } = fixture;
|
|
github.rest.issues.get = async payload => {
|
|
calls.getIssue.push(payload);
|
|
if (calls.getIssue.length === 2) {
|
|
github.currentIssue = { ...github.currentIssue, comments: initialComments + 1,
|
|
updated_at: "2026-10-26T06:02:00Z", ...changes };
|
|
}
|
|
return { data: github.currentIssue };
|
|
};
|
|
return fixture;
|
|
}
|
|
|
|
function sameSecondTopicFixture({ action = "opened", stage = "initial", events = [],
|
|
eventChanges = {}, currentChanges = {} } = {}) {
|
|
const at = "2026-10-26T06:00:00Z";
|
|
return stage === "initial"
|
|
? delayedTopicFixture({ action, events, eventChanges,
|
|
currentChanges: { updated_at: at, ...currentChanges } })
|
|
: topicPreparationRace({ action, events, eventChanges,
|
|
changes: { updated_at: at, ...currentChanges } });
|
|
}
|
|
|
|
for (const stage of ["initial", "preparation"]) {
|
|
test(`same-second comments ${stage === "initial" ? "before processing" : "during preparation"} preserve pending reviews and later dispositions`, async () => {
|
|
for (const action of ["opened", "edited"]) {
|
|
for (const disposition of [null, "unlabeled", "closed", "reopened", "transferred", "converted_to_discussion"]) {
|
|
const { args, calls } = sameSecondTopicFixture({ action, stage, events: disposition ? [{
|
|
event: disposition, label: { name: "Needs-Decomposition" },
|
|
created_at: "2026-10-26T06:00:00Z",
|
|
}] : [] });
|
|
await triage.syncLabels(args);
|
|
assert.deepEqual(calls.getEvents.map(call => call.page), [1], `${action}: ${disposition}`);
|
|
assert.deepEqual(calls.addLabels.flatMap(call => call.labels),
|
|
disposition ? [] : ["needs-decomposition"], `${action}: ${disposition}`);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
}
|
|
}
|
|
});
|
|
|
|
test(`same-second ${stage} history failures stop without writes or a fallback read`, async () => {
|
|
for (const failure of [403, 500, null, [{ event: "unlabeled", created_at: "2026-10-26T06:00:00Z" }]]) {
|
|
const { args, github, calls } = sameSecondTopicFixture({ stage });
|
|
github.rest.issues.listEvents = async payload => {
|
|
calls.getEvents.push(payload);
|
|
if (typeof failure === "number") throw Object.assign(new Error("history unavailable"), { status: failure });
|
|
return { data: failure };
|
|
};
|
|
await assert.rejects(triage.syncLabels(args));
|
|
assert.equal(calls.getEvents.length, 1);
|
|
assert.deepEqual(calls.addLabels, []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
}
|
|
});
|
|
}
|
|
|
|
test("same-second activity needs readable increasing comment counts before history or mutation", async () => {
|
|
for (const [before, after] of [[0, undefined], [undefined, 1], [0, -1], [0, 0.5], [2, 1]]) {
|
|
const { args, calls } = sameSecondTopicFixture({ eventChanges: { comments: before },
|
|
currentChanges: { comments: after } });
|
|
await triage.syncLabels(args);
|
|
assert.deepEqual(calls.getEvents, []);
|
|
assert.deepEqual(calls.addLabels, []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
}
|
|
});
|
|
|
|
test("same-second comment reconciliation keeps version deltas and Community labels scoped", async () => {
|
|
for (const stage of ["initial", "preparation"]) {
|
|
const { args, calls } = sameSecondTopicFixture({ stage, eventChanges: {
|
|
body: "### Additional actionable topics\nRetain per-host identity.\n### Pulse version\n6.7.0\n",
|
|
labels: ["bug", "affects-6.5.0", "needs-version-info", "needs-human", "release-blocker",
|
|
"needs-retest-on-latest", "operator-reviewed"].map(name => ({ name })),
|
|
} });
|
|
await triage.syncLabels(args);
|
|
assert.deepEqual(calls.getEvents.map(call => call.page), [1]);
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["affects-6.7.0", "needs-decomposition"]]);
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name), ["needs-version-info"]);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
}
|
|
});
|
|
|
|
test("further same-second activity after preparation history stops the prepared delta", async () => {
|
|
const { args, github, calls } = sameSecondTopicFixture({ stage: "preparation" });
|
|
const get = github.rest.issues.get;
|
|
github.rest.issues.get = async payload => {
|
|
const result = await get(payload);
|
|
return { data: { ...result.data, comments: calls.getIssue.length >= 3 ? 2 : result.data.comments } };
|
|
};
|
|
await triage.syncLabels(args);
|
|
assert.equal(calls.getEvents.length, 1);
|
|
assert.equal(calls.getIssue.length, 3);
|
|
assert.deepEqual(calls.addLabels, []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
});
|
|
|
|
for (const [action, initialComments] of [["opened", 0], ["opened", 1], ["edited", 0], ["edited", 1]]) {
|
|
test(`a comment during ${action} metadata preparation preserves the declared review after ${initialComments} earlier comments`, async () => {
|
|
const { args, calls } = topicPreparationRace({ action, initialComments });
|
|
await triage.syncLabels(args);
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["needs-decomposition"]]);
|
|
assert.equal(calls.getEvents.length, initialComments ? 2 : 1);
|
|
assert.equal(calls.getIssue.length, 3, "history must have a final snapshot guard");
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
});
|
|
}
|
|
|
|
test("comment-race recovery keeps companion version metadata and Community labels scoped", async () => {
|
|
const { args, calls } = topicPreparationRace({ eventChanges: {
|
|
body: "### Additional actionable topics\nRetain per-host identity.\n### Pulse version\n6.7.0\n",
|
|
labels: ["bug", "affects-6.5.0", "needs-version-info", "needs-human", "release-blocker",
|
|
"needs-retest-on-latest", "operator-reviewed"].map(name => ({ name })),
|
|
} });
|
|
await triage.syncLabels(args);
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["affects-6.7.0", "needs-decomposition"]]);
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name), ["needs-version-info"]);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
});
|
|
|
|
test("a review cleared during preparation cannot be restored even when its label set matches", async () => {
|
|
for (const initialComments of [0, 1]) {
|
|
const { args, github, calls } = topicPreparationRace({ initialComments });
|
|
github.rest.issues.listEvents = async payload => {
|
|
calls.getEvents.push(payload);
|
|
return { data: calls.getIssue.length === 1 ? [] : [{
|
|
event: "unlabeled", label: { name: "Needs-Decomposition" }, created_at: "2026-10-26T06:01:30Z",
|
|
}] };
|
|
};
|
|
await triage.syncLabels(args);
|
|
assert.equal(calls.getEvents.length, initialComments ? 2 : 1);
|
|
assert.deepEqual(calls.addLabels, []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
}
|
|
});
|
|
|
|
test("preparation-race history is bounded, paginated and preserves lifecycle decisions", async () => {
|
|
const unrelated = { event: "labeled", created_at: "2026-10-26T05:00:00Z" };
|
|
for (const event of [null, "closed", "reopened", "transferred", "converted_to_discussion"]) {
|
|
const { args, calls } = topicPreparationRace({ events: [
|
|
...Array(100).fill(unrelated),
|
|
...(event ? [{ event, created_at: "2026-10-26T06:01:30Z" }] : []),
|
|
] });
|
|
await triage.syncLabels(args);
|
|
assert.deepEqual(calls.getEvents.map(call => call.page), [1, 2]);
|
|
assert.deepEqual(calls.addLabels.flatMap(call => call.labels), event ? [] : ["needs-decomposition"]);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
}
|
|
const { args, calls } = topicPreparationRace({ events: Array(1000).fill(unrelated) });
|
|
await assert.rejects(triage.syncLabels(args), /exceeded the bounded event read/);
|
|
assert.equal(calls.getEvents.length, 10);
|
|
assert.deepEqual(calls.addLabels, []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
});
|
|
|
|
test("changed report, labels or unreadable comment clocks still stop before recovery history", async () => {
|
|
for (const changes of [
|
|
{ body: "### Additional actionable topics\nA different topic.\n" },
|
|
{ title: "A different title" }, { state: "closed" }, { pull_request: {} },
|
|
{ labels: [{ name: "enhancement" }, { name: "needs-human" }] },
|
|
{ comments: 0 }, { comments: undefined }, { comments: -1 }, { comments: 0.5 },
|
|
{ updated_at: "unknown" }, { updated_at: "2026-10-26T05:59:59Z" },
|
|
]) {
|
|
const { args, calls } = topicPreparationRace({ changes });
|
|
await triage.syncLabels(args);
|
|
assert.deepEqual(calls.getEvents, [], JSON.stringify(changes));
|
|
assert.deepEqual(calls.addLabels, [], JSON.stringify(changes));
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
}
|
|
});
|
|
|
|
test("comment-only version decisions do not acquire declaration-recovery authority", async () => {
|
|
const { args, calls } = topicPreparationRace({ eventChanges: {
|
|
body: "### Pulse version\n6.7.0\n", labels: [{ name: "bug" }, { name: "affects-6.5.0" }],
|
|
} });
|
|
await triage.syncLabels(args);
|
|
assert.deepEqual(calls.getEvents, []);
|
|
assert.deepEqual(calls.addLabels, []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
});
|
|
|
|
test("a preparation-race history failure is not retried or replaced by a mutation", async () => {
|
|
for (const result of [403, 404, 500, null, {}, [{ event: "unlabeled", created_at: "2026-10-26T06:01:30Z" }]]) {
|
|
const { args, github, calls } = topicPreparationRace();
|
|
github.rest.issues.listEvents = async payload => {
|
|
calls.getEvents.push(payload);
|
|
if (typeof result === "number") throw Object.assign(new Error("history unavailable"), { status: result });
|
|
return { data: result };
|
|
};
|
|
await assert.rejects(triage.syncLabels(args));
|
|
assert.equal(calls.getEvents.length, 1);
|
|
assert.equal(calls.getIssue.length, 2 + calls.removeLabel.length);
|
|
assert.deepEqual(calls.addLabels, []);
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
}
|
|
});
|
|
|
|
test("further activity during recovery history stops without another reconciliation or write", async () => {
|
|
for (const changes of [
|
|
{ comments: 2, updated_at: "2026-10-26T06:03:00Z" },
|
|
{ comments: 2 },
|
|
{ body: "### Additional actionable topics\nRevised again.\n" },
|
|
{ title: "Another report" }, { state: "closed" }, { pull_request: {} },
|
|
{ labels: [{ name: "enhancement" }, { name: "needs-human" }] },
|
|
{ labels: [{ name: "enhancement" }, { name: "needs-decomposition" }] },
|
|
]) {
|
|
const { args, github, calls } = topicPreparationRace();
|
|
github.rest.issues.listEvents = async payload => {
|
|
calls.getEvents.push(payload);
|
|
github.currentIssue = { ...github.currentIssue, ...changes };
|
|
return { data: [] };
|
|
};
|
|
await triage.syncLabels(args);
|
|
assert.equal(calls.getEvents.length, 1);
|
|
assert.equal(calls.getIssue.length, 3);
|
|
assert.deepEqual(calls.addLabels, [], JSON.stringify(changes));
|
|
assert.deepEqual(calls.removeLabel, []);
|
|
assert.deepEqual(calls.createComment, []);
|
|
}
|
|
});
|
|
|
|
for (const labelLength of [50, 51, 512]) {
|
|
test(`a ${labelLength}-character version label cannot lose independent topic review`, async () => {
|
|
const version = `6.6.0-${"x".repeat(labelLength - "affects-6.6.0-".length)}`;
|
|
const versionLabel = `affects-${version}`;
|
|
assert.equal(versionLabel.length, labelLength);
|
|
const preserved = ["bug", "needs-human", "release-blocker", "needs-retest-on-latest", "operator-reviewed"];
|
|
const issue = { number: 2930, title: "Current report", comments: 0,
|
|
body: `### Pulse version\n${version}\n\n### Additional actionable topics\nThe saved connection also loses its label.`,
|
|
labels: [...preserved, "affects-6.5.0", "needs-version-info"].map(name => ({ name })) };
|
|
const { github, calls } = createGithub();
|
|
const createLabel = github.rest.issues.createLabel;
|
|
github.rest.issues.createLabel = async (payload) => {
|
|
if (payload.name.length > 50) {
|
|
throw Object.assign(new Error("Label name exceeds 50 characters"), {
|
|
status: 422,
|
|
response: { data: { errors: [{ resource: "Label", field: "name", code: "invalid" }] } },
|
|
});
|
|
}
|
|
return createLabel(payload);
|
|
};
|
|
|
|
await syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
|
|
// A representation limit neither changes the declared version nor makes
|
|
// it missing. No truncated label or reporter request can substitute for it.
|
|
assert.equal(triage.internals.extractPulseVersion(issue.title, issue.body), version);
|
|
const expected = labelLength <= 50 ? [versionLabel, "needs-decomposition"] : ["needs-decomposition"];
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [expected.sort()]);
|
|
assert.deepEqual(calls.createLabel.map(call => call.name).sort(), expected.sort());
|
|
assert.deepEqual(calls.getLabel.sort(), expected.sort(), "never send an oversized version label to GitHub");
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name), ["needs-version-info"]);
|
|
assert.ok(!calls.removeLabel.some(call => preserved.includes(call.name)));
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
assert.equal(calls.getIssue.length, 2 + calls.removeLabel.length, "keep the final live-read guard");
|
|
});
|
|
}
|
|
|
|
// Model actual successive provider writes: unlike a call-only mock, each GET
|
|
// returns the labels left by completed writes and any intervening human edit.
|
|
function midWriteFixture({ afterAdd, afterRemove, labels } = {}) {
|
|
let current = {
|
|
number: 42, title: "Synthetic missing readings", state: "open", comments: 0,
|
|
body: "### Pulse version\n6.7.0\n", updated_at: "2026-10-29T00:00:00Z",
|
|
labels: (labels || ["bug", "affects-6.5.0", "needs-version-info", "needs-human"])
|
|
.map(name => ({ name })),
|
|
};
|
|
const issue = structuredClone(current);
|
|
const calls = { get: 0, added: [], removed: [], comments: 0 };
|
|
const github = { rest: { issues: {
|
|
async get() {
|
|
calls.get += 1;
|
|
return { data: structuredClone(current) };
|
|
},
|
|
async getLabel({ name }) { return { data: { name } }; },
|
|
async addLabels({ labels: additions }) {
|
|
calls.added.push(...additions);
|
|
current.labels.push(...additions.map(name => ({ name })));
|
|
current.updated_at = "2026-10-29T00:00:01Z";
|
|
afterAdd?.(current, github, calls);
|
|
return { data: structuredClone(current.labels) };
|
|
},
|
|
async removeLabel({ name }) {
|
|
calls.removed.push(name);
|
|
current.labels = current.labels.filter(label => label.name.toLowerCase() !== name.toLowerCase());
|
|
current.updated_at = "2026-10-29T00:00:02Z";
|
|
afterRemove?.(current, github, calls);
|
|
return { data: structuredClone(current.labels) };
|
|
},
|
|
async createComment() { calls.comments += 1; },
|
|
} } };
|
|
return { calls, github, read: () => structuredClone(current),
|
|
run: () => triage.syncLabels({ github, core: createCore(),
|
|
context: createContext({ issue }) }) };
|
|
}
|
|
|
|
const midWriteChanges = {
|
|
"reporter version correction": current => { current.body = "### Pulse version\nunknown\n"; },
|
|
"report title correction": current => { current.title = "Different affected workload"; },
|
|
"same-second human comment": current => { current.comments += 1; },
|
|
"Community label addition": current => { current.labels.push({ name: "operator-reviewed" }); },
|
|
"Community label removal": current => {
|
|
current.labels = current.labels.filter(label => label.name !== "needs-human");
|
|
},
|
|
"closed report": current => { current.state = "closed"; },
|
|
"converted pull request": current => { current.pull_request = {}; },
|
|
};
|
|
|
|
for (const [name, change] of Object.entries(midWriteChanges)) {
|
|
test(`a ${name} after label additions stops stale removals`, async () => {
|
|
const fixture = midWriteFixture({ afterAdd: change });
|
|
await fixture.run();
|
|
assert.deepEqual(fixture.calls.added, ["affects-6.7.0"]);
|
|
assert.deepEqual(fixture.calls.removed, [], "do not complete or undo an obsolete prepared delta");
|
|
assert.equal(fixture.calls.comments, 0);
|
|
});
|
|
|
|
test(`a ${name} after missing-version retirement cannot cause another write`, async () => {
|
|
const fixture = midWriteFixture({ afterRemove: change });
|
|
await fixture.run();
|
|
assert.deepEqual(fixture.calls.removed, ["needs-version-info"]);
|
|
assert.ok(fixture.read().labels.some(label => label.name === "affects-6.5.0"));
|
|
assert.equal(fixture.calls.comments, 0);
|
|
});
|
|
}
|
|
|
|
test("completed own label writes do not obstruct the remaining exact delta", async () => {
|
|
for (const labels of [undefined,
|
|
["bug", "affects-6.7.0", "affects-6.5.0", "needs-version-info", "needs-human"]]) {
|
|
const fixture = midWriteFixture({ labels });
|
|
await fixture.run();
|
|
assert.deepEqual(fixture.calls.added, labels ? [] : ["affects-6.7.0"]);
|
|
assert.deepEqual(fixture.calls.removed, ["needs-version-info"]);
|
|
assert.deepEqual(fixture.read().labels.map(label => label.name).sort(),
|
|
["affects-6.5.0", "affects-6.7.0", "bug", "needs-human"]);
|
|
}
|
|
});
|
|
|
|
test("post-write reads follow the provider's label identities, not requested spelling", async () => {
|
|
const fixture = midWriteFixture({ afterAdd: current => {
|
|
current.labels.find(label => label.name === "affects-6.7.0").name = "AFFECTS-6.7.0";
|
|
} });
|
|
await fixture.run();
|
|
assert.deepEqual(fixture.calls.removed, ["needs-version-info"]);
|
|
assert.ok(fixture.read().labels.some(label => label.name === "AFFECTS-6.7.0"));
|
|
});
|
|
|
|
test("a failed read after a completed addition stops before retirement without replay or rollback", async () => {
|
|
const fixture = midWriteFixture({ afterAdd: (_current, github) => {
|
|
github.rest.issues.get = async () => { throw Object.assign(new Error("read denied"), { status: 403 }); };
|
|
} });
|
|
await assert.rejects(fixture.run(), error => error.status === 403);
|
|
assert.deepEqual(fixture.calls.added, ["affects-6.7.0"]);
|
|
assert.deepEqual(fixture.calls.removed, []);
|
|
assert.equal(fixture.calls.comments, 0);
|
|
});
|
|
|
|
for (const [name, marker, sibling] of [
|
|
["unordered", "-", "-"],
|
|
["alternate unordered", "*", "*"],
|
|
["ordered", "1.", "2."],
|
|
["plus unordered", "+", "+"],
|
|
]) {
|
|
test(`loose ${name} lists retain their first-line legacy version declaration`, () => {
|
|
for (const newline of ["\n", "\r\n"]) {
|
|
for (const [label, value, expected] of [
|
|
["**Pulse version**", "6.6.0", "6.6.0"],
|
|
["Pulse version", "unknown", null],
|
|
["_Pulse version_", "6.6", null],
|
|
["**[Pulse version][field]**", "[`v6.7.0-beta.2`][release]", "6.7.0-beta.2"],
|
|
["Pulse version", "`6.5.0`", "6.5.0"],
|
|
["Pulse version", "6.5.0 → 6.6.0", null],
|
|
]) {
|
|
const field = `${marker} ${label}: ${value}`;
|
|
const rest = `${sibling} Agent version: 9.9.9\n\n` +
|
|
"[field]: https://example.invalid/ignored\n" +
|
|
"[release]: https://example.invalid/6.4.5";
|
|
for (const gap of ["\n", "\n\n"]) {
|
|
const body = `${field}${gap}${rest}`.replaceAll("\n", newline);
|
|
assert.equal(triage.internals.extractPulseVersion("[Bug]: v6.4.5 upgrade failed", body),
|
|
expected, body);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
test("later paragraphs, lazy lines and nested loose-list fields stay copied evidence", () => {
|
|
for (const copied of [
|
|
"- Existing observations\n\n Pulse version: 6.4.5\n\n- More observations",
|
|
"- Existing observations\nPulse version: 6.4.5\n\n- More observations",
|
|
"- Existing observations\n\n - Pulse version: 6.4.5\n\n- More observations",
|
|
"- Existing observations\n\n ### Pulse version\n 6.4.5\n\n- More observations",
|
|
]) {
|
|
for (const newline of ["\n", "\r\n"]) {
|
|
const body = copied.replaceAll("\n", newline);
|
|
assert.equal(triage.internals.extractPulseVersion("Unversioned report", body), null, body);
|
|
assert.equal(triage.internals.extractPulseVersion("Unversioned report",
|
|
body + newline.repeat(2) + "Pulse version: 6.6.0"), "6.6.0", body);
|
|
}
|
|
}
|
|
});
|
|
|
|
test("loose lists cannot promote literal, withdrawn or nested first blocks into declarations", () => {
|
|
for (const item of [
|
|
"- `Pulse version`: 6.4.5",
|
|
"- ~~Pulse version~~: 6.4.5",
|
|
"- : 6.4.5",
|
|
"- > Pulse version: 6.4.5",
|
|
"- ### Pulse version\n 6.4.5",
|
|
"- ```text\n Pulse version: 6.4.5\n ```",
|
|
]) {
|
|
const body = `${item}\n\n- Other observations\n\nPulse version: 6.6.0`;
|
|
assert.equal(triage.internals.extractPulseVersion("Unversioned report", body), "6.6.0", body);
|
|
}
|
|
});
|
|
|
|
for (const action of ["opened", "edited", "reopened"]) {
|
|
test(`${action} consumes an explicit loose-list version without replacing Community decisions`, async () => {
|
|
for (const [value, version] of [["6.6.0", "6.6.0"], ["unknown", null], ["6.6", null]]) {
|
|
const preserved = ["bug", "needs-human", "release-blocker", "stable-regression",
|
|
"needs-retest-on-latest", "needs-decomposition", "operator-reviewed"];
|
|
const issue = { number: 42, title: "[Bug]: v6.4.5 upgrade failed",
|
|
body: `- **Pulse version**: ${value}\n\n- Agent version: 9.9.9`,
|
|
labels: [...preserved, "affects-6.4.5"].map(name => ({ name })) };
|
|
const { github, calls } = createGithub();
|
|
await syncLabels({ github, core: createCore(), context: createContext({ issue, action }) });
|
|
const desired = version ? `affects-${version}` : "needs-version-info";
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [[desired]]);
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name), []);
|
|
assert.deepEqual(github.currentIssue.labels.map(label => label.name).sort(),
|
|
withAffectedVersions(issue, [...preserved, desired].sort()));
|
|
assert.equal(calls.getIssue.length, 2, "keep the pre-write live read for the single addition");
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.getEvents, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
}
|
|
});
|
|
}
|
|
|
|
test("loose-list version declarations inside secondary topics remain topic evidence", () => {
|
|
const body = "### Additional actionable topics\nAnother installation has:\n\n" +
|
|
"- **Pulse version**: 6.4.5\n\n- A separate loss of readings\n\n" +
|
|
"### Pulse version\n6.6.0";
|
|
assert.equal(triage.internals.extractPulseVersion("Unversioned report", body), "6.6.0");
|
|
assert.equal(triage.internals.classifyAdditionalActionableTopics(body), true);
|
|
});
|
|
|
|
test("malformed version tokens cannot be shortened or salvaged into another release", () => {
|
|
for (const value of ["6.6.0.1", "v6.6.0.12", "6.6.0-", "V6.6.0-beta..3", "6.6.0-beta_3", "6.6.0-beta..-v6.5.0"]) {
|
|
assert.equal(triage.internals.normalizeVersion(value), null, value);
|
|
}
|
|
});
|
|
|
|
test("explicit malformed versions remain authoritative in all supported Markdown layouts", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
for (const value of ["6.6.0.1", "6.6.0-", "6.6.0-beta..3", "6.6.0-beta_3", "6.6.0-beta..-v6.5.0"]) {
|
|
for (const body of [
|
|
`### Pulse version\n${value}\n\n### Agent version\n6.5.0`,
|
|
`**Pulse version:** ${value}\nAgent version: 6.5.0`,
|
|
`Pulse version\n${value}\nAgent version: 6.5.0`,
|
|
`- **Pulse version**: ${value}\n- Agent version: 6.5.0`,
|
|
`1. **Pulse version**: ${value}\n\n2. Agent version: 6.5.0`,
|
|
`### Pulse version\n\`\`\`text\n${value}\n\`\`\`\n### Agent version\n6.5.0`,
|
|
`### Pulse version\n[${value}][release]\n\n[release]: https://example.invalid/6.6.0`,
|
|
]) {
|
|
assert.equal(extractPulseVersion("Pulse 6.4.5 update failed", body), null, body);
|
|
}
|
|
}
|
|
});
|
|
|
|
test("title fallback does not shorten a malformed server or neutral version token", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
for (const value of ["6.6.0.1", "6.6.0-", "6.6.0-beta..3", "6.6.0-beta_3", "6.6.0-beta..-v6.5.0"]) {
|
|
for (const title of [
|
|
`Pulse ${value} loses readings`,
|
|
`Pulse Pro version: V${value} loses readings`,
|
|
`rcourtman/pulse:${value} loses readings`,
|
|
`[Bug]: v${value} loses readings`,
|
|
`Bug on v${value}`,
|
|
]) {
|
|
assert.equal(extractPulseVersion(title, "Legacy report."), null, title);
|
|
assert.equal(extractPulseVersion(title, "### Pulse version\n6.5.0"), "6.5.0", title);
|
|
}
|
|
}
|
|
});
|
|
|
|
test("complete stable and prerelease tokens retain their full value and ordinary punctuation", () => {
|
|
const { extractPulseVersion, normalizeVersion } = triage.internals;
|
|
for (const version of ["6.6.0", "6.7.0-beta.3", "6.6.0-RC.6", "6.7.0-alpha-2.3", "6.7.0-alpha-"]) {
|
|
for (const suffix of ["", ".", "...", ", still failing", " (Docker)", "; agent 6.5.0"]) {
|
|
const value = `V${version}${suffix}`;
|
|
assert.equal(normalizeVersion(value), version, value);
|
|
assert.equal(extractPulseVersion("Upgrade from 6.4.5", `### Pulse version\n${value}`), version, value);
|
|
assert.equal(extractPulseVersion(`Pulse ${value}`, "Legacy report."), version, value);
|
|
}
|
|
}
|
|
});
|
|
|
|
test("malformed attempted archives cannot borrow a valid dotted fragment", () => {
|
|
for (const stem of ["pulse", "pulse-pro"]) {
|
|
for (const value of ["6.6.0.1", "6.6.0-beta..3", "6.6.0-beta..-v6.5.0"]) {
|
|
const archive = `${stem}-v${value}-linux-amd64.tar.gz`;
|
|
assert.equal(triage.internals.extractPulseVersion("Pulse 6.4.5 install failed",
|
|
`### Pulse version\n\`${archive}\``), null, archive);
|
|
}
|
|
}
|
|
});
|
|
|
|
for (const action of ["opened", "edited", "reopened"]) {
|
|
test(`${action} malformed-version metadata preserves Community decisions and accepts a later correction`, async () => {
|
|
for (const value of ["6.6.0.1", "6.6.0-", "6.6.0-beta..3", "6.6.0-beta_3", "6.6.0-beta..-v6.5.0"]) {
|
|
const preserved = ["bug", "needs-retest-on-latest", "needs-decomposition", "operator-reviewed", "affects-storage"];
|
|
const issue = { number: 42, state: "open", title: "Pulse 6.4.5 update failed",
|
|
body: `### Pulse version\n${value}\n\n### Additional actionable topics\nKeep failed attempts visible.`,
|
|
updated_at: "2026-10-29T03:40:00Z", comments: 1,
|
|
labels: [...preserved, "affects-6.5.0"].map(name => ({ name })) };
|
|
const { github, calls } = createGithub({ currentIssue: issue });
|
|
const context = { repo: { owner: "fixture", repo: "fixture" }, payload: { action, issue } };
|
|
await triage.syncLabels({ github, context, core: { info() {} } });
|
|
assert.deepEqual(calls.addLabels.map(call => call.labels), [["needs-version-info"]], value);
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name), [], value);
|
|
assert.deepEqual(github.currentIssue.labels.map(label => label.name).sort(),
|
|
withAffectedVersions(issue, [...preserved, "needs-version-info"].sort(), value));
|
|
assert.deepEqual(calls.createLabel.map(call => call.name), ["needs-version-info"], value);
|
|
|
|
github.currentIssue = { ...github.currentIssue, body: issue.body.replace(value, "6.7.0-beta.3"),
|
|
updated_at: "2026-10-29T03:41:00Z" };
|
|
await triage.syncLabels({ github, context: { ...context, payload: { action: "edited", issue: github.currentIssue } },
|
|
core: { info() {} } });
|
|
assert.deepEqual(github.currentIssue.labels.map(label => label.name).sort(),
|
|
withAffectedVersions(issue, [...preserved, "affects-6.7.0-beta.3"].sort(), value));
|
|
assert.equal(calls.getLatestRelease.length, 0);
|
|
assert.equal(calls.createComment.length, 0);
|
|
assert.equal(calls.getEvents.length, 0);
|
|
}
|
|
});
|
|
}
|
|
|
|
test("repeated form versions require agreement rather than field order", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
for (const second of ["6.7.0-beta.2", "unknown", "", "6.6.0.1"]) {
|
|
for (const values of [["6.6.0", second], [second, "6.6.0"]]) {
|
|
for (const heading of ["### Pulse version", "## **Pulse version**", "Pulse version\n-------------"]) {
|
|
const body = values.map(value => `${heading}\n\n${value}`).join("\n\n");
|
|
assert.equal(extractPulseVersion("Pulse 6.4.5 update failed", body), null, body);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
test("matching repeated form versions retain formatting, references and attempted archives", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
for (const version of ["6.6.0", "6.7.0-beta.2"]) {
|
|
for (const value of [
|
|
`**\`v${version}\`**`, `[v${version}][release]`,
|
|
`pulse-v${version}-linux-amd64.tar.gz`, `rcourtman/pulse:${version}`,
|
|
`\`\`\`text\n${version}\n\`\`\``,
|
|
]) {
|
|
const body = `### Pulse version\nv${version}\n\n### Pulse version\n${value}\n\n` +
|
|
`[release]: https://example.invalid/6.4.5`;
|
|
assert.equal(extractPulseVersion("Pulse 6.4.5 update failed", body), version, body);
|
|
}
|
|
}
|
|
assert.equal(extractPulseVersion("Unversioned report",
|
|
"### Pulse version\n6.6.0-RC.6\n\n### Pulse version\n6.6.0-rc.6"), "6.6.0-RC.6");
|
|
});
|
|
|
|
test("legacy repeated versions require agreement in inline, standalone and loose list layouts", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
for (const label of ["Pulse version: ", "**Pulse version**\n", "- **Pulse version**: ", "1. **Pulse version**: "]) {
|
|
for (const [second, expected] of [["v6.6.0", "6.6.0"], ["6.7.0-beta.2", null], ["unknown", null], ["6.6.0-", null]]) {
|
|
for (const values of [["6.6.0", second], [second, "6.6.0"]]) {
|
|
const body = values.map(value => `${label}${value}`).join("\n\n");
|
|
assert.equal(extractPulseVersion("Pulse 6.4.5 update failed", body), expected, body);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
test("non-declarations and neighbouring versions cannot conflict with the primary field", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
for (const copied of [
|
|
"```text\n### Pulse version\n6.4.5\n```",
|
|
"> ### Pulse version\n> 6.4.5",
|
|
"<pre>\nPulse version: 6.4.5\n</pre>",
|
|
"<!--\n### Pulse version\n6.4.5\n-->",
|
|
"### Agent version\n6.4.5\n### Last known working Pulse version\n6.4.5",
|
|
"### Additional actionable topics\nPreserve this second report.\n\nPulse version: 6.4.5\n\n#### Pulse version\n6.4.5",
|
|
]) {
|
|
const body = `### Pulse version\n6.6.0\n\n${copied}`;
|
|
assert.equal(extractPulseVersion("Pulse 6.4.5 update failed", body), "6.6.0", body);
|
|
}
|
|
});
|
|
|
|
test("form version declarations retain precedence over legacy prose in other form fields", () => {
|
|
const { extractPulseVersion } = triage.internals;
|
|
for (const primary of ["6.6.0", "unknown"]) {
|
|
const body = `### Describe the bug\nPulse version: 6.4.5\n\n### Pulse version\n${primary}\n\n` +
|
|
`### Pulse version\n${primary}\n\n### Additional context\nPulse version: 6.5.0`;
|
|
assert.equal(extractPulseVersion("Pulse 6.3.0 update failed", body), primary === "unknown" ? null : primary);
|
|
}
|
|
});
|
|
|
|
for (const action of ["opened", "edited", "reopened"]) {
|
|
test(`${action} conflicting versions preserve affected-version evidence and Community decisions`, async () => {
|
|
for (const field of ["### Pulse version\n", "Pulse version: ", "- **Pulse version**: "]) {
|
|
const preserved = ["bug", "needs-retest-on-latest", "needs-decomposition", "operator-reviewed", "affects-storage"];
|
|
const issue = { number: 42, state: "open", title: "Pulse 6.4.5 update failed",
|
|
body: `${field}6.6.0\n\n${field}6.7.0-beta.2`, comments: 1,
|
|
updated_at: "2026-10-29T04:34:00Z",
|
|
labels: [...preserved, "affects-6.5.0"].map(name => ({ name })) };
|
|
const { github, calls } = createGithub({ currentIssue: issue });
|
|
await syncLabels({ github, context: createContext({ action, issue }), core: createCore() });
|
|
assert.deepEqual(github.currentIssue.labels.map(label => label.name).sort(),
|
|
withAffectedVersions(issue, [...preserved, "needs-version-info"].sort(), field));
|
|
assert.deepEqual(calls.removeLabel.map(call => call.name), [], field);
|
|
|
|
// Resolving the ambiguity is an ordinary body edit, not a refile or a
|
|
// reporter contact. It can restore the exact version and retire unknown.
|
|
const previousBody = github.currentIssue.body;
|
|
github.currentIssue = { ...github.currentIssue, body: `${field}6.7.0-beta.2\n\n${field}v6.7.0-beta.2`,
|
|
updated_at: "2026-10-29T04:35:00Z" };
|
|
await syncLabels({ github,
|
|
context: createContext({ action: "edited", issue: github.currentIssue, previousBody }), core: createCore() });
|
|
assert.deepEqual(github.currentIssue.labels.map(label => label.name).sort(),
|
|
withAffectedVersions(issue, [...preserved, "affects-6.7.0-beta.2"].sort(), field));
|
|
assert.equal(calls.createComment.length, 0);
|
|
assert.equal(calls.getLatestRelease.length, 0);
|
|
assert.equal(calls.getEvents.length, 0);
|
|
}
|
|
});
|
|
}
|
|
|
|
test("version ambiguity cannot lose an independently declared topic review", async () => {
|
|
const issue = { number: 42, state: "open", title: "Two report declarations",
|
|
body: "### Pulse version\n6.6.0\n\n### Pulse version\n6.7.0-beta.2\n\n" +
|
|
"### Additional actionable topics\nPreserve a separate notification job.",
|
|
comments: 0, updated_at: "2026-10-29T04:34:00Z", labels: [{ name: "bug" }] };
|
|
const { github, calls } = createGithub({ currentIssue: issue });
|
|
await syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
|
assert.deepEqual(github.currentIssue.labels.map(label => label.name).sort(),
|
|
withAffectedVersions(issue, ["bug", "needs-decomposition", "needs-version-info"]));
|
|
assert.equal(calls.createComment.length, 0);
|
|
assert.equal(calls.getLatestRelease.length, 0);
|
|
});
|
|
|
|
for (const action of ["opened", "edited", "reopened"]) {
|
|
test(`${action} form-only metadata preserves every whole-thread affected version`, async () => {
|
|
for (const version of ["6.4.3-rc.1", "6.8.0-beta.1", "unknown", "6.7.0.1",
|
|
"6.7.0\n\n### Pulse version\n6.8.0-beta.1", `6.8.0-${"x".repeat(60)}`]) {
|
|
for (const comments of [0, 7]) {
|
|
const labels = ["bug", "affects-6.3.2", "affects-6.4.3-rc.1", "AFFECTS-6.6.0",
|
|
"affects-6.7.1-rc.1", "stable-regression", "release-blocker", "needs-human",
|
|
"needs-retest-on-latest", "needs-decomposition", "operator-reviewed"];
|
|
const issue = { number: 42, state: "open", title: "Synthetic multi-version report",
|
|
body: `### Pulse version\n${version}\n`, comments,
|
|
updated_at: "2026-11-03T06:00:00Z", labels: labels.map(name => ({ name })) };
|
|
const { github, calls } = createGithub({ currentIssue: issue });
|
|
await syncLabels({ github, context: createContext({ action, issue }), core: createCore() });
|
|
for (const label of labels) {
|
|
assert.ok(github.currentIssue.labels.some(current => current.name === label), `${action}: ${version}: ${label}`);
|
|
}
|
|
assert.deepEqual(calls.removeLabel, [], version);
|
|
assert.deepEqual(calls.createComment, []);
|
|
assert.deepEqual(calls.getLatestRelease, []);
|
|
assert.deepEqual(calls.getEvents, []);
|
|
assert.deepEqual(calls.paginate, []);
|
|
}
|
|
}
|
|
});
|
|
}
|