lease: write-gate renewal at half-TTL — stop the every-tick intent-log append
renew() re-wrote the __lease__ record on EVERY sign-loop tick (~2s) against a 15s
TTL — 7× more often than failover needs. Because the value carries ts:now it can
never dedup, so each tick appended a fresh op to the append-only intent log
forever: the ~25KB/s-at-rest leak we traced (unbounded, ×N hosted DIDs).
Fix: only re-write once the lease is past HALF its TTL. That keeps `now - ts`
under ~ttlMs/2 + one tick (≈9.5s ≪ 15s), so a standby never claims while the
holder is alive (no split-brain), and failover still fires within ~1.5×TTL. renew()
still returns true (we hold the lease) when it skips the write. Verified: fresh
renews are no-ops, a stale renew writes once, holds() stays true, a standby cannot
steal a live gated lease, and it DOES claim after a real TTL lapse. Full suite
green (30/30, 133/133) incl. lease-handoff + failover.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
3706610374831a97d212df64d0b7002ffac409df
by plankatron <fleeky@gmail.com> · 2026-07-17T23:18:07.000Z