Repository navigation
Engine: pure connection/sync state machine core (DEV-1150 part A) - #48
Merged
adamski merged 28 commits intoSep 29, 2026
Conversation
…etry-after and fatal/forbidden classification
…fatal upload and fetch replies, reset failure counters on local settle
…doc_upload crate-private
Deserializes every recorded server v2 frame into the client's engine types, pins the shared content-hash fixture, and replaces hash.rs's two hand-built pin tests with a read of that shared fixture.
Remove wire_contract_tests.rs's duplicate of hash.rs's fixture-driven hash test, and assert the server hash survives the jsonb round trip and matches the client hash of the echoed upload content.
This was referenced Sep 28, 2026
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.
Part of #46 (connection lifecycle redesign) and DEV-1150. Part A of the implementation: the pure core only. It is not wired into the client yet; the driver, transport, SQLite effects and FFI come in a follow-up PR.
What this adds
New module
replicant-client/src/engine/. None of it performs I/O, reads a clock, or uses real randomness, so every race can be tested deterministically.types.rsChange,DocEnvelope,Upload,ServerErrorhash.rsdoc.rs,doc_upload.rsapply_change,apply_server_copy/missing/deleted,build_upload,settle, rebase, and the settle invariantbackoff.rsmachine.rsCore::step(Input) -> Vec<Effect>: connection lifecycle, catch-up, snapshots, cursor rules for live changes, upload orchestration, timers and lifecycle eventsfuzz_tests.rsHow it addresses #46
The rules are the ones in the design doc (DEV-1149). The main ones:
upload_idin the outbox, so an echo never double-applies a change.auth_invalid.Interface notes for the driver PR
get_documentmust return adeletederror withcurrent_seqfor deleted documents.Testing
cargo test -p replicant-client --lib engine: 134 tests pass. The workspace--libsuite is green.fmtandclippy(correctness and suspicious) are clean.Wire contract with the server
tests/wire_contract_tests.rsdeserializes every frame recorded by the v2 server (replicant-server#10) into the engine types, andhash.rsnow checks the shared content-hash fixture. The request and response structs are test-only mirrors until the driver PR adds real serde types.