@@ -377,29 +377,68 @@ row.
377377
378378## 9. Testing strategy
379379
380+ ** Tests-first / RED discipline (mandatory,
381+ ` feature_implementation.md ` §2).** Every numbered phase opens with the
382+ failing test(s) that pin the behaviour, run BEFORE the implementation,
383+ and ** verified to fail for the predicted reason** — not merely to fail.
384+ The predicted pre-implementation failure mode is stated per case below so
385+ the RED step is auditable (mirroring Track B, where 4 of 6 cases were red
386+ pre-impl for their predicted reasons). The two companion cases that pass
387+ pre-impl (a getsockopt-parity read, an unset-default read) are noted as
388+ such; a case that passes before the code exists is not pinning that
389+ code and must be re-examined. Each test file passes the §7.2
390+ docstring-audit; docstrings open ` Ensure … ` and carry the trailing
391+ ` Reference: ` line (RFC 9293 §3.8.6 for the window envelope, plus a
392+ ` PyTCP test infrastructure (no RFC clause). ` fallback where the behaviour
393+ is a Linux-default with no RFC clause). Layer per
394+ ` feature_implementation.md ` §2.1: R1's estimator EWMA is a candidate for
395+ an added unit test on the pure update function; everything else is
396+ integration (FSM + wire-level).
397+
380398Integration (` TcpTestCase ` ), mirroring ` test__tcp__session__so_rcvbuf.py `
381399/ ` test__tcp__session__so_sndbuf.py ` :
382400
383401- ** Track R:**
384402 - Receiver RTT estimator (R1): drive inbound data segments carrying
385403 TSecr echoing our TSval; assert ` _rcv_rtt.rtt_ms ` converges (EWMA) —
386404 pure state test, no wall clock (` FakeTimer ` + injected ` now_ms ` ).
405+ * RED:* pre-impl ` _rcv_rtt ` does not exist / ` rtt_ms ` stays ` None `
406+ (` AttributeError ` or unchanged-` None ` assert).
387407 - DRS grow (R4): establish with timestamps, feed a full BDP of data +
388408 app drains, advance one receiver-RTT, assert ` rcv_wnd_max ` grew per
389409 the formula and the advertised window (` _rcv_wnd >> rcv_wsc ` ) widened.
390- - Clamp: assert the grow saturates at ` tcp.rmem.max ` .
410+ * RED:* pre-impl ` rcv_wnd_max ` stays at the 65535 seed (no grow policy
411+ wired) — the assert on the grown value fails.
412+ - Clamp: assert the grow saturates at ` tcp.rmem.max ` . * RED:* pre-impl
413+ no grow at all, so the saturation value is never reached.
391414 - Lock: set ` SO_RCVBUF ` explicitly, replay the same load, assert
392- ` rcv_wnd_max ` does ** not** move (DRS disabled).
415+ ` rcv_wnd_max ` does ** not** move (DRS disabled). * Passes pre-impl*
416+ (nothing grows it yet) — a regression guard that only bites once R4
417+ lands, so it MUST be paired with the grow test in the same commit or
418+ it pins nothing.
393419 - Cadence: two adjusts within one RTT collapse to one measurement.
420+ * RED:* pre-impl there is no adjust to collapse — assert the single
421+ measurement fails once R3 exists but over-fires.
394422- ** Track S:**
395423 - Expand (S2): drive ACKs that grow cwnd, assert ` _effective_sndbuf() `
396424 rises to ` 2*cwnd*snd_mss ` (with the small-default switch active) and
397- saturates at ` tcp.wmem.max ` .
425+ saturates at ` tcp.wmem.max ` . * RED:* pre-impl ` _effective_sndbuf() `
426+ returns the static default regardless of cwnd — the assert on the
427+ grown bound fails.
398428 - A blocked ` _charge_tx_buffer ` writer is admitted after an ACK both
399429 drains * and* expands the bound (compose with the Tier-1 wake test).
430+ * RED:* pre-impl the writer is admitted only by the drain, not the
431+ expand — assert it is admitted by the expand alone (buffer not yet
432+ drained) fails.
400433 - Lock: explicit ` SO_SNDBUF ` freezes the bound across cwnd growth.
401- - ** Sysctl:** ` tcp.moderate_rcvbuf=0 ` disables DRS entirely; the
402- ` min<=default<=max ` finalize validator rejects a bad triple.
434+ * Passes pre-impl* — regression guard, pair with the expand test.
435+ - ** Sysctl:** ` tcp.moderate_rcvbuf=0 ` disables DRS entirely (* RED* once
436+ R4 exists: the grow that fires with the knob on must not fire with it
437+ off); the ` min<=default<=max ` finalize validator rejects a bad triple
438+ (* RED* pre-impl: no validator registered, the bad triple is accepted).
439+
440+ Every phase's RED run is captured in the commit body ("N red pre-impl for
441+ <reason >, M companion guards green"), matching the Track B commit.
403442
404443Adherence: refresh ` docs/rfc/tcp/rfc9293__tcp/adherence.md ` §3.8.6
405444(managing the window) and §3.10.2 (SEND) with the auto-tuning behaviour;
0 commit comments