The scenario: a person edits text while an earlier send is uncertain
A message can remain pending after a network failure even though its server outcome is unknown. If a person edits the composer and retries, replacing the old payload under the same identifier can give one operation two meanings. The client needs to distinguish retrying the original turn from creating a newly edited turn.
The reviewed Movo-X AI outbox stores the original turn and refuses to replace it when the same client identifier is enqueued again. Two selected portable tests passed for outbox behaviour and request construction. They use an in-memory data store and fake transport, not a real conversation, protected-file write or production server replay.
Make the pending turn a concrete value
The inspected pending-turn model contains the client identifier, session, selectors, text, language, attachment identifiers, queue time and attempt count. Retaining those fields together makes the retry an operation with a defined payload rather than a request reconstructed from whatever happens to be on screen later.
The ordinary JSON send constructs its body from that retained turn and uses the client identifier as its request identifier. The selected request test checks relevant body fields, attachment references and identifier mapping. This establishes what the client asks for; it does not prove that the server binds the same identifier to the same payload or enforces every selector’s authorization.
Let the original payload win for a duplicate identifier
The outbox enqueue method checks whether its items already contain the client identifier. If so, it leaves the stored item unchanged. The test enqueues an original turn, changes the text in another value with the same identifier and verifies that only the original text remains.
That is a deliberate semantic boundary. A changed question should be a separately identified operation under the product’s accepted workflow. Reusing an identifier should not silently edit the meaning of an unresolved send. The test covers the local data structure; server-side conflict, replay and completed-result handling require their own evidence before the system can claim end-to-end idempotency.
Preserve uploaded attachment references through serialization
The selected outbox test saves the queue into an injected in-memory store, reloads it and checks the retained attachment identifiers. These refer to already uploaded attachments, so the pending message can retain its original association instead of substituting the current photo selection.
This round trip checks model encoding and decoding. It does not prove that an attachment remains available on the server, that access is still permitted or that the original upload completed. Those conditions need evaluation when retrying the message. A useful handover retains the difference between local references, authorized remote objects and the later conversation result.
Document retention limits as product behaviour
The reviewed outbox is bounded. Enqueueing beyond its item limit removes entries from the front, and a failed-attempt update removes an item once its attempt count reaches the configured maximum. The source currently sets fifty items and eight attempts. These are implementation settings at the reviewed revision, not measured recommendations for every application.
The selected test checks retention before the final allowed failure and removal at the limit. It does not exercise queue overflow. A product acceptance should make those outcomes visible to the person using the app and decide what recovery or editing options remain. A bounded queue should never be marketed as an unconditional promise that every pending message survives indefinitely.
Classify retry without turning refusal into another send
The outbox helper classifies network failures, selected server failures, rate limiting and an in-progress conflict as retryable. The test includes selected network, conflict, unavailable and forbidden examples. The inspected app flush loop stops its pass after a retryable failure and removes a permanently refused turn instead of endlessly replaying it.
The flush loop also confirms a turn after a successful response and saves the changed queue. This chapter does not newly execute the full app loop. A device and server acceptance should inspect what the user sees when a turn is removed or a pass stops, and verify that a retry preserves its original identity across interruption.
Distinguish a persistence interface from proven durability
The app source uses a protected-file adapter in Application Support, requests atomic protected writes and marks the local state for backup exclusion. Its data-store interface does not return write success, and the inspected adapter suppresses filesystem errors. The in-memory test cannot establish that a protected write succeeded on a locked or full device.
The load path also falls back to an empty outbox when retained data is absent or cannot be decoded. These are important acceptance boundaries, not evidence of a reproduced production incident. Test storage failures, restart and account transitions on the actual platform before claiming crash durability. The selected sign-out source clears the outbox and asks the store to remove its data; that invocation is distinct from verified deletion.
A reviewable retry handover
Deliver the pending-turn fields, duplicate-identifier rule, attachment lifecycle assumptions, retry classification and item/attempt limits. Attach the original-payload and serialization fixtures, then add separate tests for overflow, decoding failure, protected-file write failure, restart and sign-out. Keep real message text and attachment identifiers out of public evidence.
For a CTO, the result is a retry mechanism with explicit semantics and limits. Retrying an uncertain send retains what was originally asked, while editing creates a new decision. Bounded retention and best-effort file handling remain visible operational responsibilities. The source and two portable tests establish that useful local contract without claiming unlimited delivery, production replay correctness or durable persistence that was never measured.
Illustrative control flow
Pseudocode summarizing the decision boundary. It is not copied production code or a deployment instruction.
if pending.contains(turn.client_id):
keep_original_payload()
else:
append_with_explicit_capacity_policy(turn)
on_retryable_failure:
increment_attempts_or_remove_at_limit()
on_accepted_response:
remove_confirmed_turn()
save_queue_using_reviewed_persistence_adapter()
# Serialization success is distinct from successful protected disk storage.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 ↗