Skip to content

Cover crash-window leak paths in lease/reservation stores#146

Merged
bpapillon merged 1 commit into
mainfrom
bpapillon/sch-6645-crash-window-leak-tests
Jul 3, 2026
Merged

Cover crash-window leak paths in lease/reservation stores#146
bpapillon merged 1 commit into
mainfrom
bpapillon/sch-6645-crash-window-leak-tests

Conversation

@bpapillon

Copy link
Copy Markdown
Contributor

SCH-6645

Tests only. Pins the bounded-leak contract for the two documented crash windows in the credit lease path:

  • Debit-then-add gap: a crash between leaseStore.tryReserve and reservationStore.add leaks at most the reserved amount, is invisible to the sweeper, is reclaimed at lease expiry (expiry guard + successor lease), and a retried check never double-refunds. Also drives the real checkWithLease with an add frozen mid-flight to pin the debit-before-record ordering.
  • Consume-then-refund gap: a crash between claiming a reservation and refunding the unspent slice loses at most that slice; the claim is durable, so a retried settle or sweep never re-claims or double-refunds, and the slice is reclaimed at lease expiry. Includes a Redis-specific crash-right-after-claim case where the sweeper reconciles the orphaned indexes without refunding.

Both the in-memory and Redis (fake-redis) backends are covered. The contract held everywhere; no production changes.

@bpapillon bpapillon marked this pull request as ready for review July 3, 2026 21:21
@bpapillon bpapillon requested a review from a team as a code owner July 3, 2026 21:21
@bpapillon bpapillon merged commit 6789ba2 into main Jul 3, 2026
5 checks passed
@bpapillon bpapillon deleted the bpapillon/sch-6645-crash-window-leak-tests branch July 3, 2026 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants