An offline retry can arrive after the server already accepted the first attempt. If the application treats it as new work, a single user action can create duplicate messages, requests, or charges.
Assign identity to the logical operation when the user creates it, then preserve that identity through retries. The server must define how repeated requests for that operation are recognised and what result is returned.
Separate operation identity from transport attempts
An attempt can have its own diagnostic reference, but it should not replace the logical operation identifier. Scope identity to the relevant account or tenant and validate ownership on every accepted request.
Store enough processing outcome to distinguish new, in progress, completed, and failed work under the actual consistency design. A check-then-create sequence can still race if two retries arrive together.
Test a fictional offline service request
Suppose a technician creates one request while disconnected. The app sends it after reconnecting, the server commits it, and the response is lost. The next attempt should resolve to the same intended result under the duplicate policy.
Create fixtures for failure before server acceptance, lost confirmation after acceptance, concurrent retries, app restart, and an account change before retry. Inspect the number of resulting business records and side effects, not only the response status.
Add the same operation identity with a different payload. Define whether that is rejected, compared, or handled through a documented update path. Silently accepting a changed payload under an old identity can conceal a corrupted queue or programming error.
Include downstream effects in the boundary
A single database request can still trigger duplicate emails or external records if those effects retry independently. Give each consequential effect a controlled relationship to the logical operation and a recoverable outcome.
Retention matters. If deduplication evidence is removed before the supported offline or replay interval ends, an old operation may become new again. Choose the lifecycle from the actual product promise and storage constraints.
The tradeoff is durable bookkeeping versus accidental repetition. Stable identity adds records and reconciliation work, but it makes uncertain completion explainable. It does not automatically provide a universal exactly-once guarantee across every external system.
Flutter's offline-first documentation supplies broader context. The Social App case study documents related offline engineering scope; this service-request fixture is fictional and unmeasured.
Questions about duplicate offline actions
Can disabling the send button solve duplicates?
It reduces repeated taps but does not cover lost responses, process restarts, or concurrent retries. Enforce the logical-operation policy on the server.
Should every retry receive a new identifier?
Use a new attempt reference if useful, while preserving the original logical operation identity for the intended action.
What should be tested first?
Lose the acknowledgement after server commit, then retry concurrently. Bring resulting records and side effects to an offline-operation review.