Outbox ordering for entity repositories and payload-carrying upload crash reports - #1
Merged
3 commits merged intoAug 16, 2026
Merged
Outbox ordering for entity repositories and payload-carrying upload crash reports#13 commits merged into
3 commits merged into
Conversation
…epositories put/post/delete previously only wrote the pending local change when the remote call was skipped or failed with UnavailableException; any other exception (e.g. a 422 validation rejection) propagated before the change was enqueued, permanently orphaning the record locally with no retry, no quarantine, and no sync-history entry. The pending change is now written before the remote attempt. Success removes it, failure records the error on it so the synchronizer's existing backoff and quarantine classification take over, and remote errors no longer escape to the caller. Deleting a never-synced entity concludes immediately instead of hitting the server.
… reports A type-cast failure during unmarshal carries no context of its own; without the queued payload the report cannot show which field was at fault.
…aits A queued payload that fails to unmarshal throws UnmarshalException, classified permanent: the payload is immutable, so it is quarantined and surfaced on the first attempt instead of burning the ten-attempt unknown budget. A change deferred by shouldPersistRemote records a transient DependencyPendingException on the row, giving sync history a reason instead of a silently pending change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
SyncEntityRepository.put()/post()/delete()only wrote the pending local change when the remote call was skipped or failed withUnavailableException. Any other error — e.g. a server validation rejection — propagated before the change was enqueued, permanently orphaning the record: saved locally, invisible to the sync loop, never retried, never quarantined, absent from sync history. This is how the trakli mobile app lost transactions in the field on v1.0.5.Changes
upload_local_changereports now include the attempt number and a truncated excerpt of the queued payload, so unmarshal/serialization failures are diagnosable from the report alone.Verification
12 new tests in
sync_entity_repository_test.dartcover success, rejection, network-unavailable, unauthenticated, and delete-replaces-put paths; 111 tests passing. Note:constructor_test.dart's "sync() throws on concurrent sync" was already failing onmainbefore this branch — it asserts the pre-0.2.0 behavior that the 0.2.0 idempotency change replaced, and is left for a separate cleanup.Tags
drift_sync_core-v0.3.1anddrift_sync_core-v0.3.2are published and consumed by trakli/mobile#214.