a73x

143e2b46

test: burst scenario tolerates one in-flight confirmation at detach

a73x   2026-08-09 15:14

Commit message
test: burst scenario tolerates one in-flight confirmation at detach

confirmed is a liveness counter, not a correctness one: the fifth
confirmation can still be in flight when the detach byte lands. Observed
1 run in 3 under load at 715f71b, and decisions.md records the same
counter one short on the M9 WAN burst (made=55 confirmed=54).

contradicted and expired stay EXACT — those are the correctness claims,
and no amount of timing makes a wrong or aged-out prediction acceptable.

test/e2e.sh
Old New
@@ -82,6 +82,23 @@ want_stat() {
82 } 82 }
83 } 83 }
84 84
85 # The same, as a floor. Its own helper rather than a mode on want_stat:
86 # exact equality is the right assertion for every correctness counter, and
87 # a shared one would make it easy to weaken those by habit. Only counters
88 # that are genuinely timing-dependent belong here.
89 want_stat_ge() {
90 _got=$(predict_stat "$1" "$2")
91 [ -n "$_got" ] || {
92 echo "e2e FAIL: $4: no predict stats line (wanted $2>=$3); got:"
93 cat "$1"; exit 1;
94 }
95 [ "$_got" -ge "$3" ] || {
96 echo "e2e FAIL: $4: $2=$_got, want >=$3"
97 grep "^predict " "$1" || true
98 exit 1;
99 }
100 }
101
85 # Wait until PATTERN shows up in FILE (default 15s). Timing that keys off the 102 # Wait until PATTERN shows up in FILE (default 15s). Timing that keys off the
86 # session's own output instead of a fixed sleep: the marker is proof the 103 # session's own output instead of a fixed sleep: the marker is proof the
87 # client is attached and idle, which is exactly the state the tear needs. 104 # client is attached and idle, which is exactly the state the tear needs.
@@ -1104,7 +1121,17 @@ set -e
1104 # one read (which would be suppressed as a multi-byte chunk, not predicted) 1121 # one read (which would be suppressed as a multi-byte chunk, not predicted)
1105 # fails loudly instead of quietly weakening the test. 1122 # fails loudly instead of quietly weakening the test.
1106 want_stat "$OUT.pb" made 5 "burst" 1123 want_stat "$OUT.pb" made 5 "burst"
1107 want_stat "$OUT.pb" confirmed 5 "burst" 1124 # `confirmed` is a LIVENESS counter and the only timing-dependent one here:
1125 # the fifth confirmation can still be in flight when the detach byte lands,
1126 # which is why it is a floor rather than an equality. Observed 1 run in 3
1127 # under load (review runs at 715f71b, 2026-08-09), and decisions.md records
1128 # the same counter coming up one short on the M9 WAN burst (made=55
1129 # confirmed=54 abandoned=1, the mode-transition churn flush).
1130 #
1131 # `contradicted` and `expired` stay EXACT. They are the correctness claims —
1132 # a prediction judged wrong, or one that aged out unjudged, is a defect
1133 # whenever it happens, and nothing about timing makes either acceptable.
1134 want_stat_ge "$OUT.pb" confirmed 4 "burst"
1108 want_stat "$OUT.pb" contradicted 0 "burst" 1135 want_stat "$OUT.pb" contradicted 0 "burst"
1109 want_stat "$OUT.pb" expired 0 "burst" 1136 want_stat "$OUT.pb" expired 0 "burst"
1110 "$MUXD" dump --sock "$SOCK5" | grep -q "burst" || { 1137 "$MUXD" dump --sock "$SOCK5" | grep -q "burst" || {