fix(package): Reject PlayMode test runs while the Editor is paused#1687
Merged
Conversation
Add an isPaused preflight check to TestExecutionStateValidationService so that PlayMode test requests are rejected immediately when Play Mode is paused, instead of reaching plain awaits whose continuations would hang forever in the UnitySynchronizationContext queue (see #1686). The remaining plain awaits in RunTestsUseCase are documented with a why-comment: the only path where they could still hang is a pause point firing mid-test, which stalls the Test Runner itself and is out of scope for the tool layer.
StopPlayMode() clears isPaused before setting isPlaying=false, so the poll loop's TimerDelay continuation always finds the SynchronizationContext queue draining normally. Measured: compile during pause self-resolved in ~5s with no hang.
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe PR adds paused-state validation for PlayMode test execution, extends unit-test stubs and coverage, and documents synchronization-context considerations around compile and test execution awaits. ChangesPaused PlayMode validation
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant TestValidation
participant ValidationService
participant UnityEditor
TestValidation->>ValidationService: Validate PlayMode request
ValidationService->>UnityEditor: Read isPaused
UnityEditor-->>ValidationService: Paused state
ValidationService-->>TestValidation: Failure or success result
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
This was referenced Jul 11, 2026
Merged
5 tasks
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.
Summary
UnitySynchronizationContext continuations that are never drained during pause
WaitForPlayModeExitAsyncis immune to this class of hangCloses #1686
Measurement data (Phase A)
compileduring pauseStopPlayModeclearsisPausedfirst)run-tests --test-mode EditModeduring pauserun-tests --test-mode PlayModeduring pauseChanges
TestExecutionStateValidationService: AddIsPausedvirtual property and PlayMode+paused guardRunTestsUseCase: Add why-comment on plain awaits (mid-test pause point hit is out of scope)CompileUseCase: Add why-comment onWaitForPlayModeExitAsyncdocumenting self-resolutionTest plan
uloop compile0 errors / 0 warnings