GeezerVison is showing github.com — id: design: Wire format & transport adapters — postcard schema, non-UDP carriers, relays/proxies · Issue #5674 · developing-today/code
id: design: Wire format & transport adapters — postcard schema, non-UDP carriers, relays/proxies #5674DescriptionExtends #2036 (ID messaging/relay protocol v1). This is an EXPANSION design: it does not replace #2036, it defines the concrete wire format #2036 assumes and the adapter family that lets ID run where native iroh/UDP cannot.
Problem
#2036 designs messaging/relay at the protocol level, but leaves open: (a) the exact bytes on the wire, (b) how ID traffic crosses interfaces that cannot natively speak the iroh UDP protocol, and (c) how relays/proxies behave as standard, high-performance infrastructure rather than ad-hoc fallbacks. Without a frozen wire contract, every adapter and every implementation invents its own framing and versioning, and forward compatibility becomes guesswork.
Goal
One canonical postcard wire schema for ID, versioned and forward-compatible, plus a family of transport adapters that carry the same ID payloads unchanged over non-UDP interfaces, with relays and proxies specified as first-class standard protocols.
Feature set — full expansion
1. Canonical postcard wire schema
- Define the exact postcard (serde / postcard crate) schema for every ID message type carried by id: design: ID messaging/relay protocol v1 #2036: envelope, handshake/identity, direct message, relayed message, control/keepalive, error, and capability negotiation.
- Envelope fields: schema major/minor, message type discriminator, sender/recipient IDs, stream/sequence identifiers, timestamp/clock fields, payload length, flags (compressed, encrypted, fragmented), and extension/TLV area.
- Serialization rules: field ordering, varint encoding, optional-field encoding, maximum message size, fragmentation and reassembly when a carrier has a smaller MTU.
- No silent coercion: unknown discriminators, truncated frames, and oversized payloads have defined error behaviour.
2. Versioning and forward-compatibility rules
- Version negotiation at connection/session start: peers advertise supported schema range and adapter capabilities; the session settles on the highest mutually supported version.
- Forward-compat contract: additive optional fields are ignorable by older readers; readers MUST preserve/forward unknown extension data where relaying; breaking changes require a major bump and a dual-stack transition window.
- Deprecation policy: how a field/type is deprecated, how long both forms are accepted, and how conformance tests enforce it.
- Golden vectors: published byte-for-byte test vectors for each message type at each supported schema version, so non-Rust implementations can prove compatibility.
3. Framing per carrier class
- Length-prefixed framing for stream carriers (TCP, WebSocket, Unix sockets, stdio/pipes).
- Datagram framing for packet carriers (UDP/iroh native path, WebRTC data channels, QUIC datagrams).
- Chunking for constrained / store-and-forward carriers (HTTP request/response, file drop, QR / sneakernet-style transfer, email/SMS-sized payloads if ever used) — including reassembly, deduplication, and out-of-order tolerance.
4. Transport adapters (same payload, many carriers)
Adapters MUST NOT change ID semantics; they only carry frames. Initial adapter set to design:
- Native iroh/UDP (the baseline, from id: design: ID messaging/relay protocol v1 #2036).
- WebSocket / WSS (browser clients, networks that only allow 443).
- Plain HTTPS long-poll / streaming (most restrictive web environments, corporate proxies).
- WebRTC data channel (browser-to-browser without a relay in the middle).
- TCP direct and TCP-over-TLS.
- Unix domain socket / named pipe (local IPC, terminal and daemon co-location).
- Bluetooth LE / local-network (mDNS/Bonjour discovery) for offline / LAN-only operation, if feasible within payload limits.
- Store-and-forward file/message-queue carrier (e.g. object storage, a message queue) for intermittently connected nodes.
Each adapter spec covers: discovery/addressing, connection lifecycle, MTU/fragmentation, ordering and reliability guarantees (and how gaps are surfaced to the layer above), NAT/firewall traversal, and how identity/authentication from id: design: ID messaging/relay protocol v1 #2036 binds to the carrier (e.g. TLS is transport encryption only, never a substitute for ID end-to-end identity).
5. Relays and proxies as first-class standard protocols
- Relay protocol as a standard, implementable by third parties: relay handshake, authentication/authorization of relayed traffic, quota/rate-limit signalling, relay discovery and selection, multi-hop relaying, and relay health/latency advertisement.
- Proxy modes: dumb byte-pipe proxy (no ID awareness), ID-aware relay (routes on envelope only, cannot read payloads), and store-and-forward relay (holds messages for offline recipients with defined retention and delivery receipts).
- High-performance requirements: zero-copy forwarding where possible, connection pooling/multiplexing, backpressure signalling end-to-end (a slow recipient must not OOM a relay), and horizontal scaling of relay fleets (stateless forwarding vs. sticky sessions — pick and justify).
- Privacy: relays learn the minimum metadata possible; specify exactly which envelope fields a relay may see and which are end-to-end encrypted.
6. Security binding
- End-to-end encryption and signing sit above the wire schema and below no adapter: an adapter compromise cannot forge ID identity.
- Replay protection (sequence/nonce rules), downgrade protection (an attacker forcing an old schema version or a weaker carrier must be detectable), and explicit rules for mixing encrypted and plaintext carriers.
7. Observability and diagnostics
- Standard per-adapter metrics: bytes/frames, latency, error classes, negotiation outcomes, version distribution.
- A diagnostic/trace frame type (opt-in, authenticated) for
id ping-style path debugging across relays and adapters.
Conformance tests (required per adapter)
- Golden-vector encode/decode tests for every message type and schema version.
- Round-trip property tests: arbitrary valid payloads survive encode → adapter → decode unchanged.
- Interop matrix tests: every adapter pair can exchange the same session (client on adapter A, peer on adapter B, via relay if needed).
- Negative tests: truncated, oversized, unknown-version, and unknown-type frames fail in the specified way, never panic or hang.
- Fragmentation/reassembly tests at carrier MTU boundaries; out-of-order and duplicate delivery tests for store-and-forward adapters.
- Version-negotiation tests: old peer + new peer settle correctly and never silently corrupt.
- Performance baselines per adapter (throughput/latency envelope) so a regressing adapter is caught in CI.
Non-goals
- Re-designing the messaging semantics of id: design: ID messaging/relay protocol v1 #2036 itself.
- Choosing a single "winner" carrier — plurality of adapters is the point.
- Application payload formats above the ID envelope (chat, boards, notes have their own designs).
Decomposition sketch
Follow-on design tickets to be filed from this issue (each then breaks into implementation tickets):
- Postcard wire schema v1 — envelope, discriminators, golden vectors.
- Versioning, negotiation & forward-compatibility policy.
- Framing & fragmentation spec for stream, datagram, and store-and-forward carrier classes.
- Adapter spec: WebSocket/WSS + HTTPS fallback (browser/restrictive-network path).
- Adapter spec: WebRTC, TCP/TLS, and local IPC (Unix socket / named pipe).
- Relay & proxy standard protocol — ID-aware relay, store-and-forward relay, scaling/backpressure.
- Adapter conformance test harness & interop matrix CI.
- Security binding review — replay/downgrade protection across adapters and relays.
Open questions
- Is postcard definitively the encoding for all carriers, or do browser-facing adapters need a JSON/CBOR diagnostic variant of the same schema?
- What is the maximum canonical message size, and who owns fragmentation — the wire layer or the messaging layer in id: design: ID messaging/relay protocol v1 #2036?
- How much metadata may an ID-aware relay legitimately see, and is envelope encryption (hiding routing metadata) in scope for v1 or deferred?
- Which constrained/store-and-forward carriers are real requirements vs. speculative (file drop? queues? BLE?) — cut the adapter list to what will actually be built first.
- Relay operation model: first-party fleet only, federated third-party relays, or both — and what trust/quotas does each imply?
- Do we need a wire-schema registry/version catalogue published outside the repo for third-party implementers?
Program note: expansion-style design — a later pass breaks this into the follow-on design tickets above, then implementation tickets. Relatives: #2036. Activitydezren39 commented on Nov 5, 2026 Gap pass (WS-F, 2026-11-04): this issue's decomposition sketch is now filed.
Each follow-on design ticket named in the sketch above was filed as its own issue (label app/id), so the acceptance item “Follow-on design tickets filed from the Decomposition sketch” can now be checked:
Exception, where applicable: any sketch item already answered by a later filing is noted in the pass worklog rather than duplicated. Design prioritisation is now independent per ticket; implementation timing is a separate decision. dezren39 commented on Nov 5, 2026 Raw-conversation cross-link (WS-F2 mining pass, 2026-11-04). Relay/DNS semantics questions in Drew's words, from the peer-discovery plan review — this design's relay section should answer them explicitly:
"can i enable multiple relays and does it try them all concurrnetly or one by one?(maybe there is a difference between relays to check to find nodes vs relay im published on can i be published on multiple? is the dns resolution thing something others can run or just iroh.computer)"
— OpenCode session ses_2ec427b80ffeuCx6dCuANmiN6c ("Peer discovery plan review"), 2026-03-23
Three concrete requirements buried in that one breath:
- Relay roles are distinct. A relay used to look up other nodes and the relay a node is published on (its home relay) are different jobs; the design should name them separately instead of treating "relays" as one undifferentiated list (the build-time defaults work in id: design: build-time defaults file — embed network defaults from an optional JSON file instead of only hardcoded consts #5916 also needs this distinction — a defaults file that can't tell lookup relays from publish relays can't express a private-network build).
- Multi-relay behaviour is specified. When several relays are configured: are lookups tried concurrently or sequentially (latency vs. chatter), and can a node be published on more than one relay at once (redundancy vs. split presence)?
- Discovery DNS is self-hostable, or the design says why not. The pkarr/DNS resolution path should not silently depend on one operator's infrastructure (iroh.computer); if ID nodes can run their own resolver/discovery service, that is a designed component, and if they cannot, the dependency is stated as a boundary.
The same session also asked "can mdns be enabled?" — that half landed in code (mDNS address lookup is wired in the peers command, with a --no-mdns opt-out), which is why this comment carries only the relay/DNS remainder. dezren39 commented on Nov 5, 2026 🤖 Agent note · handed off
dezren39 commented on Nov 5, 2026 🤖 Agent note · handed off
developing-today commented on Nov 5, 2026 🤖 Agent note · handed off
- Agent: queue worker (repo-worker-code), lane code-a
- Session / ID: task 10107
- Found via: queue claim (re-claim after prior handoff park expired unbound)
- Task: task 10107 (triage for issue id: design: Wire format & transport adapters — postcard schema, non-UDP carriers, relays/proxies #5674) is assigned to the opencode execution lane again — handing off to the opencode claimant, which launches the bound session. This lane did not work the triage itself. Verified fresh: issue id: design: Wire format & transport adapters — postcard schema, non-UDP carriers, relays/proxies #5674 is OPEN with no hard-stop labels (no held, user/owned, do-not-merge, do-not-auto-edit); parked labels already in sync.
- Expectation: claimant launches the bound opencode session for task 10107; if unbound by lease/park expiry, task 10107 returns to the queue. Note: several child designs (id: design: framing & fragmentation per carrier class (from #5674) #5810 triaged today by task 10213, among others) are ordered after this issue's decision record — this triage is on the critical path for the id: design: Wire format & transport adapters — postcard schema, non-UDP carriers, relays/proxies #5674 family.
- Links: task 10107 (repo-health-code-pilot), assigned_lane=opencode
dezren39 commented on Nov 5, 2026 🤖 Agent note · handed off
dezren39 commented on Nov 16, 2026
Agent note (lane code-b, task 12892): child decision record for #5808 opened for this parent — one named deviation for the parent's record to adopt, amend, or reject in the open.
- PR docs(id): postcard wire schema v1 decision record (#5808) #10668 adds
doc/2026-11-16_decision_id5808_postcard_wire_schema_v1.md: the postcard wire schema v1 (envelope byte layout, discriminators 0–6, flag semantics, 1 MiB frame cap, golden vectors), decided against this issue's body (§1–§2) as the named draft, following the id: design: versioning, negotiation & forward-compatibility policy (from #5674) #5809/id: design: framing & fragmentation per carrier class (from #5674) #5810 sibling precedent. id: design: framing & fragmentation per carrier class (from #5674) #5810 explicitly left the byte layout and the fragmented flag semantics to id: design: postcard wire schema v1 (from #5674) #5808.
- Named deviation: §1 of this issue lists "payload length" among the envelope fields. The id: design: postcard wire schema v1 (from #5674) #5808 record carries the length in the payload's own postcard length prefix (and the carrier framing delimits the frame, per id: design: framing & fragmentation per carrier class (from #5674) #5810) instead of as a separate header field, because a third copy of the length could disagree with both. Every other §1 field is carried verbatim, in order.
- Precedence: the record states that when this parent's decision record lands, any conflict — including this deviation — resolves in the parent's favour and the child record is revised.
dezren39 commented on Nov 17, 2026 🤖 Agent note · triaged — already triaged; parent design issue, children progressing
Finding: this design issue was already triaged — task 10107's triage on 2026-11-05, re-verified 2026-11-07, and task 13844 completed as triaged on 2026-11-10 naming it. Nothing about that disposition has changed:
Task 18331 completes as triaged.
dezren39 commented on Nov 17, 2026
Agent note — task 19860 triaged (lane any-t): concurrence with the triage of record
dezren39 commented on Nov 24, 2026
Second-pass verdict (openchamber lane oc-code-03, queue task 22841, 2026-11-24)
Fresh state: #5674 OPEN, status/triaged, no hold labels. The 2026-11-17 triage of record still holds: a parent design decomposed into child design tickets under #2036. No new packet is routed. developing-today-fleet commented on Nov 26, 2026 agent-note:v1
state: verified -> triaged
task: 24864
issue: #5674
lane: code-i
worker: repo-worker-code
origin: openchamber-scheduled-lane
Fresh revalidation (2026-11-26): #5674 OPEN, status/triaged, no hold labels — triage of record still holds. Parent design for the wire-format/transport-adapter expansion. Movement since the 2026-11-24 pass: grandparent #2036 and child decision records #5808/#5809/#5810 are now CLOSED, but live follow-ons still reference this parent — notably #13929 (transport adapter contract, multi-transport head) and #13926 (multi-transport reach epic), plus #5753 and #13880. Stays open as parent; no new packet routed. No code changed in this pass. developing-today-fleet commented on Nov 27, 2026
Triage concurrence (lane oc-code-01, 2026-11-27): #5674 OPEN, status/triaged, no hold labels. Triage of record still holds: parent design for wire-format/transport-adapter expansion, decomposed to child designs.
Fresh delta since task 24864 (2026-11-26): grandparent #2036 is now CLOSED (2026-11-26); child decision records #5808/#5809/#5810 remain CLOSED. Live follow-ons referencing this parent remain OPEN: #13929, #13926, #5753, #13880. Stays open as parent tracker; no new packet routed from this task, no code changed. developing-today commented on Nov 27, 2026
Triage concurrence (OpenChamber scheduled lane oc-code-05, 2026-11-27): fresh revalidation confirms #5674 remains OPEN, already status/triaged, with no hold labels. Parent protocol #2036 is now CLOSED; live related follow-ons remain OPEN: #13929 (transport adapter contract), #13926 (multi-transport reach), #5753 (KDL stack research/design), and #13880 (ID apps graph). Existing disposition still holds: keep #5674 as the parent tracker for its wire-format/transport-adapter scope while related follow-ons progress. No new fix packet is appropriate; no code changed. developing-today-fleet commented on Nov 28, 2026
Triage recheck — lane oc-code-01, 2026-11-28 ~03:15Z. Verdict unchanged: design expansion, no immediate code fix; requires follow-on design tickets (1, 2, 3-8) to land before implementation.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|