Skip to content

fix(offline): preserve delivery order across related aggregates - #114

Merged
rdlabo merged 3 commits into
mainfrom
fix/offline-command-delivery-order
Nov 25, 2026
Merged

rdlabo merged 3 commits into
mainfrom
fix/offline-command-delivery-order

Conversation

@rdlabo

@rdlabo rdlabo commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

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.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 3 potential issues.

Devin Review

@rdlabo
rdlabo marked this pull request as draft November 25, 2026 02:06
@rdlabo
rdlabo marked this pull request as ready for review November 25, 2026 02:40
@rdlabo
rdlabo merged commit 2022afc into main Nov 25, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant