Skip to content

test(core): random interleavings of lease requests are checked against the queue's invariants - #1945

Merged
V3RON merged 6 commits into
mainfrom
chore/queue-model-test
Nov 29, 2026
Merged

V3RON merged 6 commits into
mainfrom
chore/queue-model-test

Conversation

@V3RON

@V3RON V3RON commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Why

Eight past race bugs were catchable without hardware; real use found them (testing-strategy, proposals 7 and 11).

What

  • lease-model.test.ts: random request, cancel, release, clock, driver and write failure, stop, kill and start on one real leasing engine (iOS and Android) over the fake driver and clock. Invariants: no device leased twice, no request lost, every waiter answered, cancels hold, counts add up, and at a quiet point a queue wake moves nothing.
  • test-support/model.ts: seeded runner; a failure prints seed, shortest sequence, state per step. CI adds one printed fresh seed; SIMLOCK_MODEL_SEED reruns one.
  • Dropped: the fake-driver command-sequence test found none of the bugs.

Proof

Each fix undone locally, then seeds 1-4, 100 sequences each:

bug / mutation          fix commit  put back  lease model
#647                    9a383bc30   yes       found, 14 seq, 0.2 s
#657                    none        no        -
#665                    9b0193d3e   yes       found, 182 seq, 0.9 s
#1000                   252240275   yes       not found
#1001                   7e876e12f   yes       not found
#1233                   8b0272832*  yes       found, 55 seq, 0.6 s
#1479                   759990ba5   leasing   found, 16 seq, 0.3 s
#1492                   c0a70cd5e   yes       not found
no wake after cancel    -           -         found, 41 seq
no wake after grant     -           -         found, 246 seq
only kick() wakes       -           -         found, 246 seq

* #1233 closed unreproduced; #1210's regrant guard undone. #1000, #1001 and #1492 are outside the model.

main: 400 pass, plus 12,400 on 120 other seeds, twice. Unit lane +1.8 s.

Four bugs it allows on main are under the leasing manual's Known gaps, each with its seed.

Not verified: Windows CI.

Review

Spec review: skipped. Code review: 2 blocking, 2 fixed, 1 notes. Claims review: 0 blocking, 0 fixed, 0 notes.
Rounds: 2. Tokens: 3.6M.
Assessment: complete

Written by an agent.

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 8 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: QUIET
  • Plan: Advanced
  • Run ID: f99829ea-6ac0-4260-bc72-f24395561d93
Commits

Reviewing files that changed from the base of the PR and between 3e2b72a and 4b94202.

Files selected for processing: 6

  • src/leasing/AGENTS.md
  • src/leasing/lease-model.test.ts
  • src/leasing/test-create-leasing.ts
  • src/leasing/test-lease-model.ts
  • src/test-support/model.test.ts
  • src/test-support/model.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@V3RON
V3RON marked this pull request as ready for review November 29, 2026 16:26
@V3RON
V3RON merged commit 9bd47c1 into main Nov 29, 2026
37 checks passed
@V3RON
V3RON deleted the chore/queue-model-test branch November 29, 2026 16:50
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.

1 participant