0
Fork 0
mirror of https://github.com/zeronsh/comet.git synced 2026-11-16 18:57:19 +00:00
Commit graph

1 commit

Author SHA1 Message Date
wing-anara
22b5a67dc6 sync: pull-first HTTPS transport — 1-RTT bootstrap, WS demoted to enhancement
The airplane-wifi fix. The WS needs 4+ serial round trips (DNS, TCP, TLS,
upgrade, hello) before byte one, and hostile middleboxes strip the upgrade
entirely — the user-reported 'never connects on the plane'. A plain HTTPS
GET is 1 RTT on a warm connection and indistinguishable from a webpage to
any proxy. So: push/pull/poke.

Edge (worker + DOs):
- GET /registry/{org}/rows?since= — the WS hello's exact delta answer
  (full/gcFloor rules shared with handleHello); ?beat=1 doubles as a
  presence beat. POST /registry/{org}/push — the WS push twin via a shared
  applyPushBatch core (validate, atomic apply, rows broadcast to live
  sockets); LWW clocks make replays no-ops.
- GET /chat2/{id}/rows?after= — one request collapsing connect→hello→
  state→rowsReq→backfill: u32-LE length-prefixed frames (state with
  frontier payload, rows, rowsDone), byte-identical encoding to the WS.
  POST /chat2/{id}/rows?batchId= — push twin, batchId-deduped.

Desktop (Rust): RegistryTransport/ChatTransport seams; with a transport,
construction resolves immediately (local-first), an HTTP pull bootstraps
in ~1 RTT while the socket dials, and every backoff cycle pushes pending +
pulls over HTTPS — a WS-hostile network degrades to ≤30s polling instead
of silence. Engine wires both via the existing bearer/reqwest plumbing
(registry: URL derived from the WS provider; chat: EdgeChatTransport).

iOS (Swift): WorkspaceStore pull-first bootstrap + 20s poll-while-down +
HTTP flush of pending writes; the header spinner now means 'server state
reached this session' (flips on the ~1-RTT pull, not the 4-RTT socket).
ChatRoomClient.pullSync: HTTP push of pending sends (permanent rejections
retire, mirroring the error-frame path), framed rows pull applied through
the exact socket path, checkpoint fetch shared via fetchInFlight.

Validation: new edge/scripts/pullpush-check.mjs green against wrangler dev
(push/ack/no-op replay, delta-at-cursor, presence beat, framed pull,
excludeOwn, batchId dedupe); existing smoke + chat2-check (65) + reset
suites green; zeron-sync 34, engine+rpc 180; iOS sim build clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-17 16:22:26 +03:00