The scenario: the connection drops while a consultation changes
A live consultation can continue while a patient’s network connection disappears. On reconnect, the client needs to learn whether the consultation state or its available record changed. That does not necessarily require replaying every intermediate event, and a snapshot-based implementation should not be described as if it preserves a durable history of each transition.
The inspected Movo-X endpoint polls authorized state and sends versioned announcements. Five selected teleconsult tests passed with synthetic RPC responses, including stream resume and feed behaviour. This chapter follows that snapshot design and its limits; no live consultation, production token or real-time clinical event was created.
Track workflow state and record content separately
The reviewed stream tracks a state version and a record version. It can emit a state update when consultation workflow information changes and a record announcement when the record version changes. The resume identifier carries both values, allowing an unchanged side to remain quiet.
The isolated stream fixture supplies both versions and checks the resulting identifier and event types. This is useful evidence of representation and selected suppression behaviour. It does not establish that every authoritative mutation changes the appropriate version; that invariant requires testing the service that generates the snapshot and its version values.
Send record change references rather than clinical text
The record-change helper compares kind-and-identifier pairs and their hashes, reporting added, updated or removed entries. Its output contains those references and change classifications rather than copying medicine names, diagnosis or signed notes into the record event. The selected test checks a synthetic mixed addition, update and removal.
A separate stream fixture supplies a distinctive synthetic diagnosis field in the mocked state and verifies that it is absent from the exercised output. That supports the tested projection boundary. It is not an audit of all nested state metadata, every event producer or every downstream log. Record identifiers also remain sensitive and need the intended access controls.
Suppress unchanged snapshots when the cursor matches
At connection start, the inspected endpoint parses an accepted resume identifier into its two version components. The test reconnects with matching synthetic versions and checks that the first response does not resend unchanged state or record announcements. The stream still provides its framing and retry information.
This reduces redundant announcements for an unchanged snapshot. It does not prove that the client received all preceding events or that a cursor is a receipt for clinical work. A resume identifier is input to this comparison, not authority to access the consultation. The coordinating call must continue to evaluate the scoped request independently.
Refresh current items when the prior item list is unknown
After reconnect, the server has the supplied versions but not necessarily the exact item list the client previously held. The inspected code treats that previous list as unknown. If the record version has moved, it announces the current item references as updated so the client can refresh, rather than claiming a precise historical diff it cannot reconstruct.
That is an important honesty boundary. A sequence of intermediate additions and removals may collapse into the latest available snapshot. If the product needs an auditable transition history, it needs a separately retained event or audit model. A snapshot stream alone should not be used to certify that every clinical change was individually delivered and acknowledged.
Bound a connection and re-evaluate authority
The reviewed loop stops at a deadline bounded by the configured stream lifetime and the supplied token expiry. Each poll asks the coordinating state operation again. Selected refusal results end the loop with a corresponding event, while transient failures can be retried on later polls.
These are source-level control-flow observations. The five rerun tests do not actually revoke a live session or measure how quickly a permissions change is reflected in production. Acceptance should exercise those outcomes with authorized synthetic accounts, including cancellation and reconnect. A long-lived transport must not be mistaken for a permanent grant simply because it was opened successfully once.
Keep call completion separate from record freshness
The inspected source intentionally allows the stream to continue after the call ends so later-finished record work can still be announced within the remaining connection lifetime. That separates the audio/video session’s end from the moment all resulting documentation becomes available.
The client still needs a clear product policy for refresh and navigation after leaving the call. The current test set does not establish the native screen’s background behaviour, final document timing or provider connection lifecycle. Those are separate acceptance scenarios. A completed call is one workflow fact; a current record and a received announcement are others.
A useful snapshot-stream acceptance plan
Deliver the two-version contract, accepted cursor shape, change-reference schema and reconnect-refresh rule. Test unchanged resume, changed record with unknown prior items, state-only changes, cancellation, token expiry and authoritative refusal. Add measured polling/load evidence before making scale claims.
For a CTO, the result is a live interface whose recovery semantics match its architecture. Snapshot polling can provide useful current-state updates without promising an ordered durable event history. The pinned implementation and mocked cases establish selected protocol decisions, while database versioning, permission enforcement, clinical audit and real-device recovery retain their own evidence requirements.
Illustrative control flow
Pseudocode summarizing the decision boundary. It is not copied production code or a deployment instruction.
cursor = parse_state_and_record_versions(last_event_id)
previous_items = unknown_after_reconnect()
while connection_is_within_accepted_lifetime():
snapshot = authoritative_state_read(scope)
announce_changed_state_version(snapshot, cursor)
if record_version_changed(snapshot, cursor):
announce_diff_or_refresh_current_item_references()
wait_for_next_bounded_poll()
# Snapshot refresh does not reconstruct every intermediate clinical event.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 ↗