Repository navigation
Keep alarm test times out of reach of setAlarm's past-time clamp - #82
Merged
Merged
Conversation
The alarm tests armed `Date.now() + 5` and then delivered that exact time. setAlarm() stores max(time, now), so on a runner that stalls for five milliseconds before the write lands the stored alarm is a different time, and the delivery is canceled (or, a millisecond later, runs through the "alarm already past" branch). CI hit both shapes: "ctx.abort honors retryAlarm: false" returned outcome "canceled" on the release PR, and "the handler is handed the scheduled time and the retry count" saw only one delivery on main. Arm a minute out instead. Freezing Date.now() five milliseconds past the old margin reproduces the CI assertion on the old times and passes on the new ones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The release PR #78 failed CI on a flaky runtime unit test. This fixes the test, not the runtime.
Cause. The alarm tests in
src/server/actor-container.test.tsarmedDate.now() + 5and then delivered that exact time.setAlarm()stores the later of the requested time and now. When a slow runner stalls for five milliseconds before the write lands, the stored alarm is a different time and the delivery is canceled. If another millisecond passes, the delivery instead runs through the "alarm already past" branch.CI hit this twice today:
ctx.abort honors retryAlarm: falsethe handler is handed the scheduled time and the retry countFix. Arm the ten affected tests a minute out. No runtime code changes, so no changeset.
Check. Freezing
Date.now()five milliseconds past the old margin reproduces the CI assertion on the old times and passes on the new ones. The file passes 75 of 75.🤖 Generated with Claude Code