Skip to content

Stage 2: synchronize composite read state - #464

Draft
fujibee wants to merge 11 commits into
dogfood/self-host-onboardingfrom
dogfood/read-cursor-sync
Draft

Stage 2: synchronize composite read state#464
fujibee wants to merge 11 commits into
dogfood/self-host-onboardingfrom
dogfood/read-cursor-sync

Conversation

@fujibee

@fujibee fujibee commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Summary

This stacked dogfood PR begins Stage 2 read-state synchronization. It defines the composite local/remote frontier and bounded exact-read protocol, then integrates the store-owned local cursor across inbox and monitor delivery.

The remote server and polling-engine implementation is intentionally deferred until the protocol review on ADR 0008 is clear. Stage 3 SSE/wake delivery is explicitly out of scope.

Contract

  • Keep local positions store-local and merge only remote server frontiers across machines.
  • Preserve out-of-order reads as exact local IDs, atomically promoting them to wire IDs with the durable message mapping.
  • Keep transport, quarantine/decrypt, projection, and read progress independent.
  • Bound and paginate exact remote state; garbage-collect it only from a proven wire-to-sequence mapping.
  • Bind remote read state to immutable server/team/protocol/member identities.

Local integration

  • Add per-pair read cursors to SQLite and JSONL.
  • Share one cursor between inbox and monitor instead of per-session watermarks.
  • Advance only through a contiguous covered prefix while retaining exact exceptions.
  • Treat pre-cursor backlog as consumed during one-time migration to avoid an upgrade redelivery storm.

Verification

  • SQLite storage contract: 32/32 passed.
  • JSONL storage contract: 32/32 passed.
  • Watch suite: 16/16 passed and exits cleanly.
  • Inbox/check-inbox suite: 4/4 passed.
  • Shell syntax and diff checks passed.

This PR must remain Draft and unmerged while the dogfood stack is under review.

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