package provision import ( "errors" "testing" "time" ) // H10 (moves Plan 3 Task 6): the admission records the probe attempts its // T11 pricing admitted, and an absent count is the landing's recorded // refusal of the probe. func TestMoveAdmitRecordsTheProbeAttempts(t *testing.T) { g := cutTestGuard() now := time.Date(2026, 10, 9, 9, 0, 0, 0, time.UTC) cutting := func() *Record { return &Record{Region: "ie", Move: &MoveState{ID: g.ID, Incarnation: g.Incarnation, From: "ie", To: "uk", State: MoveCutting, CutPhase: CutRequested, Inputs: &MoveInputs{Release: "v1"}}} } rec := cutting() if err := MoveAdmit(g, now, 120, now.Add(time.Minute), 2)(rec); err != nil || rec.Move.CutAttempts != 2 { t.Fatalf("admit: %v %+v", err, rec.Move) } rec = cutting() if err := MoveAdmit(g, now, 120, now.Add(time.Minute), -1)(rec); !errors.Is(err, ErrMoveConflict) || rec.Move.CutPhase != CutRequested || rec.Move.CutAttempts != 0 { t.Fatalf("a negative count: %v %+v", err, rec.Move) } landing := &Record{Region: "uk", Move: &MoveState{ID: g.ID, Incarnation: g.Incarnation, From: "ie", To: "uk", State: MoveLanding, LandingPhase: LandProbing}} if err := MoveMarkRollback(g, RollbackProbeUnpriced)(landing); err != nil || landing.Move.Reason != RollbackProbeUnpriced { t.Fatalf("the unpriced probe's mark: %v %+v", err, landing.Move) } }