Context
src/signals/contributor-open-pr-monitor.ts declares OpenPrWorkClassification (line 18)
including a "stale" variant, and wires it into cleanupFirst (line 115),
nextStepsForClassification (line 186), and priorityRank (line 284). The sole producer of this
type, mapPendingClassToWorkClassification (line 134), never returns "stale" — its only upstream
input (ClassifiedOpenPullRequest.classification from
packages/loopover-engine/src/scoring/pending-pr-scenarios.ts) has no plain "stale" value, only
"stale_likely_close", which is already mapped to "should_close_or_withdraw" above the fallthrough
default. "stale" is dead code: it can never be assigned to a real
ContributorOpenPrNextStepPacket.classification by any current code path, verified by tracing
every branch of mapPendingClassToWorkClassification and the upstream OpenPrPendingClass type.
nextStepsForClassification's "stale" case already shares its exact case body with
"should_close_or_withdraw" (line 186-188), so even if it were somehow produced today it would
render identical guidance — there's no distinct behavior riding on this value that would be lost by
removing it.
Whether this was a deliberate simplification (leaving a harmless legacy branch) or a real gap where
a distinctly-"stale-but-not-yet-close-worthy" PR should get its own guidance is a genuine open
question — but no existing signal in the codebase currently distinguishes a second staleness tier,
so designing one would be a product decision. This issue scopes the safer, purely-mechanical
resolution: removing the unreachable branch.
Requirements
- Remove
"stale" from the OpenPrWorkClassification union type.
- Remove
"stale" from cleanupFirst's trigger array (line 115) and from priorityRank's order
array (line 284).
- Collapse
nextStepsForClassification's case "stale": case "should_close_or_withdraw": (line
186) down to a single case "should_close_or_withdraw": now that the type no longer has the
other member.
- Do not change any other classification's behavior, ordering, or guidance text — this is a
dead-code removal only, verified by the requirement that mapPendingClassToWorkClassification's
own logic and every OTHER classification's next-steps/priority stay byte-identical.
- Update/remove the existing test that exercises
nextStepsForClassification("stale", ...) via a
hand-cast literal (search test/unit/contributor-open-pr-monitor.test.ts for "stale" as a
literal argument) since the type will no longer permit that value to be constructed without an
explicit unsafe cast.
Deliverables
Test Coverage Requirements
This repo's Codecov patch gate is 99%+ hard (branch-counted) on every changed line/branch in
src/**. Since this is a removal (fewer branches, not new ones), the requirement here is that the
existing suite continues to pass at its current coverage level with no regression — no new
uncovered branches should be introduced by the type-narrowing.
Expected Outcome
OpenPrWorkClassification only contains values that a real classification pipeline can actually
produce — no more misleadingly-live-looking dead branch in cleanupFirst, nextStepsForClassification,
or priorityRank that a future reader could mistake for reachable behavior.
Links & Resources
src/signals/contributor-open-pr-monitor.ts:18 (the type), :114-116 (cleanupFirst), :134-148
(mapPendingClassToWorkClassification, the sole producer), :173-192 (nextStepsForClassification),
:276-289 (priorityRank). packages/loopover-engine/src/scoring/pending-pr-scenarios.ts (the
upstream OpenPrPendingClass type, for confirming no "stale" value exists there either).
Context
src/signals/contributor-open-pr-monitor.tsdeclaresOpenPrWorkClassification(line 18)including a
"stale"variant, and wires it intocleanupFirst(line 115),nextStepsForClassification(line 186), andpriorityRank(line 284). The sole producer of thistype,
mapPendingClassToWorkClassification(line 134), never returns"stale"— its only upstreaminput (
ClassifiedOpenPullRequest.classificationfrompackages/loopover-engine/src/scoring/pending-pr-scenarios.ts) has no plain"stale"value, only"stale_likely_close", which is already mapped to"should_close_or_withdraw"above the fallthroughdefault.
"stale"is dead code: it can never be assigned to a realContributorOpenPrNextStepPacket.classificationby any current code path, verified by tracingevery branch of
mapPendingClassToWorkClassificationand the upstreamOpenPrPendingClasstype.nextStepsForClassification's"stale"case already shares its exact case body with"should_close_or_withdraw"(line 186-188), so even if it were somehow produced today it wouldrender identical guidance — there's no distinct behavior riding on this value that would be lost by
removing it.
Whether this was a deliberate simplification (leaving a harmless legacy branch) or a real gap where
a distinctly-"stale-but-not-yet-close-worthy" PR should get its own guidance is a genuine open
question — but no existing signal in the codebase currently distinguishes a second staleness tier,
so designing one would be a product decision. This issue scopes the safer, purely-mechanical
resolution: removing the unreachable branch.
Requirements
"stale"from theOpenPrWorkClassificationunion type."stale"fromcleanupFirst's trigger array (line 115) and frompriorityRank's orderarray (line 284).
nextStepsForClassification'scase "stale": case "should_close_or_withdraw":(line186) down to a single
case "should_close_or_withdraw":now that the type no longer has theother member.
dead-code removal only, verified by the requirement that
mapPendingClassToWorkClassification'sown logic and every OTHER classification's next-steps/priority stay byte-identical.
nextStepsForClassification("stale", ...)via ahand-cast literal (search
test/unit/contributor-open-pr-monitor.test.tsfor"stale"as aliteral argument) since the type will no longer permit that value to be constructed without an
explicit unsafe cast.
Deliverables
"stale"removed from theOpenPrWorkClassificationtype union and its three consumingarrays/switches in
src/signals/contributor-open-pr-monitor.tsnpm run typecheckpasses with the narrowed union (confirms no other code path anywhere stillreferences the removed variant)
"stale"literal; all otherclassification cases' existing test coverage stays green and unchanged
Test Coverage Requirements
This repo's Codecov patch gate is 99%+ hard (branch-counted) on every changed line/branch in
src/**. Since this is a removal (fewer branches, not new ones), the requirement here is that theexisting suite continues to pass at its current coverage level with no regression — no new
uncovered branches should be introduced by the type-narrowing.
Expected Outcome
OpenPrWorkClassificationonly contains values that a real classification pipeline can actuallyproduce — no more misleadingly-live-looking dead branch in
cleanupFirst,nextStepsForClassification,or
priorityRankthat a future reader could mistake for reachable behavior.Links & Resources
src/signals/contributor-open-pr-monitor.ts:18(the type),:114-116(cleanupFirst),:134-148(
mapPendingClassToWorkClassification, the sole producer),:173-192(nextStepsForClassification),:276-289(priorityRank).packages/loopover-engine/src/scoring/pending-pr-scenarios.ts(theupstream
OpenPrPendingClasstype, for confirming no"stale"value exists there either).