fix(meshd): SocketAddr neighbor map + gate v2 (rebased onto main) - #50
Merged
gHashTag merged 2 commits intoJul 5, 2026
Merged
Conversation
added 2 commits
July 5, 2026 16:24
Loopback smoke on 127.0.0.1:5011/5012/5013 exposed a HashMap collision: all three simulated nodes shared 127.0.0.1, so the last insert won and node-11 lost identity. On real hardware every P203 Mini has a unique IP, so the defect is sandbox-only, but it makes CI smoke unreliable. Change: - HashMap<IpAddr, NodeId> -> HashMap<SocketAddr, NodeId> (rename ip_to_id -> addr_to_id) - Central RX dispatches on full src: SocketAddr from recv_from - drop unused IpAddr import Regression gate: - smoke/m2_loopback_smoke.sh now ends with a strict "triangle convergence gate" that fails with exit 2 if any node does not see both peers at steady ETX 1.0x. - smoke/M2_LOOPBACK_FIX_RESULTS.md documents defect, fix, and reproduction with actual sandbox output. Verification (all -sim, this sandbox, 2026-07-05): - cargo build --bin trios_meshd --release: clean - cargo test --workspace --release: 137 passed, 0 failed - DURATION=10 ./smoke/m2_loopback_smoke.sh: all 3 nodes PASS, exit 0 Behaviour on real hardware unchanged (unique IPs collapse to unique SocketAddrs); this is a strict superset. Ref PR #48 (parent, introduces smoke). phi^2 + phi^-2 = 3
The v1 gate ("last neighbors line == 1.0x for both peers") was
non-deterministic under WMEWMA. Reviewer ran the smoke twice
back-to-back on same host, same binary (SHA 43ab3bf), only pkill
between runs:
run #1: node-11 { 13=2.03 } -> gate FAIL (coin-flip red)
run #2: node-11 { 12=1.00, 13=1.00 } -> gate PASS (coin-flip green)
Both are correct measurements. The gate itself was the problem:
WMEWMA with alpha=0.5, HELLO_MS=300, ETX_WINDOW=3 bounces ETX for
3-4 ticks after any single dropped HELLO on any real channel. The
v1 gate tested the algorithm's asymptote (steady 1.0x) instead of
the SocketAddr fix's actual invariant (both peers visible, ETX
finite). Category error.
v2 gate design:
- Grep last N=5 neighbors lines per node.
- Require both peers with a finite decimal ETX in every sample.
- Reject missing peers (pre-fix regression signal).
- Reject inf/nan (persistent link death).
- Accept transient spikes like 2.03 (correct WMEWMA response).
Sandbox verification:
- Positive: 5/5 runs PASS with new gate.
- Negative: synthetic pre-fix log (node-11 with empty neighbors)
correctly triggers FAIL for node-11.
Also added smoke/m2_loopback_smoke_n_runs.sh: convenience wrapper
that runs the smoke N times (default 5) and requires every run to
exit 0. Encodes the "results-without-repro-check" discipline: a
regression tripwire must be verified deterministic before trusted.
Reference: WMEWMA rationale (Woo, Tong & Culler, SenSys 2003;
Rosati et al., arXiv:1307.6350).
Ref PR #48 (parent), PR #49 (this branch).
phi^2 + phi^-2 = 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rebased onto main after squash-merge collapse of PR #48+#49 stack.
Context
PR #48 was squash-merged into main as
c95afbd. PR #49 was configured withfeat/w7-m2-fpga-pivot-2026-07-05as base and after PR #48 merge its base did NOT auto-rebase to main. Merging PR #49 (as67edde5) landed the fix into the now-orphanedfeat/w7-m2-fpga-pivot-2026-07-05branch, not into main. This PR re-lands the SocketAddr fix + gate v2 onto main directly.Content
Cherry-picked two commits onto main:
ea34192fix(meshd): key neighbor map on SocketAddr, not IpAddr — from43ab3bfd206577fix(smoke): gate v2 — finite-ETX visibility across N=5 samples — from293978aFix (SocketAddr) was 3× independently verified before merge (sandbox + macOS ×2). Gate v2 was contra-verified 5/5 on macOS.
Verify
Discipline
phi^2 + phi^-2 = 3