Skip to content

101 F1 F4: session protocol number in the handshake, per-peer inbound limits (do not merge before 101-int) - #562

Open
AlexZ005 wants to merge 5 commits into
mainfrom
feat/101-proto
Open

AlexZ005 wants to merge 5 commits into
mainfrom
feat/101-proto

Conversation

@AlexZ005

Copy link
Copy Markdown
Collaborator

Roadmap 101 F1 + F4 (lane 101-proto). Do not merge — 101-int merges after the 17 Nov launch. Base v1.65.0 with v1.66.0 merged in.

What it does

F1 — session protocol in the handshake. Every dial's PeerJS metadata and the modules message now carry proto (WIRE_PROTO = 1, src/lib/wireProto.js) and caps (wb, dev, fc). A peer that sends no proto speaks 1. When two peers speak different protocols they do not connect, and no scene data is applied on either side:

  • the side on the lower protocol sees "This session uses a newer version. Reload to update." with a Reload button;
  • the side on the higher protocol shows " needs to reload (older version)" in People.

The check runs before the whitelist, the approval card and any wiring. A link with no dial metadata passes on a protocol-1 build; on a newer build its messages are held until its modules arrives. A refused peer is not redialled by the reconnect window or mesh fill, and a typed Connect clears that. Production stays on protocol 1, so two peers on the same build behave exactly as before. Additive extensions (for example 80a) become a caps flag, as OPEN-CORE.md "The session protocol" describes.

F4 — per-peer inbound limits. Each peer has a budget at the head of the receive pipeline (src/lib/wireBudget.js):

  • 10,000 messages/s;
  • 64 MB/s;
  • an object size cap of 64 MB.

Each limit is at least 4x the peak measured on the heaviest suites and on every scenes-repo/template object. A message over budget is dropped and counted (budget:* in Diagnostics). The person sees one notice per peer per minute, and the link stays up.

Framing. build/_headers sends frame-ancestors 'self' when no play origin is configured; /play and /discord keep *. With a play origin set (production) nothing changes.

Measured peaks (receiving page, per peer, per 1 s)

load msgs/s bytes/s largest object
late join into the biggest template + 24 MB asset + 500 creates + 500-object batch move + 60 Hz grab 534 1,051,153 34,681
dialback-sync 56 141,190 141,444
session-volume-limits 52 262,939 33,696
scenes repo (39 files) + templates — — 270,665 (JSON)

Proof

  • New suites (in battery.json):
    • wire-proto 39/0: both directions, reconnect after refusal, mesh fill, the gate on a link with no metadata.
    • wire-flood 20/0: heavy legit loads drop 0. A flood has 8,701 of 9,000 messages dropped, one notice, the link stays open, and the receiver's median frame time is unchanged.
  • Touched-area suites, all green:
    • on the merged tree: join-result 41/0;
    • on v1.65.0: wire-hardening, move-wire-shape, late-joiner-floor, session-volume-limits, topo-channel, dialback-sync, multiselect-v2, peer-moderation 45/0, peers-popover 21/0, fast-channel-loss 32/0, fast-channel-fallback 5/0, version 8/0.
  • dial-metadata 43/1 — the failing check ("a later plain dial to the same peer carries no cloud data") fails the same way on v1.65.0 without this branch.
  • On the merged tree: unit 4,900 green, check-ratchet 274/37 = baseline, check:tokens clean, npm run build green.

🤖 Generated with Claude Code

AlexZ005 and others added 5 commits November 11, 2026 10:26
…efusal path, inbound budget, frame-ancestors self

- wireProto.js: WIRE_PROTO (1), protoOf (absent = 1, unreadable = refused), caps, refuse message,
  the People rows; a debugStores-only test hook (debugWireProto / __stores.wireProto.setProto)
- peerHandler: proto + caps on every dial and in the modules message; inbound dials checked before
  any whitelist/card/wiring; a refusal dial (joinresult denied + refuse) or a refuse message; a
  protocol gate at the receive pipeline head (latched per link, holds while unknown on a newer
  build); no reconnect window or mesh-fill redial for a refused peer
- wireBudget.js: per-peer messages/s + bytes/s budget and an object size cap at the pipeline head,
  counted drops + one throttled toast (wireErrors.noteWireDrop), never a disconnect
- frame-ancestors defaults to 'self'; /play and /discord keep * without a play origin
- People: '<name> needs to reload (older version)'

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ws, OPEN-CORE.md + CLAUDE.md notes

Chain 1 results in ~/.code/lanes-30/101/proto/logs: wire-proto 38/1, wire-flood 16/2 (flood sender
timer-throttled in headless), dial-metadata 42/2 (to A/B on v1.65.0), join-result, wire-hardening and
the peak runs green. LIMITS still the provisional values; the measured peaks are far below them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rs-older line

The trigger click was silent-caught and could land under a toast; peer-moderation opens it the same way.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ous bursts

LIMITS: 10,000 msgs/s (~19x the 534 peak), 64 MB/s (~60x measured, above one data channel on a
fast LAN), 64 MB object cap (~240x the largest scenes-repo/template object, above a textured
model at the 25 MB import cap). Unit test asserts >= 4x each peak and bytes/s >= object cap.
wire-flood 3: B sends 3 x 3000 synchronously (a headless setTimeout loop never crossed the cap),
B's rendering paused for both frame windows, rAF deltas start at the first frame, and the toast
count is asserted after the object cap (1) and again after the flood (still 1, the per-minute rule).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
1.66.0

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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