You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0e1a1c1
Browse filesBrowse the repository at this point in the historyBrowse files
fix(offline-transactions): preserve callers across executor replacement (#2401)
* fix(offline-transactions): preserve callers across executor replacement
Law: disposal preserves admitted caller and optimistic obligations on retained
Collections; a sequential same-outbox successor settles them. Authority:
maintainer decision offline-disposal-handoff-2026-11-10 and README settlement.
Reach: both campaigns meet all 19 handoff states, including registry growth;
real QueryDB refetch receiving campaigns reach all four states 16 times each.
RED: original implementation fails completed/caller settlement with campaign
seed 20261110 and shrink path 0:1:1:1:1:1.
GREEN: 462 package tests, typecheck, build, ESLint, Prettier and lint:changed.
Mutant: full-source run 1c2a9145625b rejects 275/295 by named laws, including
44/44 changed-line operators. No crashes/timeouts. Remaining 20 are accounted
by typed-domain invariants or absence of the proposed stronger product law.
Limits: bounded controlled storage/provider, sequential same-runtime executors,
Node/V8 resource sentinel, no cross-tab promises or native durability claim.
Evidence: docs/contributing/oracle-reviews/issue-2254-executor-handoff.md
* chore: add offline executor handoff changeset
* test: register offline executor oracle replay owners
* fix(offline-transactions): settle issued outcomes before successor leadership
Law: Retained-Collection replacement owes every pending caller its durable
outcome, including a successor awaiting leadership. Authority: README Tracking
Submission Status and decision offline-disposal-handoff-2026-11-10.
Reach: 24 generated plus 11 constructed issued-handoff histories per campaign;
both issued boundaries reached 35 times in each normal campaign.
RED: Before production changed, seed 20261110/path 3:0:0:0:0:0 failed caller
settlement at completed. The previous barrier recorder also accepted an injected
settled barrier at provider held.
GREEN: Both issued campaigns, real QueryDB receiving comparisons, 466 package
tests, seven observer tests, final guarded replay and type/build checks pass.
Mutant: One-direction containment fails caller settlement; the settled-barrier
injection now fails refresh barrier at provider held. Full-source run
fd3da244acf0 kills 278/298 operators, all 47 changed-line; 20 residual labels
are individually adjudicated, not a zero-gap claim.
Limits: Controlled storage/providers, one issued executor, retained Collections,
one runtime. Copied-outbox isolation remains outside this PR by maintainer
decision offline-copied-outbox-limit-2026-11-10.
Also guarantee production-hook reach in the lint-scope oracle. CI seed 1392514884
fails without the construction and passes with it; the normal campaign reaches
all 25 states. Preserve run budgets and the reach minimum.
* docs: pin final executor handoff evidence
* Audit executor handoff review boundaries and registry work
Keep completion routing while deduplicating recipient selection and registering
only when obligations first appear. Move the real QueryDB receiving campaign
to its package and share the independent barrier judgment. Extend handoff
histories for falsy storage failures, throwing nonfinal subscribers, and live
offline predecessors. Repair the lint-scope construction premise.
Law: same-outbox durable outcomes settle retained-Collection callers; disposal
preserves unfinished obligations. Authority: README and maintainer decision
2026-11-10; first-error publication follows Transaction.touchCollection.
Reach: review campaigns run 24 generated +14 constructed histories, reaching
all 14 required states; QueryDB reaches all four states 16 times per campaign.
RED: raw-storage, disposed-only, one-direction and instance-only mutants fail
named caller/durable laws. Seed-zero lint construction misses its premise.
GREEN: unchanged-production boundary comparison; 465 offline tests; five real
QueryDB receiving tests; both lint-scope campaigns; types, build and lint.
Mutant: retaining a settled barrier fails the relocated QueryDB receipt law.
Limits: controlled storage/provider, one issued executor, one runtime; copied
outboxes and concurrent issued outcome precedence remain outside this promise.
* test: fix receiving oracle discovery and pin final gap evidence
---------
Co-authored-by: Test <test@test.com>
Preserve pending callers and optimistic mutations when an offline executor is replaced. A successor over the same outbox settles the original callers when it retains the configured Collection objects in the same runtime.
Copy file name to clipboardExpand all lines: docs/guides/offline-transactions.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -236,6 +236,19 @@ removal does not cancel a running named mutation function. If that call later
236
236
fails, its waiting promises reject with the named mutation function error and
237
237
the removed row is not retried. Call `dispose()` when the executor's owner ends.
238
238
239
+
You can replace an executor to change its configuration while keeping the same
240
+
Collections and durable outbox. Disposal stops new processing and releases
241
+
resources. It preserves pending optimistic state and caller promises. A
242
+
successor in the same runtime that replays the outbox and retains every configured
243
+
Collection object under its existing registry key settles the original transaction
244
+
receipts and per-ID waiters. An unchanged ancillary Collection does not transfer
245
+
callers when an affected Collection object changes. Core's conflicting-transaction
246
+
rollback rules still apply to pending restored snapshots. You can
247
+
construct a new storage adapter over that outbox. Without resumed work, the
248
+
callers remain pending. This does not transfer promises across tabs or a page
249
+
reload. On logout, separately clean up the account's Collections and decide
250
+
whether to keep or discard its stored outbox.
251
+
239
252
## Use SQLite persistence with the outbox
240
253
241
254
This React Native recipe stores applied Collection rows in OP-SQLite and pending mutations in AsyncStorage. The Query Collection supplies server sync. Install the packages for both stores and for Query Collection sync:
Copy file name to clipboardExpand all lines: packages/offline-transactions/README.md
+21-1Lines changed: 21 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -226,7 +226,7 @@ mutation function after restart; an unmarked row may replay.
226
226
-`removeFromOutbox(id)` - Manually remove transaction from outbox
227
227
-`clearOutbox()` - Manually remove all outbox transactions
228
228
-`peekOutbox()` - View all pending transactions
229
-
-`dispose()` - Clean up resources
229
+
-`dispose()` - Stop new processing and release executor resources. Pending durable transactions and optimistic state on surviving Collections remain live.
230
230
231
231
An acknowledged `removeFromOutbox(id)` or `clearOutbox()` while a named
232
232
mutation function is running does not cancel that call. If the call later
@@ -300,6 +300,26 @@ It means the server confirmed or exposed the write only when that
300
300
`mutationFn` explicitly waits for the provider's acknowledgement, read-back, or
301
301
sync observation before returning.
302
302
303
+
Disposing an executor does not cancel its admitted transactions or reject their
304
+
callers. Their optimistic state stays on surviving Collections. If you replace
305
+
the executor over the same outbox and retain every configured Collection object
306
+
under its existing registry key in this runtime, its replay settles the original
307
+
`commit()`, `when('settled')`, and per-ID waiters with each transaction's outcome.
308
+
Storage adapter objects may
309
+
change. An already-issued provider call can also finish after disposal.
310
+
Disposal alone supplies no outcome if nothing resumes the work. This promise
311
+
does not transport JavaScript promises across tabs or a page reload, and a
312
+
different Collection object does not inherit those callers through an unchanged
313
+
ancillary Collection. Core's conflicting-transaction rollback rules still apply
314
+
to pending restored snapshots. Dispose and clean up account-scoped Collections
315
+
separately when ending an account's UI lifetime;
316
+
decide separately what to do with that account's durable outbox.
317
+
318
+
Copying or migrating pending rows between independent outboxes is outside this
319
+
handoff guarantee. The executor has no durable outbox identity. Replaying a copied
320
+
row with the same transaction ID and Collection objects can settle the original
321
+
callers while the original outbox still retains its copy.
322
+
303
323
After `mutationFn` returns, the executor records a `deletion-pending` outbox
304
324
phase before removing the row. If recording that phase or removing the row
305
325
fails, `commit()`, `when('settled')`, and the per-ID completion waiter reject
0 commit comments