Issue files (.scratch/issues/20-29): retrospective specs for all work done in the current sprint — hardening, route-timeout, start-layer protocol, heartbeat stats, availability map, rolling RPM, smart assignment, throughput routing, routing tests, relay outbound client. ADRs (docs/adr/0011-0014): 0011 — Auto-shard from memory budget and tracker network assignment 0012 — X-Meshnet-Start-Layer overlapping shard execution protocol 0013 — Rolling RPM statistics, smart assignment scoring, throughput routing 0014 — Relay outbound client for NAT/internet pipeline hops prd.json: US-020 through US-029 added, all marked done. ralph_progress.py now shows 29/29 complete (100%). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1.1 KiB
1.1 KiB
US-028 — Routing correctness tests: three-node, overlap, and throughput scenarios
Status: done Priority: Medium Stage: Implemented
Context
Route selection logic (_select_route) is the core of the inference network. Without
locked-down tests, routing regressions are silent. This story adds a comprehensive
scenario suite that locks in the routing contract.
Test scenarios
- No-overlap three nodes: greedy picks in layer-start order (A→C→B for ranges 0–7, 8–15, 16–23) Note: the algorithm picks by earliest uncovered layer, not by node label — so if C.shard_start < B.shard_start, C comes first.
- Overlapping shards: correct resolution without double-computing layers
- Throughput tiebreak: faster node wins when shard_end is equal
- Gap detection: partial coverage returns a 503 error with description
Acceptance criteria
- 7 routing tests covering the above scenarios
- Tests use in-process tracker (no mocking)
_make_nodehelper for concise test setup- All tests pass;
python -m pytestpasses