Skip to content

Test that a burst of 250 due schedules fires within ceil(N/100) passes (#959) - #996

Merged
rmcdaniel merged 1 commit into
mainfrom
rust-959-schedule-burst
Nov 3, 2026
Merged

rmcdaniel merged 1 commit into
mainfrom
rust-959-schedule-burst

Conversation

@rmcdaniel

Copy link
Copy Markdown
Member

Review tier C: test only. It adds one crate-internal test module and changes no runtime code.

Fixes #959.

The schedules guide (durable-workflow.github.io#421) says native Server starts up to 100 due schedules per pass, ordered by next_fire_at. A burst of N therefore fires within ceil(N / 100) passes, in due order. That was derived from source and had no test.

Test

runtime::schedule_burst_tests is a new #[cfg(test)] module on SQLite. It is separate from schedule_execution's tests so it doesn't collide with #995. One pass is one fire_due_schedules call, as one maintenance tick makes.

  • Setup: 250 schedules on a yearly cron, so none can come due twice during the test. All are made due with distinct next_fire_at values, in the reverse of creation order, so ordering by id would give a different sequence.
  • Each pass fires exactly the next 100 schedules in next_fire_at order: 100, then 100, then 50. The burst needs exactly 3 passes, which is ceil(250/100).
  • No replay: a fourth pass fires nothing. Every schedule has fires_count = 1, there are 250 runs, and each schedule has exactly one ScheduleTriggered event, at its own stored occurrence.

The bound matches the guide, so no code or docs change is needed.

Counterfactuals, applied to fire_due_schedules locally: ordering the due batch by id, or batches of 50, each fail the test. The test passes in about 0.7 s on lab2 with 1.99.0 and -j2.

🤖 Generated with Claude Code

#959)

The schedules guide documents native Server's bound from source: up to
100 due schedules per pass, in next_fire_at order. Make 250 schedules
due together, in the reverse of creation order, and show each pass
fires exactly the next 100 in due order, the burst needs 3 passes, a
further pass fires nothing, and each schedule triggers once at its own
stored occurrence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Nov 3, 2026

Copy link
Copy Markdown

@rmcdaniel

Copy link
Copy Markdown
Member Author

Tier C receipt. Hosted checks are terminal at exact head 58fcbde1ce42b0f1eda2831fbc2b6109b97480e5 (tree c0b7978eb8d5ef4b1ede62e485157669b362145a): 57 passed, 1 skipped (the expected one), 0 failed. The change is test-only: rust/src/runtime/schedule_burst_tests.rs (new, #[cfg(test)]) plus its module declaration in rust/src/runtime/mod.rs.

@rmcdaniel
rmcdaniel marked this pull request as ready for review November 3, 2026 18:38
@rmcdaniel
rmcdaniel added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit 33bb291 Nov 3, 2026
58 checks passed
rmcdaniel added a commit that referenced this pull request Nov 3, 2026
Merge-only refresh onto main 33bb291 (#996), at Security's request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Native: test that a burst of more than 100 due schedules fires within ceil(N/100) passes

1 participant