The scenario: a reconnect must not replay old queue calls
A clinic display can receive the same call through a live event and a refreshed snapshot, or reconnect after a network interruption. Repeating an old announcement can confuse the waiting room. At the same time, a deliberate recall of the same queue token may need to be spoken again. The application needs event identity and age rules rather than a blanket rule that a token can only ever be announced once.
The pinned native Movo-X display has a dedicated announcement gate. Nine existing and two supplemental JVM cases passed with synthetic announcements and an in-memory credential store. Selected engine, persistence and audio-player source was reviewed separately. The tests concern eligibility and recorded claims, not sound in an actual clinic.
Identify a call by its announcement event
The gate first rejects selected invalid input such as a blank identifier or queue token. It treats an identifier already in its seen set as a duplicate, separately from evaluating the event timestamp. Existing fixtures check a fresh event, a second claim and a deliberate recall with a different identifier even though the visible queue token repeats.
That contract matters when several representations describe the same call. Reusing a token is normal in a queue; reusing an event identifier signals replay to this helper. The gate does not authenticate the event or prove that its room belongs to the paired display. Upstream device permission and server projection remain separate boundaries.
Make the age threshold and comparison explicit
The selected default threshold is 90 seconds. Its fixture accepts an event exactly 90 seconds old and classifies one at 91 seconds as stale. A separate fixture records a stale identifier and later sees that identifier as a duplicate. Missing or unparseable timing is not treated as a fresh call.
These tests use an injected clock. The inspected server-clock helper can estimate an offset from a response Date header or heartbeat timestamp, but those synchronization branches were not run in this batch. Timestamp parsing and one age comparison do not establish an accurate device clock, trusted time source or a complete future-timestamp policy.
Serialize claims within the shared gate
The gate protects its load/evaluate/record sequence with a coroutine mutex. A supplemental test launches 20 coroutine claims for one synthetic identifier through the same gate and observes one PLAY decision with 19 duplicates. That is a focused shared-instance check, not a multiprocess or physical-storage concurrency test.
The existing restart-labelled fixture constructs another gate over the same in-memory store and observes the remembered identifier. Its useful scope is reuse of stored state across gate instances. It does not terminate an Android process, reboot a TV or test whether a particular DataStore write survived sudden power loss.
Record before playback and accept the delivery tradeoff
For selected PLAY and STALE decisions, the gate updates its map and calls the store before returning. The inspected display engine claims an event before putting its announcement request into the playback channel. That ordering aims to suppress replay even if the application stops between eligibility and actual playback.
It also means a remembered identifier is not evidence that a complete phrase was heard. A process can stop, the channel can fail to accept work, or later policy can skip it after the claim. Document the intended tradeoff between suppressing repeats and recovering missed announcements; do not label this sequence exactly-once audible delivery.
Describe duplicate memory as bounded
The default map has a capacity of 300 and a selected 24-hour retention interval. Pruning occurs during the claim path for recorded eligible/stale events. The existing capacity fixture verifies a bounded store rather than an endlessly growing set of identifiers.
A supplemental test uses capacity two, claims three distinct fresh events, then offers the evicted first event again and receives PLAY. This is a controlled small-capacity demonstration of the retention contract, not an observation of repeated calls on a real display. Suppression depends on retained state and time policy; it is not a permanent global guarantee for every identifier ever received.
Recheck playback-time policy after queueing
The inspected engine checks speaker configuration before claiming. In its playback loop it again checks speaker state, re-evaluates staleness using the current clock and applies quiet-hours policy before calling the player. An existing pure fixture shows an event becoming stale after a clock advance.
The complete engine loop and quiet-hours integration were not executed for this chapter. Those source branches explain why a fresh queued event can be intentionally skipped later. A release review should exercise backlog, configuration changes and quiet-hour boundaries with a fake player, then separately inspect the actual output device.
Keep text-to-speech completion and acknowledgements qualified
The Android player source builds a chime and ordered language lines, tracks voice availability and bounds selected waits. Its progress listener completes pending waits for both done and error callbacks. The selected source also records language attempts without establishing that a listener in the room heard them. None of these Android audio branches ran in the JVM gate tests.
The engine’s acknowledgement path is separate again: it follows the guarded player invocation and uses its own bounded retry logic. The local gate cases do not contact that endpoint. Provider/API acknowledgement, an SDK completion signal, an attempted language and physical audibility are different outcomes and should be reported separately.
A practical native-display acceptance package
Retain the eleven gate cases with their source revision and JUnit results. Add controlled tests for storage errors, claim/queue interruptions, backlog aging, retained-state eviction and the intended recall policy. Inspect DataStore persistence and unpair/reset behaviour independently rather than extrapolating from an in-memory fixture.
On approved hardware, verify speaker connection, volume, chime, installed language voices and recovery after process or power interruption. Use synthetic queue tokens and avoid patient information in recordings. For a CTO, this makes the announcement workflow reviewable: a scoped event may be eligible, recorded, queued, attempted and acknowledged, while actual audibility still needs its own evidence.
Compare the reviewed boundaries
Do not collapse the announcement outcomes
On smaller screens, scroll across to compare every column. Keyboard users can focus the table and use the arrow keys.
| Outcome | Selected evidence | Separate acceptance |
|---|---|---|
| Eligible/duplicate/stale | Eleven JVM gate cases | Authoritative event origin and accurate time |
| Remembered claim | In-memory state and selected persistence source | Real DataStore durability and faults |
| Playback attempt | Engine/player source only | Actual queue, voices and audio device |
| Heard and acknowledged | No live outcome established | Physical audibility and server receipt |
Illustrative control flow
Pseudocode summarizing the decision boundary. It is not copied production code or a deployment instruction.
decision = gate.claim(event)
if decision == PLAY:
enqueue(event)
when_dequeued(event):
if still_fresh_and_speaker_policy_allows(event):
attempt_playback(event)
# A remembered claim is not proof of an audible phrase.About this engineering series
Written by Omer Muneer Qazi from a review of Movo-X implementation and dated engineering records. This article explains source behaviour and historical observations; current production, clinical outcomes and store availability require their own verification. Examples are synthetic and proposed test cases are identified as such.
Explore the Movo-X engineering series → · Related implementation experience →
Discuss a similar engineering problem
Send the workflow, current platform and the decision your team needs to make. I can help define an implementation or review scope with concrete acceptance evidence.
Discuss your project on WhatsApp ↗