ci(duplicate-check): only warn about the auto close the sweep will actually do

The notice now asks the sweep's own duplicateTarget whether the title
match would close the issue, so a two-word title no longer gets a close
warning the sweep would refuse to act on. The ask no longer promises
that a reply removes the label, since nothing does that automatically
This commit is contained in:
ryan-crabbe-berri 2026-09-12 20:27:37 -07:00
parent 009d6f364b
commit 5bad1a85f7
2 changed files with 15 additions and 4 deletions

View file

@ -85,6 +85,17 @@ describe("noticeBody", () => {
const closedTwin = issue(10, "[bug] gemma 4-e4b fails on vertex!", { state: "closed" });
expect(noticeBody(reporter, closedTwin, "Same stack.")).not.toContain("closes automatically");
expect(duplicateTarget(reporter, [closedTwin], []).kind).toBe("skip");
const short = issue(35, "[Bug]: Vertex crash");
const shortTwin = issue(10, "Vertex crash");
expect(noticeBody(short, shortTwin, "Same stack.")).not.toContain("closes automatically");
expect(duplicateTarget(short, [shortTwin], []).kind).toBe("skip");
});
test("never promises a label removal nothing performs", () => {
const body = noticeBody(reporter, issue(10, "Vertex Gemma 4 crash"), "Same stack.");
expect(body).toContain("a maintainer will take the label off");
expect(body).not.toContain("the label comes off");
});
});

View file

@ -3,9 +3,9 @@
import {
DEFAULT_GRACE_DAYS,
FLAG_LABEL,
duplicateTarget,
githubApi,
listAll,
normalizeTitle,
type Comment,
type GitHubApi,
type Issue,
@ -87,9 +87,9 @@ export function noticeBody(issue: Issue, prior: Issue, evidence: string): string
? `**Already reported in #${prior.number}**, which is closed`
: `**Possible duplicate of #${prior.number}**`;
const ask = closed
? "If that issue covers this one, follow up there. If this is a new case, say so here and the label comes off."
: `If that is right, add a thumbs-up to #${prior.number} and follow along there. If it is not, say so here and the label comes off.`;
const autoCloses = !closed && normalizeTitle(issue.title) === normalizeTitle(prior.title);
? "If that issue covers this one, follow up there. If this is a new case, say so here and a maintainer will take the label off."
: `If that is right, add a thumbs-up to #${prior.number} and follow along there. If it is not, say so here and a maintainer will take the label off.`;
const autoCloses = duplicateTarget(issue, [prior], []).kind === "close";
const warning = autoCloses
? `\n\nYour title is identical to #${prior.number}, so this issue closes automatically in ${DEFAULT_GRACE_DAYS} days unless someone responds here.`
: "";