Cable verdict folded into one console cell (length green, fault name red, xover amber, fail; diag rule lines and counters-reset line gone), reset fires at the press not diag completion, and the measure's blip is suppressed at every counter source instead of counted-hidden-reverted: worker error adds, loss-window write-offs (quiet slides state without charging; leaving the quiet era presumes in-window holes delivered so the gap's tail is never charged late), NIC poller tracks raw without accumulating, socket drops discarded, modules un-primed by the measure itself; display hold deleted so pre-existing errors no longer blink out during a measure

This commit is contained in:
flamingcow
2026-08-17 11:25:31 -07:00
parent 3d7105073e
commit e3c3f945c5
10 changed files with 220 additions and 188 deletions
+42 -14
View File
@@ -14,7 +14,7 @@ func newWindow(sent uint64) *lossWindow {
func TestLossWindowContiguousLosesNothing(t *testing.T) {
w := newWindow(lossSlots + 1000)
for seq := uint64(0); seq < lossSlots+1000; seq++ {
w.observe(seq)
w.observe(seq, false)
}
if got := w.lost.Load(); got != 0 {
t.Errorf("lost = %d, want 0", got)
@@ -30,7 +30,7 @@ func TestLossWindowCountsGapOnceEvicted(t *testing.T) {
if seq == 100 {
continue
}
w.observe(seq)
w.observe(seq, false)
}
if got := w.lost.Load(); got != 1 {
t.Errorf("lost = %d, want 1", got)
@@ -42,13 +42,13 @@ func TestLossWindowCountsGapOnceEvicted(t *testing.T) {
func TestLossWindowOutOfOrderIsNotLoss(t *testing.T) {
w := newWindow(lossSlots + 1000)
for seq := uint64(99); ; seq-- {
w.observe(seq)
w.observe(seq, false)
if seq == 0 {
break
}
}
for seq := uint64(100); seq < lossSlots+1000; seq++ {
w.observe(seq)
w.observe(seq, false)
}
if got := w.lost.Load(); got != 0 {
t.Errorf("lost = %d, want 0", got)
@@ -59,8 +59,8 @@ func TestLossWindowOutOfOrderIsNotLoss(t *testing.T) {
// the window held plus the sequences that never landed in it at all.
func TestLossWindowJumpBeyondWindow(t *testing.T) {
w := newWindow(200001)
w.observe(0)
w.observe(200000)
w.observe(0, false)
w.observe(200000, false)
// Everything below the new base except the one sequence that was seen.
want := uint64(200000 - lossSlots + 1 - 1)
@@ -74,8 +74,8 @@ func TestLossWindowJumpBeyondWindow(t *testing.T) {
func TestLossWindowBelowBaseIsLate(t *testing.T) {
w := newWindow(100001)
w.observe(100000)
w.observe(1000)
w.observe(100000, false)
w.observe(1000, false)
if got := w.late.Load(); got != 1 {
t.Errorf("late = %d, want 1", got)
}
@@ -88,7 +88,7 @@ func TestLossWindowBelowBaseIsLate(t *testing.T) {
// another worker is still holding land inside rather than arriving late.
func TestLossWindowStartsHalfAWindowBack(t *testing.T) {
w := newWindow(100001)
w.observe(100000)
w.observe(100000, false)
if w.base != 100000-lossSlots/2 {
t.Errorf("base = %d, want %d", w.base, 100000-lossSlots/2)
}
@@ -103,11 +103,11 @@ func TestLossWindowRefusesUnsentSeq(t *testing.T) {
const first = 100000
w := newWindow(first + 2000)
for seq := uint64(first); seq < first+1000; seq++ {
w.observe(seq)
w.observe(seq, false)
}
base := w.base
if w.observe(1 << 62) {
if w.observe(1<<62, false) {
t.Error("a sequence number far past the sender's frontier was accepted")
}
if got := w.lost.Load(); got != 0 {
@@ -121,7 +121,7 @@ func TestLossWindowRefusesUnsentSeq(t *testing.T) {
// Still tracking the real traffic, rather than reporting every frame late
// against a base that ran away.
for seq := uint64(first + 1000); seq < first+2000; seq++ {
w.observe(seq)
w.observe(seq, false)
}
if got := w.late.Load(); got != 0 {
t.Errorf("late = %d, want 0", got)
@@ -131,14 +131,42 @@ func TestLossWindowRefusesUnsentSeq(t *testing.T) {
}
}
// A gap written off while quiet — a cable measure's own link blip — charges
// nothing, however the eviction timing falls: even the gap's tail still
// inside the window when the measure ends is presumed delivered. Counting
// resumes seamlessly and later real gaps are still caught.
func TestLossWindowQuietSlidesWithoutCharging(t *testing.T) {
w := newWindow(4 * lossSlots)
for seq := uint64(0); seq < 100; seq++ {
w.observe(seq, false)
}
// The blip: a huge jump arriving during the measure.
w.observe(2*lossSlots, true)
if got := w.lost.Load(); got != 0 {
t.Errorf("lost = %d after a quiet write-off, want 0", got)
}
// The measure ends immediately — the worst case, with the gap's tail
// still in-window — and a single real gap follows.
for seq := uint64(2*lossSlots + 1); seq < 4*lossSlots-100; seq++ {
if seq == 2*lossSlots+500 {
continue
}
w.observe(seq, false)
}
if got := w.lost.Load(); got != 1 {
t.Errorf("lost = %d, want exactly the one real post-measure gap", got)
}
}
// The sender's own frontier is the bound, so the sequence one past it is
// refused while the one below it is not.
func TestLossWindowBoundIsExclusive(t *testing.T) {
w := newWindow(500)
if !w.observe(499) {
if !w.observe(499, false) {
t.Error("the last sequence the sender put on the wire was refused")
}
if w.observe(500) {
if w.observe(500, false) {
t.Error("a sequence the sender had not reached was accepted")
}
}