test(storage): retain slow samples while permitting declared plateau commits

This commit is contained in:
pingqiu committed 2026-11-20 14:34:16 -08:00
1 parent e29829bbac
commit ed867d0c4e
2 files changed
+12 -3

No files matched your search

@@ -243,8 +243,9 @@ func precopyBusyOwnerKeepsServing(t *testing.T, delay time.Duration) {
resumedCount := 1
if err != nil {
// Releasing the owner does not erase a slow sample. Admission must
// still refuse a measured final cut above its unchanged 1.2s allowance.
if !errors.Is(err, storage.ErrPrecopyNotConverged) || r.Precopy.Frozen || r.Precopy.Estimate <= 1200*time.Millisecond || (r.Precopy.Reason != "tail_too_large" && r.Precopy.Reason != "barrier_over_budget") {
// still refuse a tail-bound point; a small stalled tail can now declare
// the retained fixed-cost exception instead of recopying indefinitely.
if !errors.Is(err, storage.ErrPrecopyNotConverged) || r.Precopy.Frozen || r.Precopy.Estimate <= 1200*time.Millisecond || (r.Precopy.Reason != "tail_too_large" && r.Precopy.Reason != "barrier_over_budget" && r.Precopy.Reason != "fixed_cost_exceeds_freeze_budget") {
t.Fatalf("post-release retry violated measured admission: report=%+v err=%v", r.Precopy, err)
}
if delay > 0 && r.Precopy.Fixed < delay {
@@ -259,7 +260,9 @@ func precopyBusyOwnerKeepsServing(t *testing.T, delay time.Duration) {
t.Fatalf("over-budget retry failed to resume service: n=%d err=%v", n, e)
}
} else if delay > 0 {
t.Fatal("retry froze despite a retained fixed sample above the allowance")
if !r.Precopy.Frozen || r.Precopy.Reason != "fixed_cost_over_allowance" || r.Precopy.Fixed < delay || r.Precopy.TailEstimate > 300*time.Millisecond || r.Precopy.PreviousEstimate <= 0 || r.Precopy.Estimate < r.Precopy.PreviousEstimate || r.Precopy.Estimate > 5*time.Second || r.Precopy.DeclaredFreeze != r.Precopy.Estimate {
t.Fatalf("slow retry bypassed the declared small-tail plateau rule: %+v", r.Precopy)
}
}
if started, resumed := k.calls(); len(started) != 2 || len(resumed) != resumedCount {
t.Fatalf("retry hooks: started=%v resumed=%v", started, resumed)
+6
View File
@@ -334,3 +334,9 @@ one missing-probe/newer-ACK schedule. `R293_review_safe` checks four invariants;
four negative controls separately remove retirement, the frame join, the
readiness guard or ACK progress restoration. This abstracts successful admitted
frames and does not prove physical-I/O, authority rollback or timing behavior.
`PrecopyFixedAdmission.tla` checks bounded pre-copy cost admission: ordinary
allowance, small non-improving tail, declared freeze and the five-second ceiling.
`PrecopyFixedAdmission.cfg` is the positive configuration; `_no_tail`, `_no_stall`
and `_no_cap` must violate `SafeCommit`. It does not model publication/data safety
or physical latency; those remain separate checks.