Skip to content
Merged
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
4 changes: 3 additions & 1 deletion src/signals/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4958,7 +4958,9 @@ export function hasClearNoIssueRationale(pr: Pick<PullRequestRecord, "title" | "
// spelling this function's own docstring uses — the dominant GitHub/Conventional-Commits form. A bare
// `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"`.
return /\b(?:no issue\s*(?:because\b|:)|no linked issue\s*(?:because\b|:)|no ticket\s*(?:because\b|:)|(?:maintenance|docs?[\s-]+only|typo|chore|cleanup)\b)/i.test([pr.title, pr.body ?? ""].join(" "));
// `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(" "));
}

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

describe("hasClearNoIssueRationale test-only spelling", () => {
it("recognizes hyphenated and spaced test-only rationales", () => {
expect(hasClearNoIssueRationale({ title: "test only: lock regression", body: "" })).toBe(true);
expect(hasClearNoIssueRationale({ title: "test-only: lock regression", body: "" })).toBe(true);
expect(hasClearNoIssueRationale({ title: "tests-only coverage", body: "" })).toBe(true);
expect(hasClearNoIssueRationale({ title: "Add branch classifier", body: "This is a tests only change." })).toBe(true);
});

it("still rejects unrelated PR text that mentions tests without a rationale", () => {
expect(hasClearNoIssueRationale({ title: "Add tests for classifier", body: "Adds coverage." })).toBe(false);
expect(hasClearNoIssueRationale({ title: "Improve test harness", body: "" })).toBe(false);
});
});

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