Replay semantics behind the live example
Checked 30 September 2026 against repository head 3018fe73de07232b15157e2c43577832a8a10fa7.
The model
- A competing publication is reported as a conflict. Background sync pauses at a conflict; the application explicitly calls its SDK's conflict-resolution method.
- Resolution adopts the authenticated shared revision. Matching local transactions already present there are recognized by identity and recipe, so they are not applied twice.
- The remaining local transactions replay in order. Their original SQL and parameters run against the new base. SQL expressions are evaluated again; previously computed application values supplied as parameters stay frozen at their recorded values.
- The resolution result identifies already-published, replayed, quarantined and still-pending transactions. Successfully replayed work is local until a subsequent sync publishes it.
Replay is SQL re-execution, not an inferred business-level merge. For example, an application that previously read 12 and calculated 11 has recorded an explicit value if it binds 11 to SET units = ?. Replay keeps that 11. An expression such as SET units = units - ?, with parameter 1, instead subtracts from the newer stock value.
The SDK checks recorded execution outcomes and transaction survival. A constraint failure or replay mismatch rolls back the replay attempt and quarantines its transaction; later queue items can still proceed. Resource failures such as a busy database or I/O error can interrupt replay while preserving pending work. Quarantined transactions are not silently retried. Full diagnostic records follow configured retention limits; safety tombstones prevent reuse of rejected transaction identities.
Verified café examples
Each check used two native Windows SDK databases and a local-directory remote. Both started with 12 units. One device performed its pending update locally; the other published 8 units. The first device then received a conflict and explicitly resolved it.
| Recorded operation | Shared base | Result after resolution |
|---|---|---|
UPDATE stock SET units = units - ?, parameter 1 | 8 | 7; one transaction replayed |
UPDATE stock SET units = ?, parameter 11 | 8 | 11; one transaction replayed |
UPDATE stock SET units = units - ?, parameter 9, with CHECK(units >= 0) | 8 | 8 unchanged; one transaction quarantined |
The example table contained one product row, id = 1. The page shows an explicit WHERE id = 1 to identify that product. Recorded verification results .
These are functional checks, not latency measurements or a certification of every replay path. The installed SDK was built from df3809a06183f35424f6cb3bcd75a11b8c05234d; the current source contract was inspected separately. The landing-page sequence now executes the bundled browser engine. replay-state.mjs opens two disposable device databases through demo-engine.mjs, using manual synchronization and one in-memory DemoBucket. No bucket request leaves the tab. The original native results below are historical evidence, not a claimed browser test run.
The live default run queries the starting stock, records both sales, then waits for each step button. The laptop calls sync() first. The phone calls sync() and must receive a conflict before resolveConflict() runs. Displayed device counts come from SELECT units FROM stock WHERE id=1. The bucket count is the publisher’s queried stock recorded only after a successful push. Resolution does not publish: the final step syncs the phone and then the laptop.
The disclosure also offers the bound-value and constraint cases. Choosing one removes the previous run’s scratch directory and starts two fresh databases. The replacement parameter is calculated from the phone’s queried starting count; the constraint case records a sale of nine. The displayed transaction counts and words “replayed” and “quarantined” come from the returned ConflictResolution, not this document or the JSON evidence file.
Browser acceptance commands (run after the production build):
PYTHON_BIN=/opt/homebrew/bin/python3.14 node --test scripts/test-homepage-engine.mjs
That suite asserts the expected 7, 11 and unchanged 8/quarantine outcomes, along with the real conflict, resolution transaction ids, SQL query results, and subsequent publication/pull. It also checks delayed loading, local transport and failure states. Browser results must be checked by running that suite. No completed browser run is recorded here.
The visible sequence starts with 12 units on both devices. The laptop sells four and the phone sells one, giving separate local counts of 8 and 11. The laptop publishes 8 first. After the phone observes a conflict, its application resolves it: adopt 8 and re-run the subtraction to obtain 7 locally. The bucket remains at 8 until the phone publishes 7. The laptop then pulls the published result. The last frame summarizes that publication and pull; it is not a claim that conflict resolution itself instantly updates every device.
Source
- Core contract R5–R6 (private source reviewed; not publicly accessible): ordered replay, frozen parameters, SQL re-execution, quarantine and recovery.
- Public API contract A4, A6 and automatic sync (private source reviewed; not publicly accessible): explicit conflict resolution and observable results.
- Native replay runner (private source reviewed; not publicly accessible): normal completion, quarantine and interruption paths.
- Node conflict-resolution example (private source reviewed; not publicly accessible): detect conflict, resolve it, then sync again to publish.
