Revert #605's cooldown-only mitigation in favor of the root-cause fix

@mvanhorn independently fixed #598 in #605 by no longer resetting the
case cooldown on close, throttling the re-pop. We cherry-picked that
commit above to keep his authorship/credit, but this PR instead removes
the underlying lid-state flapping at its source (out-of-case pod's stale
lid byte -> UNKNOWN), so the cooldown can keep resetting on close and a
genuine close->reopen still shows the popup. Reverting his change here so
the two approaches don't stack; thanks @mvanhorn for the parallel work.
This commit is contained in:
Matthias Urhahn
2026-06-08 08:05:50 +02:00
committed by Matthias Urhahn
parent 2cce9ae56c
commit af1b1b4249
2 changed files with 5 additions and 34 deletions
@@ -290,8 +290,8 @@ class PopUpReaction @Inject constructor(
DualApplePods.LidState.CLOSED -> CasePopUpDecision(
shouldShow = false,
shouldHide = true,
shouldResetCooldown = false,
reason = "Lid CLOSED, refreshing cooldown",
shouldResetCooldown = true,
reason = "Lid CLOSED, resetting cooldown",
)
else -> CasePopUpDecision(
@@ -36,11 +36,10 @@ class PopUpReactionLogicTest : BaseTest() {
private fun evaluate(
currentLidState: DualApplePods.LidState?,
lastShownTime: Instant? = null,
at: Instant = now,
) = popUpReaction.evaluateCasePopUp(
currentLidState = currentLidState,
lastShownTime = lastShownTime,
now = at,
now = now,
cooldownDuration = cooldown,
)
@@ -82,39 +81,11 @@ class PopUpReactionLogicTest : BaseTest() {
}
@Test
fun `lid CLOSED - should NOT show, should hide, should NOT reset cooldown`() {
fun `lid CLOSED - should NOT show, should hide, should reset cooldown`() {
val decision = evaluate(currentLidState = DualApplePods.LidState.CLOSED)
decision.shouldShow shouldBe false
decision.shouldHide shouldBe true
decision.shouldResetCooldown shouldBe false
}
@Test
fun `lid CLOSED followed by residual OPEN within cooldown - should NOT show`() {
val closeDecision = evaluate(currentLidState = DualApplePods.LidState.CLOSED)
closeDecision.shouldHide shouldBe true
closeDecision.shouldResetCooldown shouldBe false
val residualOpenDecision = evaluate(
currentLidState = DualApplePods.LidState.OPEN,
lastShownTime = now,
at = now.plusMillis(500),
)
residualOpenDecision.shouldShow shouldBe false
}
@Test
fun `lid CLOSED then OPEN after cooldown elapsed - should show`() {
val closeDecision = evaluate(currentLidState = DualApplePods.LidState.CLOSED)
closeDecision.shouldHide shouldBe true
closeDecision.shouldResetCooldown shouldBe false
val reopenDecision = evaluate(
currentLidState = DualApplePods.LidState.OPEN,
lastShownTime = now,
at = now.plus(cooldown),
)
reopenDecision.shouldShow shouldBe true
decision.shouldResetCooldown shouldBe true
}
@Test