Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/signals/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4977,8 +4977,9 @@ export function hasClearNoIssueRationale(pr: Pick<PullRequestRecord, "title" | "
// `docs? only` missed the hyphen, so a docs-only PR with no linked issue was wrongly denied a clear
// no-issue rationale and hard-blocked under `linkedIssueGateMode === "block"`.
// `tests?[\s-]+only` extends the same rule to test-only PRs (regression/coverage-only diffs) — parallel
// to the docs-only hyphenation fix merged in #1905.
return /\b(?:no issue\s*(?:because\b|:)|no linked issue\s*(?:because\b|:)|no ticket\s*(?:because\b|:)|(?:maintenance|docs?[\s-]+only|tests?[\s-]+only|typo|chore|cleanup)\b)/i.test([pr.title, pr.body ?? ""].join(" "));
// to the docs-only hyphenation fix merged in #1905 and the test-only follow-up in #1993.
// `refactor[\s-]+only` covers internal refactors with no behavior change using the same spelling.
return /\b(?:no issue\s*(?:because\b|:)|no linked issue\s*(?:because\b|:)|no ticket\s*(?:because\b|:)|(?:maintenance|docs?[\s-]+only|tests?[\s-]+only|refactor[\s-]+only|typo|chore|cleanup)\b)/i.test([pr.title, pr.body ?? ""].join(" "));
}

function hasValidationNote(value: string): boolean {
Expand Down
13 changes: 13 additions & 0 deletions test/unit/signals-v2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1774,6 +1774,19 @@ describe("hasClearNoIssueRationale test-only spelling", () => {
});
});

describe("hasClearNoIssueRationale refactor-only spelling", () => {
it("recognizes hyphenated and spaced refactor-only rationales", () => {
expect(hasClearNoIssueRationale({ title: "refactor only: split helper", body: "" })).toBe(true);
expect(hasClearNoIssueRationale({ title: "refactor-only: split helper", body: "" })).toBe(true);
expect(hasClearNoIssueRationale({ title: "Rename queue module", body: "This is a refactor only rename." })).toBe(true);
});

it("still rejects unrelated PR text that mentions refactors without a rationale", () => {
expect(hasClearNoIssueRationale({ title: "Refactor queue processor", body: "Extracts shared helper." })).toBe(false);
expect(hasClearNoIssueRationale({ title: "Improve signal engine structure", body: "" })).toBe(false);
});
});

function snapshot(
id: string,
repositories: Array<{
Expand Down
Loading