Skip to content

Commit 43a71a7

Browse files
committed
test(signals): cover decidePublicSurface's oss_maintainer + not_checked willLabel fallback (#8324)
The inline fallback disjunct in willLabel's computation (settings.publicAudienceMode === "oss_maintainer" && input.minerStatus === "not_checked" && settings.autoLabelEnabled && (comment_and_label || label_only)) had zero test coverage despite decidePublicSurface's own doc comment claiming it's the single source of truth shared by the live webhook processor and the maintainer-facing dry-run preview. Adds four tests covering every combination of autoLabelEnabled and publicSurface for this branch: labels for comment_and_label and label_only, does not label for comment_only or when autoLabelEnabled is false. shouldApplyPrLabel itself always returns false for oss_maintainer + any non-confirmed status, so willLabel: true in these tests is exclusively exercising the inline fallback, not double-satisfied by the imported function. Pure test-addition, no production code changed.
1 parent f1b5cc1 commit 43a71a7

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

test/unit/settings-preview.test.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,47 @@ describe("decidePublicSurface", () => {
8383
expect(decision.actions).toEqual(["comment", "label"]);
8484
});
8585

86+
describe("oss_maintainer + not_checked willLabel fallback (#8324)", () => {
87+
// shouldApplyPrLabel itself always returns false for oss_maintainer + any non-"confirmed" status (including
88+
// "not_checked"), so any willLabel: true below is coming exclusively from decidePublicSurface's own inline
89+
// fallback disjunct, not double-satisfied by the imported function.
90+
it("labels when autoLabelEnabled and publicSurface is comment_and_label", () => {
91+
const decision = decidePublicSurface({
92+
settings: settings({ publicAudienceMode: "oss_maintainer", autoLabelEnabled: true, publicSurface: "comment_and_label" }),
93+
authorLogin: "miner",
94+
minerStatus: "not_checked",
95+
});
96+
expect(decision.willLabel).toBe(true);
97+
});
98+
99+
it("labels when autoLabelEnabled and publicSurface is label_only", () => {
100+
const decision = decidePublicSurface({
101+
settings: settings({ publicAudienceMode: "oss_maintainer", autoLabelEnabled: true, publicSurface: "label_only" }),
102+
authorLogin: "miner",
103+
minerStatus: "not_checked",
104+
});
105+
expect(decision.willLabel).toBe(true);
106+
});
107+
108+
it("does NOT label when autoLabelEnabled but publicSurface is comment_only (excluded by the disjunct's own publicSurface check)", () => {
109+
const decision = decidePublicSurface({
110+
settings: settings({ publicAudienceMode: "oss_maintainer", autoLabelEnabled: true, publicSurface: "comment_only" }),
111+
authorLogin: "miner",
112+
minerStatus: "not_checked",
113+
});
114+
expect(decision.willLabel).toBe(false);
115+
});
116+
117+
it("does NOT label when autoLabelEnabled is false, regardless of publicSurface", () => {
118+
const decision = decidePublicSurface({
119+
settings: settings({ publicAudienceMode: "oss_maintainer", autoLabelEnabled: false, publicSurface: "comment_and_label" }),
120+
authorLogin: "miner",
121+
minerStatus: "not_checked",
122+
});
123+
expect(decision.willLabel).toBe(false);
124+
});
125+
});
126+
86127
it("skips disabled surfaces, bots, maintainer authors, non-miners, and unavailable detection", () => {
87128
expect(decidePublicSurface({ settings: settings({ publicSurface: "off", checkRunMode: "off" }), authorLogin: "miner", minerStatus: "confirmed" }).skipReason).toBe("surface_off");
88129
expect(decidePublicSurface({ settings: settings(), authorLogin: null, minerStatus: "confirmed" }).skipReason).toBe("missing_author");

0 commit comments

Comments
 (0)