Fall-alarm countdown #3
Replies: 1 comment
📋 Task Proposal Rubric ReviewRecommendation: 🟢 Strong Accept Full Review[Verifiable]: Pass [Well-Specified]: High [Solvable]: Pass [Difficult]: High
[Realistic and Valuable]: High [Outcome-Verified]: Pass Decision: Strong Accept
|
Uh oh!
There was an error while loading. Please reload this page.
Proposed Task Name
Rebuild the fall-alarm countdown and its contact-escalation ladder
Domain
Framework
Tags
coroutines, foreground-service, lifecycle, process-death, testing
1. Problem Statement
Guardian is a personal-safety app for older people living alone. It watches the accelerometer,
gyroscope and barometer in a foreground service, and when it decides someone has fallen it puts a
full-screen countdown on the phone. If the wearer taps cancel, nothing further happens. If the
countdown runs out, every emergency contact they configured gets an SMS with the incident details
and a location, and each contact is retried until it is reached or has failed for good.
Today the detection half works and the response half does not. A confirmed fall raises no
countdown, no contact is ever messaged, and an incident that was mid-countdown when the process
died comes back as if nothing had happened.
The interfaces are all still in place —
CountdownListener,IncidentDispatcher, the Hiltmodules that bind them, the SMS channel, the siren, the speech and vibration listeners, and the
persistence layer that records what was sent. What is missing is the state machine that runs the
countdown and the ladder that turns its expiry into delivered messages.
2. Android Environment & Constraints (Optional)
TimeSourceand aninjected
Scheduler— the code under test never reads the system clock/dev/kvm3. Reference Solution Plan
Three files in
emergency/dispatch.CountdownSession.kt, the coroutine facade the UI and theservice both drive, stays in place and constructs the controller — so the solution has to satisfy an
existing caller rather than design its own entry point.
src/main/kotlin/.../emergency/countdown/CountdownController.kt— the countdown state machine:phases, refusals, cancellation that must not let an already-scheduled expiry fire, and resume
after a process restart
src/main/kotlin/.../emergency/dispatch/DispatchCountdownListener.kt— turns countdown eventsinto dispatch commands on a channel, holds a wakelock across the attempt, and sends a follow-up
when a better location fix arrives
src/main/kotlin/.../emergency/dispatch/CompositeEmergencyDispatcher.kt— the ladder: orderedtargets, per-round backoff, permanent versus retryable outcomes, and a per-incident cooldown so
a second fall does not re-alert the same contacts
4. Verification & Strategy
16 test files across
:emergency:dispatchand:service:monitorfail on the before commit andpass on the after commit — measured, 63 failures in the first module and 95 in the second. The
remaining 785 tests per build variant in those same two modules are the regression net, so an
agent that gets the ladder working by breaking incident persistence or the self-test fails.
The tests drive public seams that exist in the before commit —
CountdownController,CountdownListener,IncidentDispatcher,DispatchPolicy,RecordedDispatch— and assert onemitted callbacks and recorded dispatches rather than on internal structure, so an implementation
that decomposes the problem differently still passes.
Determinism comes from the code under test rather than from the tests:
VirtualClockfor time, aninjected
Schedulerfor ticks and expiry, andStandardTestDispatcherwithrunTestforcoroutines. There is no real time, no
Thread.sleep, no network and no emulator anywhere in thegraded set.
The verifier discards the agent's edits to both modules' test source sets before applying the
hidden tests, which covers the two shared fixtures the graded tests read.
5. Complexity & Difficulty
Roughly 40 hours for a senior Android developer:
The difficulty is in the interaction rather than in either piece. My prediction is that a model
writes a plausible countdown and a plausible retry loop and then fails where they meet: a cancel
that arrives while the ladder is asleep in a backoff, a second fall inside the cooldown window, or
a resume that restarts the countdown from its full length instead of from what was left.
6. Additional Information (Optional)
No response
All reactions