Skip to content

Sim: exercise unreliable delivery + reliability recovery over multi-hop - #169

Merged
M0LTE merged 1 commit into
masterfrom
meshcore-sim-loss
Jul 1, 2026
Merged

Sim: exercise unreliable delivery + reliability recovery over multi-hop#169
M0LTE merged 1 commit into
masterfrom
meshcore-sim-loss

Conversation

@M0LTE

@M0LTE M0LTE commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

What

Closes a real gap flagged in review of the sim fabric: it had a per-edge loss knob but every test ran at 0% loss, so the reliability layer — the whole reason MeshCore needs one — was never exercised in the sim. This adds a lossy multi-hop reliability-recovery scenario.

How

  • MeshDappsNode now takes an accelerated MeshCoreReliability.Options + resend-poll interval, so a loss-recovery test runs in CI-time (~3–6 s) instead of on the 20 s production backoff. It also sets CongestionBackoffFraction = 0: propagation is instantaneous in the sim so the occupancy estimate is an artifact, and under heavy loss the extra resend traffic would inflate it and throttle recovery. (That's a genuine production interaction — under heavy multi-hop loss, congestion backoff does slow reliability recovery — but it's a confound for isolating reliability here.)
  • MeshFabric gains a Dropped counter so the test asserts loss was genuinely exercised, rather than relying on a flaky probabilistic control.

Test

LossyMultiHop_ReliabilityRecoversEveryMessage_ExactlyOnce — A ── R1 ── R2 ── R3 ── B over four hops at 30% and 40% per-edge loss:

  • every message is recovered (reliability resends),
  • each delivered exactly once (idempotent — a lost ACK makes the sender resend, so B dedups the duplicate),
  • Dropped > 0 (loss was real).

Ran 5× with no flakiness; recovers in ~3–6 s.

🤖 Generated with Claude Code

The fabric had a per-edge loss knob but every committed test ran at 0% loss, so
the reliability layer (the whole reason it exists) was never exercised over the
sim - a real gap. Close it.

- MeshDappsNode takes an accelerated MeshCoreReliability.Options + resend poll, so
  a loss-recovery scenario runs in CI-time instead of on the 20 s production backoff.
  It also disables congestion-backoff: propagation is instantaneous in the sim, so
  the occupancy estimate is an artifact, and under heavy loss the extra resend
  traffic would otherwise inflate it and throttle recovery (a genuine production
  interaction, but a confound here).
- MeshFabric gains a Dropped counter so a test can assert loss was genuinely
  exercised rather than lean on a flaky probabilistic control.
- New test LossyMultiHop_ReliabilityRecoversEveryMessage_ExactlyOnce (0.3 and 0.4
  per-hop loss over four hops): asserts every message is recovered, each delivered
  exactly once (idempotent under resend-after-lost-ACK), and Dropped > 0. Ran 5x
  with no flakiness; recovers in ~3-6 s.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KLbwvhE2cKCe8WPZNg8k17
@M0LTE
M0LTE merged commit ca605c9 into master Jul 1, 2026
4 checks passed
@M0LTE
M0LTE deleted the meshcore-sim-loss branch July 1, 2026 13:41
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