Keep a durable history lineage at each room writer. Ordinary rebinding preserves it; a full restore installs a fresh lineage in the same storage transaction. Scope reader positions to that lineage and keep passive queued projections from replacing another tab's saved reading progress. Private Domain protocol 47, SQLite 10 and Browser room IDB 8 replace the prior internal formats. Room archives and App wire are unchanged. Validated with the Rust/Web-WASM/protocol gate, real Browser writer restore and cross-tab read-marker controls. Local reading hints remain best-effort when a lagging tab is actively read across successive restores.
6.2 KiB
6.2 KiB
ADR-0017: Contracts Fixed Before The First 3.0 Release
- Status: proposed
- Date: 2026-11-25
Context
3.0 is unpublished, so a private wire or storage shape is replaced without aliases, dual readers or migrations. After the first release, installed Apps and room stores hold the released shapes, and later versions have to work with them. Some contracts are costly to change after that; others can wait for a consumer. Versioning promises that an older App keeps working with a newer site within a major version, and that forward upgrades preserve durable authority. The code does not yet say how:
Joinrequires the protocol number to match the current wire version (prototype/channel-core/src/lib.rs). One outer watch-activity metadata reader accepts additions; no rule says which additions a reader may ignore.- The review at
35034f34found that Browser accepts anyroom_reply.result.type(src/client/channel/protocol.ts) and rejects only"error"(src/client/channel/session.ts), so with a version mismatch or a bug an unknown type resolves most room requests as success. - A room store opens only at one exact
user_version(prototype/channel-core/src/storage.rs), and the Browser store aborts any upgrade (prototype/channel-browser/src/room-host.ts). This protects data; no format change has needed an upgrade yet.
Decision
Settled before the first public release
- Compatibility. A stable wire baseline, plus extensions the recipient selects. A written matrix covers an old client with a new domain, an old writer with a new domain, unsupported actions, and the direction of stored-data upgrades. Readers ignore additions defined as descriptive, not unknown authority or an unknown final outcome: an unknown reply type is an error, and an unknown host-input action needs a positive capability check. Extension points are explicit instead of a general tolerance (RFC 9413). The first release's readers decide what later versions may add.
- Replies. A request ends in an explicit terminal outcome that tells rejected from unknown, and a copy sent to an observer is separate from the requester's reply. Idempotency is scoped by operation: chat already has durable nonces, and an invitation rotation is recovered by reading current state. A history page as one bounded batch is measured against the present 101 signed replies per page: 50 messages, 50 reaction snapshots and one terminator. A released client that reads an unknown outcome as success cannot be corrected from the domain.
- Storage. The first public format of each store is recorded as release fixtures. A concrete transactional upgrade is added when a format actually changes, and a store newer than the code is refused, with no general migration framework. Every later upgrade starts from the released format.
- Restored history. A restore gives the room's history a new lineage that invalidates old read positions, and a normal restart keeps them. A position a released reader saved without a lineage cannot later be told apart from one that a restore made stale.
- History rules and durability. One owner holds the history rules that both writers execute. Authoritative IndexedDB writes use strict durability, because the architecture promises that history is committed before it is confirmed. Persistent storage guards against eviction and is requested at explicit hosting, not on every reconnect. A confirmed message that was lost cannot be recovered by a later version.
Deferred until a consumer needs it
- Schema source. First a bounded proof: generate the types for
UserInfo.avatarandSetProfile.avatar, keep required, omitted and null semantics and runtime validation, and remove the old owner if it works. - State revision. Reopens when a delta or resume consumer needs it. Readers already accept an added top-level field.
- Activity envelope. Dispatch over the owned kinds is exhaustive now. A generic envelope reopens when a concrete extension shows that it removes work without erasing the different authority and lifetime of each kind.
- Bytes. Effect outputs become binary first: a 64 KiB watch delivery measured 66,773 bytes as binary and 240,441 bytes in outgoing JSON effects. The encoding of small wire keys reopens only if a measurement supports it.
Not Decided Here
- The serialization format. All three clean-room designs chose Protocol Buffers for its evolution rules and breaking-change tooling. The decisions above hold for the present JSON as well, so the format can be weighed separately.
- One SQLite schema in every runtime, using SQLite on the Browser's private file system in place of IndexedDB. It would make decision 5 structural. It needs a measurement of size and start-up cost first.
- Moving the client engine into the core. It is internal and can change after a release.
Consequences
- Any concrete incompatible wire or storage correction lands before release under the present rule for private experiments.
- Versioning states the compatibility matrix the code implements, and a feature added after release is an extension the recipient selects, not a new major version.
References
- Design review against clean-room designs
- Protocol Buffers: updating a message type: adding fields is safe, and unknown values are preserved.
- RFC 9413, Maintaining Robust Protocols: an extension mechanism needs clear rules for unknown elements, written before deployment.
- JSON-RPC 2.0: a notification is a request without an id.
- gRPC status codes: a closed code set whose members say whether to retry.
- SQLite
user_versionand the IndexedDB upgrade transaction. - IndexedDB durability: transactions are relaxed by default.