test(m2-prep): 25 host-only pure-logic tests (TUN alloc + wire boundaries + ETX arithmetic) - #32
Merged
Merged
Conversation
…-sim) Adds tests/m2_routing_pure_logic.rs covering the pre-image-bake surface we can still exercise on the dev host: - mesh_ip / node_of over 10.42.0.0/24: full 1..=254 roundtrip, network/ broadcast/wrong-subnet rejection, out-of-range wrap behaviour pin. - Wire header: FrameKind roundtrip for all valid kinds, rejection of every unknown kind byte, per-offset truncation rejection, TTL extremes, Header::LEN=11 pin. - HELLO wire: 33-byte empty floor, linear length scaling, n=255 roundtrip, silent truncation of oversized heard[], per-byte MAC-region truncation rejection, forged length-prefix rejection, reports_hearing semantics. - ETX arithmetic: deterministic best_next_hop under ties, compute_path_etx overflow saturation to +inf, NaN/inf advertised rejection, force_dead idempotence on unknown neighbors, neighbors() sort contract. - Cross-module: HELLO body strictly longer than Header::LEN. Findings pinned as -sim observations, not spec claims: - is_feasible currently accepts +inf as first metric (asymmetric with the strictly-better check for subsequent routes). Behaviour change deferred to a post-image-bake PR. - Hello::to_bytes silently truncates at u8::MAX heard entries. Pinned as intentional; error-returning API is a future revision. Context: - M1 scientifically closed on Zynq platform (smoke/M1_SCIENTIFIC_CLOSURE_ 2026-07-04.md). - M2 real network blocked on image-bake (docs/IMAGE_BAKE_MILESTONE.md): ramfs rootfs + identical MACs + GEM offload breaks under spoof. Results (local, 2026-07-04): - cargo test --test m2_routing_pure_logic: 25 passed, 0 failed. - cargo test --lib: 99 passed, 0 failed. Anchor: phi^2 + phi^-2 = 3
CI on PR #32 failed only on rustfmt use-ordering (std before crate, alphabetical within group). Logic and test coverage unchanged. Local re-run: - cargo fmt --all --check: clean - cargo test --test m2_routing_pure_logic: 25 passed, 0 failed - cargo test --lib: 99 passed, 0 failed Anchor: 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.
What
25 new host-only tests in
tests/m2_routing_pure_logic.rs+docs/M2_PREP_PURE_LOGIC.md. No network I/O, no radios, no/dev/net/tun, nodaemon.rschanges. Every claim is-sim.Why now
M1 is scientifically closed on the Zynq Mini platform (see
smoke/M1_SCIENTIFIC_CLOSURE_2026-07-04.md). M2 real-network stand-up is blocked on the image-bake milestone (seedocs/IMAGE_BAKE_MILESTONE.md) because:ramfsand wipes/etc/network/interfaceson cold-boot00:0a:35:00:01:22(Xilinx OUI, identical)Until baked images exist, a 3-board mesh cannot run. But the pure-logic surface can still be tightened without any hardware — that is this PR.
Coverage
mesh_ip/node_of,10.42.0.0/24) — full 1..=254 roundtrip, network/broadcast/wrong-subnet rejection, out-of-range wrap pinFrameKindroundtrips, every unknown kind byte rejected, per-offset truncation rejection, TTL extremes,Header::LEN=11pinn=255roundtrip, silent oversize truncation, per-byte MAC-region truncation rejection, forged length-prefix rejection,reports_hearingsemanticscompute_path_etxoverflow saturation to+inf, NaN/inf advertised rejection,force_deadidempotence on unknowns,neighbors()sort contractHeader::LENFindings pinned as observations (not spec)
is_feasibleaccepts+infas first metric (asymmetric with strictly-better rule on subsequent routes). Behaviour-change PR deferred until image-bake done.Hello::to_bytessilently truncatesheard[]at u8::MAX. Intentional today; API revision is a future PR.Local results (2026-07-04)
cargo test --test m2_routing_pure_logic— 25 passed, 0 failedcargo test --lib— 99 passed, 0 failedNot in scope
daemon.rs, no UDP, no TUN, no radios)Related
docs/IMAGE_BAKE_MILESTONE.md— the hard prerequisite before real M2Anchor: phi^2 + phi^-2 = 3