Repository navigation
The hardening lap: close the one genuine parity gap found in the parity
verification pass — BEAM nodes lost their live subscriptions whenever a
relay connection dropped (Gun.js's mesh.js re-asks node.ask souls on
'hi'; BEAM never did). Verified end-to-end against a real Gun.js relay
with wire-level traces.
Added
- Resubscribe-on-reconnect (Router, commit abfde42): the Router records
locally-originatedGets (asks) in a bounded registry
(local_asks,SEEN_MSGS_MAX_SIZE— matching Gun's ~10K ask ceiling).
OnHi(initial contact — the one transport-agnostic seam: native
WsConn, WASM WasmWsConn, and WebRTC all sendHionpre_start),
after thedam:"?"ack, the Router re-issues every recorded ask with
FRESH message IDs (theseen_get_messagesdedup would eat reused IDs)
through the normal pipeline. Live subscriptions now survive reconnects
with zero user action — Gunmesh.js 'hi'parity. - E2E resubscribe test (
resubscribe_after_reconnect, wire_live,
commit b172dab): SAME node, persistenton()subscription survives a
relay kill + restart on the same port and receives post-restart data
without a newon()— the full disconnect-detect → reconnect → Hi →
re-issue chain verified against a real Gun.js relay (unlike the
existingreconnection_synctest, which reconnects a NEW node). - Protocol sentinel module (
src/sentinel.rs, commit ce91802): the
wire protocol sentinels (__beam_replay_complete__etc.) centralized
as named constants with rename-guard + distinctness tests; 59 scattered
literals refactored across node/router/7 storage adapters;
ack::QUORUM_MET_SENTINELkept as a deprecated alias (API preserved).
Storage table identifiers (rod_nodes_v1,ROD_NODES, …) deliberately
remain literals — they are wire-format/database identifiers, not
consumer sentinels.
Fixed
- Get fan-out for pure-client topologies (Router, commit b172dab):
handle_get's blanketpeer_addrsalready-sent marking assumed every
known peer is an OWM/WsServer-managed child. For pure
Node::connect_peerclients (WsConn actors with no OWM parent) that
suppressed the ONLY path a Get had to the relay — such clients could
push data but never fetch it. Now the marking applies only when a
server peer exists to do the fan-out; otherwise the known-peers sample
delivers the Get directly. (Hybrid topologies keep the marking —
documented pre-existing limitation.) - connect_peer disconnect detection (commit 610adbd):
connect_peer
slept 3600s after connecting ("TODO: detect disconnect") — reconnect
latency up to an hour. It now awaits theWsConnactor's lifecycle
handle via the newstart_actor_with_handle; resumption of the
connect loop IS the disconnect signal. Reconnects within seconds. - WASM reconnect loop (commit 25bfab6): browser
WebSocketpeers
never reconnected —WasmWsConn.onclosewas an empty closure and
connect_peer_wasmwas one-shot. Now:onclose/onerrorstop the
actor (same chain as native),new()split intofrom_socket(closure
wiring, written once) +try_new(URL →Result, no panic on
construction failure), andconnect_peer_wasmruns the same reconnect
loop as native (immediate reconnect on disconnect; exponential backoff
1s→60s only on construction failures; loop aborted onnode.stop()).
ActorContext::child_taskdrops itsSendbound on WASM (browser
futures are!Sendviaspawn_local; existing callers unchanged). - once() Lagged panic (commits f1bd37b + 7511542):
once()panicked
onRecvError::Lagged(.expect("recv error??")) — a routine replay
burst larger than the broadcast buffer crashed the node. Now: bounded
wait with a remaining-budget loop (lag recovery never extends the
caller's timeout; portable across native + WASM),Lagged→ log and
continue (delivery resumes at the oldest retained value),Closed→
None. Burst test withbroadcast_buffer_size = 2proves the crash
path is structurally impossible. - Wire msg-id edge fixtures (commit 94c76f7): three edge fixtures
predated thec8e8268Gun-parity msg-id relaxation and failed on a
clean checkout of main — updated to the standing spec (any string
accepted, missing ID generated). Pre-existing breakage, verified
against a clean worktree before fixing.
Changed
- once() default wait 99ms (commit f1bd37b): was 66ms, documented as
"matching Gun opt.wait" — Gun's actual default isopt.wait || 99
(src/on.js:66). Now exported asDEFAULT_ONCE_WAITwith tuning
guidance; the doc lie is fixed. - CHANGELOG: NACK absence-signal documented as future work with the
Gun.js parity rationale (commit 8ed33a7).