Field technicians use the React Native app in basements with no signal. Changes made offline go into an outbox that syncs later, but today failed changes vanish, retries create duplicates, a restart loses the queue and one bad record blocks everything. Make the sync lossless and idempotent.
This is the practice version. Assessments always use a variant you have never seen.
Technicians report that inspection notes typed in a basement are sometimes gone the next morning. src/outbox.js queues every change made offline and flush() sends them when the phone
is back online. storage is the app's AsyncStorage wrapper (async getItem / setItem); api.send(m)
throws ApiError with an HTTP status, or a NetworkError.
enqueue resolves only after the queue is persisted; load() restores it after a restart;
failed mutations stay queued.idempotencyKey across retries and restarts.deadLetter and the flush continues; a 5xx
or network error stops the flush and sets nextRetryAt = now + backoff (1 s, 2 s, 4 s … max 30 s).Run node --test test/. Hidden tests replay flaky networks, restarts and bad records.