A batch can partly succeed. If the app treats one success response as proof that every item was accepted, it can discard unsent work. If it retries the whole batch blindly, it can duplicate already completed effects.
Define whether a batch is atomic or a collection of independently processed operations. The client and server must agree on that contract before recovery logic can be correct.
Preserve identity and outcome for every item
Each logical operation needs a stable reference and an explicit result such as accepted, duplicate of completed work, retryable failure, rejected input, or conflict requiring review. Keep batch identity useful for diagnostics without making it the only unit of correctness.
If the protocol promises all-or-nothing behaviour, verify that the actual storage and side effects uphold it. An external message or file write may not roll back with a database transaction.
Recover a fictional five-report batch
Suppose a device sends five inspection reports. Three are accepted, one has a stale revision, and one times out with uncertain completion. The app should preserve the three successes, retain the conflict for review, and reconcile the uncertain operation before retrying.
Test response interruption after some server commits, a malformed item, removed permission for one resource, repeated batch delivery, and a restart before local outcomes are saved. Inspect individual server records and local queue states.
Do not assume the position of a response item matches the position of the request unless that is an explicit verified contract. Match stable operation references so omitted or reordered results cannot update the wrong item.
Explain the result at task level
Show a useful summary such as reports accepted and reports needing attention, with a route to the unresolved items. Avoid claiming all work synced because the network request completed successfully.
Offer safe subset retry where appropriate. A user should not need to recreate accepted work or understand transport internals. Preserve drafts and attachments associated with rejected items until the lifecycle policy resolves them.
The tradeoff is batch efficiency versus recovery complexity. Batching can reduce request overhead while making partial outcomes more involved. Smaller batches or individual operations may be easier for a narrow pilot, provided performance and server constraints are acceptable.
Flutter's offline-first guide supplies architectural context. The Social App case study documents related offline work. This five-report batch is fictional and makes no throughput claim.
Questions about partial sync success
Does an HTTP success code mean every item succeeded?
Only if the endpoint's contract says so and its implementation enforces that meaning. Inspect per-item outcomes where the protocol supports partial processing.
Should a retry create a new logical batch?
It can have a new attempt reference, but preserve the individual operation identities and prior outcomes to prevent duplication.
What should be tested first?
Interrupt the response after several commits, restart, and reconcile each item. Bring lost or duplicated outcomes to a batch-sync review.