Skip to content

Transport: protocol v2 codec, socket, connection and timers (DEV-1150 part B) - #49

Merged
adamski merged 9 commits into
mainfrom
adam/dev-1150-transport
Sep 29, 2026
Merged

adamski merged 9 commits into
mainfrom
adam/dev-1150-transport

Conversation

@adamski

@adamski adamski commented Sep 28, 2026

Copy link
Copy Markdown
Collaborator

DEV-1150 part B: the v2 transport layer that the driver loop (part C) will use to run the sans-IO core against a real websocket. Stacked on #48 (part A, engine core). Merge #48 first.

What's in it

  • Core: an upsert is an echo only when its envelope is the uploaded version (doc.seq == change.seq). A newer page envelope never re-applies the covered delta. With no other pending rows it is adopted as-is; with pending rows it takes the conflict path, and Recover keeps the local content.
  • Core: Input::ConnectRefused { gen, error }. HTTP 426 halts with update_required. Every other refusal backs off.
  • transport::wire: v2 payloads, join HMAC signing, socket_url. JoinAuth derives nothing, so the secret cannot be printed.
  • transport::codec: Phoenix v2 array frames to and from core requests. It matches refs to request kinds. phx_error/phx_close end the channel, and unreadable replies become transient protocol_error.
  • transport::socket: one websocket task per generation. Dropping the handle aborts the task, even mid-dial.
  • transport::connection: runs socket effects and drops events from any generation but the current one. It never invents a reply for a dead socket.
  • driver::timers: a DelayQueue where rescheduling an id replaces it.
  • Tests: wire_contract_tests now runs the real codec against the server's recorded frames. tests/v2_smoke.rs is an #[ignore]d smoke test against a real v2 server (join, request, heartbeat, 426, auth_invalid).

Testing

  • cargo test -p replicant-client --lib: 289 passed. --test wire_contract_tests: 14 passed.
  • tests/v2_smoke.rs against replicant-server dev-1151 (via test/run_phoenix_interop_local.sh): 3 passed. Normal runs show 3 ignored.

@adamski
adamski changed the base branch from adam/dev-1150-replicant-redesign-23-implement-the-single-owner-connection to main September 29, 2026 21:20
@adamski adamski closed this Sep 29, 2026
@adamski adamski reopened this Sep 29, 2026
@adamski
adamski merged commit 5d71982 into main Sep 29, 2026
4 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