feat(effect): add stepOne() to ControlledScheduler for fine-grained task execution#6168
Open
copyleftdev wants to merge 2 commits intoEffect-TS:next-minorfrom
Open
feat(effect): add stepOne() to ControlledScheduler for fine-grained task execution#6168copyleftdev wants to merge 2 commits intoEffect-TS:next-minorfrom
copyleftdev wants to merge 2 commits intoEffect-TS:next-minorfrom
Conversation
…ask execution ControlledScheduler.step() drains ALL pending tasks across all priority buckets in a single call. There is no way to execute exactly one task and observe the state between executions. This makes it impossible to reproduce concurrency bugs like Effect-TS#6081 (semaphore race condition) or Effect-TS#6014 (workflow deadlock during replay) in a controlled environment — you can't step through individual task interleavings to find the ordering that triggers the bug. Add stepOne() which executes exactly one task from the highest-priority bucket and returns. This is the primitive needed for deterministic simulation testing where each scheduling decision must be individually controllable. - step() behavior unchanged (drains all) - stepOne() executes one, returns boolean - 15 lines of code, additive only Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 2854878 The changes in this PR will be included in the next version bump. This PR includes changesets to release 36 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Co-Authored-By: Claude Opus 4.6 (1M context) <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.
Problem
ControlledScheduler.step()drains all pending tasks across all priority buckets in a single call:There is no way to execute exactly one task and observe the intermediate state. This makes it impossible to reproduce concurrency bugs in a controlled environment — you can't step through individual task interleavings to find the specific ordering that triggers the issue.
Relevant bugs that are hard to reproduce without fine-grained stepping:
concurrency > 1Fix
Add
stepOne()toControlledScheduler:trueif a task was executed,falseif emptystep()behavior unchangedTest plan
Schedule.test.ts— 82 tests passEffect/scheduling.test.ts— 2 tests passFiber.test.ts— 16 tests pass🤖 Generated with Claude Code