Skip to content

test(m2-prep): 25 host-only pure-logic tests (TUN alloc + wire boundaries + ETX arithmetic) - #32

Merged
gHashTag merged 2 commits into
mainfrom
feat/m2-prep-pure-logic
Jul 4, 2026
Merged

gHashTag merged 2 commits into
mainfrom
feat/m2-prep-pure-logic

Conversation

@gHashTag

@gHashTag gHashTag commented Jul 4, 2026

Copy link
Copy Markdown
Owner

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, no daemon.rs changes. 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 (see docs/IMAGE_BAKE_MILESTONE.md) because:

  • stock rootfs is ramfs and wipes /etc/network/interfaces on cold-boot
  • all three boards ship with MAC 00:0a:35:00:01:22 (Xilinx OUI, identical)
  • 5/5 runtime workaround paths were falsified in field on 2026-07-04

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

  • TUN allocation math (mesh_ip / node_of, 10.42.0.0/24) — full 1..=254 roundtrip, network/broadcast/wrong-subnet rejection, out-of-range wrap pin
  • Wire header boundaries — all FrameKind roundtrips, every unknown kind byte rejected, per-offset truncation rejection, TTL extremes, Header::LEN=11 pin
  • HELLO wire boundaries — 33-byte empty floor, linear length scaling, n=255 roundtrip, silent oversize truncation, per-byte MAC-region truncation rejection, forged length-prefix rejection, reports_hearing semantics
  • ETX ordering / arithmetic — deterministic pick under ties, compute_path_etx overflow saturation to +inf, NaN/inf advertised rejection, force_dead idempotence on unknowns, neighbors() sort contract
  • Cross-module invariant — HELLO body strictly longer than Header::LEN

Findings pinned as observations (not spec)

  1. is_feasible accepts +inf as first metric (asymmetric with strictly-better rule on subsequent routes). Behaviour-change PR deferred until image-bake done.
  2. Hello::to_bytes silently truncates heard[] 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 failed
  • cargo test --lib — 99 passed, 0 failed

Not in scope

  • No M1 continuation (board-1 datapoint from 2026-07-04 stands; boards 2/3 are byte-identical replicas)
  • No M2 real-network changes (no daemon.rs, no UDP, no TUN, no radios)
  • No routing behaviour changes (pinning current behaviour only)
  • No Trinity / silicon claims

Related

Anchor: phi^2 + phi^-2 = 3

…-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
@gHashTag gHashTag added mesh TRI-NET mesh track documentation Docs labels Jul 4, 2026
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
@gHashTag
gHashTag marked this pull request as ready for review July 4, 2026 10:13
@gHashTag
gHashTag merged commit dcdbd1b into main Jul 4, 2026
2 checks passed
@gHashTag
gHashTag deleted the feat/m2-prep-pure-logic branch July 4, 2026 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Docs mesh TRI-NET mesh track

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant