Repository navigation
fix(offline): preserve delivery order across related aggregates - #114
Merged
Merged
Conversation
rdlabo
marked this pull request as draft
November 25, 2026 02:06
rdlabo
marked this pull request as ready for review
November 25, 2026 02:40
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.
Offline delivery guarantees
Preserve the original command payload from enqueue through projection and replay. A command that is sending or may have committed also retains its original base revision when a pull or acknowledgement advances the replica. Known-unsent commands continue to rebase. Executors can use this persisted revision to reconstruct the original transport precondition.
An optional executor predicate identifies earlier commands in other aggregates that must finish before a send can start. The serialized claim checks the predicate before changing state. Retry scheduling uses the same predicate, retries transient read failures, and lets unrelated work continue. A failure reading state after claim follows the existing pre-transport failure path.
The change adds no persistent fields or database migration. It removes the proposed transport transformation hook. The original product intent remains available to local projections, and serialization limits still apply to the payload recorded at enqueue.
A send is prepared under one pre-transport failure path. Losing the local checkpoint before HTTP runs returns the write to retry with the uncertainty of its previous attempts. When the replica base and an acknowledgement diverge, the acknowledgement completes transport, and authoritative pull determines the revision for dependent work. Revision tokens can be numbers or opaque strings. After a restart, a persisted acknowledgement awaits reconciliation before releasing a successor.
Local verification
Regression cases cover response loss followed by a newer remote revision, normal rebasing of unsent changes, retry deadlines for dependent and independent writes, and a transient dependency read failure after another send was claimed. Full workspace tests, lint with SQLite tests, packed-consumer verification, and non-strict consumer type-check were run before updating this PR.
Additional regression tests inject a checkpoint write failure and verify automatic delivery, cover older and newer acknowledgement revisions and opaque tokens, and verify that unrelated delayed writes do not cause repeated pulls.