A deadline with a suspendable idle leg and an unsuspendable ceiling.
Pure and injectable (setTimer/clearTimer) so the suspension rules are unit-testable
against a fake clock rather than by waiting minutes for real ones.
The idle leg RESTARTS in full when a prompt clears rather than resuming where it left off.
That is deliberate: after the user dismisses a prompt the host begins fresh work, and the
seconds that elapsed before the prompt say nothing about how long that work should take.
The ceiling is what stops a repeatedly-prompting call from running forever.
A deadline with a suspendable idle leg and an unsuspendable ceiling.
Pure and injectable (
setTimer/clearTimer) so the suspension rules are unit-testable against a fake clock rather than by waiting minutes for real ones.The idle leg RESTARTS in full when a prompt clears rather than resuming where it left off. That is deliberate: after the user dismisses a prompt the host begins fresh work, and the seconds that elapsed before the prompt say nothing about how long that work should take. The ceiling is what stops a repeatedly-prompting call from running forever.