Context
src/signals/settings-preview.ts's decidePublicSurface is documented as "the single source of truth" for what the GitHub App's public surface does for a PR, "shared by the live webhook processor and the maintainer-facing dry-run preview, so the preview can never drift from real behavior." Its willLabel computation (around line 143-146) is:
const willLabel =
shouldApplyPrLabel(settings, input.minerStatus) ||
(settings.publicAudienceMode === "oss_maintainer" && input.minerStatus === "not_checked" && settings.autoLabelEnabled && (settings.publicSurface === "comment_and_label" || settings.publicSurface === "label_only"));
The second disjunct is an inline fallback condition that duplicates (and diverges from) the logic already encapsulated in the imported shouldApplyPrLabel function — it exists specifically to handle publicAudienceMode: "oss_maintainer" combined with minerStatus: "not_checked", a real combination that governs whether a webhook run (src/queue/processors.ts) actually applies a label without having completed the official Gittensor miner lookup.
This exact branch has zero test coverage: grep -n "not_checked" test/unit/settings-preview.test.ts returns no matches at all. Given the function's own stated "single source of truth, preview can never drift from real behavior" contract, an untested fallback branch is a real risk — if shouldApplyPrLabel's own logic changes in the future without a matching update here, this inline condition could silently diverge from the imported function's intent with no test catching it.
Requirements
- Add test coverage in
test/unit/settings-preview.test.ts for decidePublicSurface with settings.publicAudienceMode: "oss_maintainer" and input.minerStatus: "not_checked", covering:
autoLabelEnabled: true with publicSurface: "comment_and_label" → willLabel (and thus the label action) is included.
autoLabelEnabled: true with publicSurface: "label_only" → willLabel is included.
autoLabelEnabled: true with publicSurface: "comment_only" → willLabel is NOT included (the disjunct's own publicSurface check must exclude this).
autoLabelEnabled: false → willLabel is NOT included via this fallback (falls back to shouldApplyPrLabel's own result).
- Do not change
decidePublicSurface's behavior as part of this issue — this is a test-coverage gap on existing, currently-uncovered branchy logic, not a behavior change. If while writing the tests a genuine divergence from shouldApplyPrLabel's intent is found, note it in the PR description rather than silently "fixing" it, since intent here needs a maintainer read.
Deliverables
Test Coverage Requirements
This repo's Codecov patch gate requires 99%+ coverage of changed lines and branches — since this issue is pure test addition (no production code changes), the goal is closing the existing branch-coverage gap on decidePublicSurface's willLabel computation, specifically every operand of the && chain in the second disjunct.
Expected Outcome
decidePublicSurface's oss_maintainer + not_checked labeling fallback is exercised by explicit tests for every combination of autoLabelEnabled and publicSurface, closing a real branch-coverage gap on a function whose own doc comment claims it's the authoritative, drift-proof source of truth for this behavior.
Links & Resources
src/signals/settings-preview.ts — decidePublicSurface, willLabel computation around line 143-146
test/unit/settings-preview.test.ts — existing coverage (533 lines), no not_checked cases today
Context
src/signals/settings-preview.ts'sdecidePublicSurfaceis documented as "the single source of truth" for what the GitHub App's public surface does for a PR, "shared by the live webhook processor and the maintainer-facing dry-run preview, so the preview can never drift from real behavior." ItswillLabelcomputation (around line 143-146) is:The second disjunct is an inline fallback condition that duplicates (and diverges from) the logic already encapsulated in the imported
shouldApplyPrLabelfunction — it exists specifically to handlepublicAudienceMode: "oss_maintainer"combined withminerStatus: "not_checked", a real combination that governs whether a webhook run (src/queue/processors.ts) actually applies a label without having completed the official Gittensor miner lookup.This exact branch has zero test coverage:
grep -n "not_checked" test/unit/settings-preview.test.tsreturns no matches at all. Given the function's own stated "single source of truth, preview can never drift from real behavior" contract, an untested fallback branch is a real risk — ifshouldApplyPrLabel's own logic changes in the future without a matching update here, this inline condition could silently diverge from the imported function's intent with no test catching it.Requirements
test/unit/settings-preview.test.tsfordecidePublicSurfacewithsettings.publicAudienceMode: "oss_maintainer"andinput.minerStatus: "not_checked", covering:autoLabelEnabled: truewithpublicSurface: "comment_and_label"→willLabel(and thus thelabelaction) is included.autoLabelEnabled: truewithpublicSurface: "label_only"→willLabelis included.autoLabelEnabled: truewithpublicSurface: "comment_only"→willLabelis NOT included (the disjunct's ownpublicSurfacecheck must exclude this).autoLabelEnabled: false→willLabelis NOT included via this fallback (falls back toshouldApplyPrLabel's own result).decidePublicSurface's behavior as part of this issue — this is a test-coverage gap on existing, currently-uncovered branchy logic, not a behavior change. If while writing the tests a genuine divergence fromshouldApplyPrLabel's intent is found, note it in the PR description rather than silently "fixing" it, since intent here needs a maintainer read.Deliverables
test/unit/settings-preview.test.tsexercising all four combinations above for theoss_maintainer+not_checkedfallback branch ofwillLabel.Test Coverage Requirements
This repo's Codecov patch gate requires 99%+ coverage of changed lines and branches — since this issue is pure test addition (no production code changes), the goal is closing the existing branch-coverage gap on
decidePublicSurface'swillLabelcomputation, specifically every operand of the&&chain in the second disjunct.Expected Outcome
decidePublicSurface'soss_maintainer+not_checkedlabeling fallback is exercised by explicit tests for every combination ofautoLabelEnabledandpublicSurface, closing a real branch-coverage gap on a function whose own doc comment claims it's the authoritative, drift-proof source of truth for this behavior.Links & Resources
src/signals/settings-preview.ts—decidePublicSurface,willLabelcomputation around line 143-146test/unit/settings-preview.test.ts— existing coverage (533 lines), nonot_checkedcases today