The scenario: receiving text is not the same as finishing a turn
A native app can display part of an AI reply while the server is still working. It also can receive general account events through a line-framed stream. Those streams share a familiar event/data format, but their parser state and application meaning are different. A visible fragment must not become a completed, approved or clinically correct result merely because it parsed.
Three general line-parser cases and five AI parser/model cases passed for selected Movo-X Android functions. They feed supplied strings and decode synthetic JSON. Five supplemental cases additionally run the consumer against a local mock HTTP server. No actual provider or authoritative server turn lifecycle was exercised. This chapter concerns selected framing and model boundaries rather than AI quality or medical acceptance.
Give a line parser lines and test byte decoding elsewhere
The inspected general parser accepts one line without its terminator and returns an optional event. Its fixture splits a supplied string at newline boundaries before feeding it. The AI parser fixtures likewise pass already-decoded lines. That input contract starts after the network byte decoder and line splitter.
WHATWG defines event-stream processing over UTF-8 input and a line-based field format. The native helpers implement selected application behaviour, not the entire browser EventSource API. These cases do not split multibyte characters across network chunks, cover every line ending or prove full protocol conformance. The existing Swift byte-boundary chapter has a separate scope; its evidence should not be transferred to Android automatically.
Keep event identity, type and data as separate state
The selected general-stream fixture parses a snapshot, a ping and a revoked event, ignores a comment and checks that the last event ID carries into a following event without a newly supplied ID. A separate case joins multiple data lines with a newline and checks the selected default event type.
These assertions establish selected parser state transitions over the supplied lines. They do not execute snapshot reconciliation, revoke account access or prove that a server can replay missed events from that identifier. The ID is a parsed value; retention, monotonicity, resume semantics and authoritative access belong to the stream service and its consumer.
Expose a retry value without claiming reconnection occurred
The third general-parser case feeds empty separators and checks that they emit no event. It then supplies a retry field, checks no immediate event and observes the selected stored retry value. This keeps timing metadata separate from a dispatched application event.
No reconnect loop runs in that case. The inspected helper accepts a selected numeric representation, but the fixture does not exhaust numeric syntax, overflow, negative values or every protocol control field. Current reconnect policy, jitter, cancellation, last-event-ID handling and server refusal need independent acceptance. A stored retry number is not measured recovery from a real connection loss.
Parse AI progress and deltas as partial presentation values
The selected AI sequence yields a step title, two text deltas and a done payload while ignoring a keep-alive comment. The fixture checks the supplied title and delta strings, then decodes the selected final conversation JSON. The parser itself distinguishes the four application event categories rather than treating every data line as display text.
A step title is a label, not proof that a medical check occurred or that a model exposed a complete reasoning process. A delta is partial text, not a committed assistant message or clinical instruction. The UI, authoritative turn state and any review workflow must preserve those distinctions even when the partial stream looks coherent.
Keep final-payload framing separate from model validation
The inspected AI parser returns the body of a done event as a raw JSON string. The selected test separately decodes that body into a conversation model and checks one supplied context-sharing flag. The inspected HTTP consumer performs its own model decode when it receives done and reports a malformed result if that decode fails.
A supplemental local-HTTP case now exercises final decode refusal with malformed done JSON. A separate local case supplies a valid final body and receives a conversation result. A done label alone therefore does not prove that the payload is valid, belongs to the selected account/person or reflects a durably completed server turn. Current request scope, durable completion and model-validation failures require their own integration acceptance.
Treat unknown events and error codes according to the selected contract
One AI fixture ignores a selected unknown event and joins a supplied multiline JSON delta into a parsed text value. Another checks that a selected error event retains its code. The inspected AI parser resets its per-event name/data state when flushing, and the consumer maps a parsed failure to its selected exception path.
These cases are not a full malformed-input, resource-limit or forward-compatibility matrix. Large event buffers, missing separators, incomplete final events, malformed JSON and new event categories need explicit acceptance. Ignoring one unknown event does not prove that every future protocol change is safe or that the user receives adequate recovery guidance.
Keep consent and feedback wire models independent of transport success
Two AI model cases also check selected creation/feedback encoding and latest-feedback decoding. The creation fixture omits optional context fields when no context choice is supplied and includes the selected context-consent version when supplied. A feedback fixture retains a selected rating in a synthetic conversation.
Those fields are wire representations. They do not establish that a person actually consented, that the service enforced consent or that a positive rating proves answer quality. Likewise a synthetic approved status does not execute a clinician review. Preserve service authority, recorded consent and real review decisions independently from successful parsing or model construction.
Exercise selected HTTP fallback, completion and premature-end outcomes
Five supplemental cases now run the actual Android API consumer against a local mock HTTP server. A plain-JSON response returns a selected conversation without partial callbacks and retains the selected stream request path, Accept/authentication headers and mutation identity. A complete event stream reports selected progress/delta callbacks, including a supplied non-ASCII string, before returning its final conversation.
A stream ending after a delta reports a network failure instead of returning a completed conversation; the already-delivered callback remains observable. Malformed done JSON is refused by the final decoder, and a selected error event retains its application code in the consumer exception. These local cases do not establish network-byte fragmentation, every content type, callback cancellation/lifecycle, provider availability or durable server completion.
A streaming-client engineering handover
Retain the thirteen scoped cases with exact line inputs, parsed event values and selected model keys. Add byte/line boundary, malformed/resource, premature-end and cancellation cases at their proper layers. Verify request scope, authoritative completion, retry/replay and installed partial-response presentation against a controlled current service.
For a CTO, the responsibilities are explicit: bytes become lines, lines become selected events, application payloads pass model validation and the service establishes durable turn state. Any clinical review has its own authority. The selected evidence makes the parser boundary concrete without claiming that transport success validates an AI answer or completes a medical workflow.
Compare the reviewed boundaries
A parsed event, a valid payload and an accepted turn are different
On smaller screens, scroll across to compare every column. Keyboard users can focus the table and use the arrow keys.
| Boundary | Selected evidence | Separate acceptance |
|---|---|---|
| General framing | Supplied IDs, types, multiline data and retry values | Byte decoding, protocol matrix and reconnect |
| AI partial output | Selected step/delta/error/unknown-event cases | Installed partial UI and resource limits |
| Final payload | Selected done decode plus local HTTP success/refusal cases | Durable current server completion, scope and broader transport matrix |
| Consent/review | Selected wire fields and feedback decode | Real consent, clinician authority and clinical correctness |
Illustrative control flow
Pseudocode summarizing the decision boundary. It is not copied production code or a deployment instruction.
for decoded_line in separately_accepted_transport:
event = selected_line_parser.feed(decoded_line)
if event_is_delta: present_as_partial_text()
if event_is_done: validate_final_payload_and_reconcile_authoritative_turn()
# A parsed label, status or rating does not establish clinical review or correctness.Additional implementation references
These provider references explain current implementation context. Historical Movo-X observations remain tied to the source records described above.
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 ↗