carlos / platform Public

lease: the one-budget witness runs a 2 s budget and 500 ms attempts beside its 1 s read, and asserts that no resend reached the store

The resend now falls at 2.5 s, half a second after the budget, and the read
has a second of headroom; the request count does not depend on load.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 2de3acd779cbb9ab852b260d15c07da8989e272b parent 3c6eb6a
1 file changed, +11 −5
  • internal/lease/cleaning_test.go +11 −5

CI failed — run details

CI log
=== gate ===
sigwho: pid 2 ppid 1 pgid 0 sid 0; child pid 3
.amadan/test-gate.sh
gate: 2026-10-24T15:51:25Z on aarch64, 32 cpus, 62144 MB available, go1.26.8 linux/arm64
gate: +0s start launchctx
gate: +0s start vet
gate: +0s start gofmt
gate: +2s start rest
gate: +25s start internal_console@0
gate: +25s start internal_console@1
gate: +25s start internal_console@2
gate: +25s start internal_console@3
gate: +25s start internal_console@4
gate: +25s start internal_console@5
gate: +25s start internal_console@6
gate: +25s start internal_console@7
gate: +25s waiting for internal_console's shards before the next split package
gate: +196s start root@0
gate: +196s start root@1
gate: +196s start root@2
gate: +196s waiting for root's shards before the next split package

amadan: step gate failed: signal: terminated

amadan: job failed at step gate — its output is above, not at the tail of this log
diff --git a/internal/lease/cleaning_test.go b/internal/lease/cleaning_test.go
index a9c12190e..05beb8c83 100644
--- a/internal/lease/cleaning_test.go
+++ b/internal/lease/cleaning_test.go
@@ -1301,12 +1301,12 @@ func TestLockOperationsHaveOneBudget(t *testing.T) {
}
})
t.Run("one budget for the read and the write", func(t *testing.T) {
- // The read takes 1 s of a 1.5 s budget; the mark's first attempt is
- // held and times out at 1.2 s, and its resend would go at 2.2 s,
+ // The read takes 1 s of a 2 s budget; the mark's first attempt is
+ // held and times out at 1.5 s, and its resend would go at 2.5 s,
// after the operation's budget. A budget per write (from 1 s to
- // 2.5 s) would let that resend land.
- t.Cleanup(lease.SetLockOperationBudgetForTest(1500 * time.Millisecond))
- t.Cleanup(lease.SetLockAttemptTimeoutForTest(attempt))
+ // 3 s) would let that resend reach the store and land.
+ t.Cleanup(lease.SetLockOperationBudgetForTest(2 * time.Second))
+ t.Cleanup(lease.SetLockAttemptTimeoutForTest(500 * time.Millisecond))
var h *leasetest.Holder
var armed atomic.Bool
s := tombFixtureWrap(t, func(next http.Handler) http.Handler {
@@ -1319,10 +1319,16 @@ func TestLockOperationsHaveOneBudget(t *testing.T) {
})
})
liftedAt(t, s, 4)
+ before := len(h.Requests(tombLockKy)) // the lift
armed.Store(true)
hold(t, h, 1)
if err := lease.MarkCleaning(ctx, "data", tombLoc, tombRegion, owners); !errors.Is(err, lease.ErrLockWriteUncertain) {
t.Fatalf("MarkCleaning = %v, want ErrLockWriteUncertain at the operation's budget", err)
}
+ // Whatever the load: the held first attempt is the mark's only
+ // request; no resend reached the store.
+ if n := len(h.Requests(tombLockKy)) - before; n != 1 {
+ t.Fatalf("%d mark requests reached the store, want 1", n)
+ }
})
}