Repository navigation
chore: Move editor readiness policy into Domain - #1577
Conversation
Extract the pure editor-state readiness decision from the application guard so C5-2 can keep Unity state reads in Application while moving the business policy into Domain.
|
Warning Review limit reached
Next review available in: 10 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA new ChangesEditor-readiness policy extraction
Estimated code review effort: 2 (Simple) | ~15 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
Packages/src/Editor/Application/UnityCliLoopEditorStateGuard.cs (1)
24-48: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider a guard-level test for the exception mapping.
The delegation itself is correct —
ToolExecutionEditorStatefield order matches the constructor, andUnityCliLoopToolBusyExceptionparameter order matchesdecision.RunningOperationName/RequestedToolName/IsPlaying/IsPaused. However, the previousUnityCliLoopEditorStateGuardTests.cswas removed and replaced entirely with policy-level tests, so there's no longer a test asserting thatValidateForStateactually throwsUnityCliLoopToolBusyExceptionwith the correct fields (or returns normally when ready). This adapter mapping is the actual externally-observable contract; a future edit to field order/wiring here wouldn't be caught by the policy tests alone.Consider adding a small guard-level test (e.g., using a fake
IEditorRuntimeStatePort) that verifies the busy/ready outcomes end-to-end.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Packages/src/Editor/Application/UnityCliLoopEditorStateGuard.cs` around lines 24 - 48, Add a guard-level test for UnityCliLoopEditorStateGuard.ValidateForState to cover the adapter contract end-to-end. The current policy tests do not verify that ValidateForState returns normally when ToolExecutionEditorReadyPolicy says ready, or that it throws UnityCliLoopToolBusyException with the correct RunningOperationName, RequestedToolName, IsPlaying, and IsPaused values when busy. Use the existing UnityCliLoopEditorStateGuard and UnityCliLoopToolBusyException symbols to add a small test (ideally via a fake IEditorRuntimeStatePort) that exercises both ready and busy outcomes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@Packages/src/Editor/Application/UnityCliLoopEditorStateGuard.cs`:
- Around line 24-48: Add a guard-level test for
UnityCliLoopEditorStateGuard.ValidateForState to cover the adapter contract
end-to-end. The current policy tests do not verify that ValidateForState returns
normally when ToolExecutionEditorReadyPolicy says ready, or that it throws
UnityCliLoopToolBusyException with the correct RunningOperationName,
RequestedToolName, IsPlaying, and IsPaused values when busy. Use the existing
UnityCliLoopEditorStateGuard and UnityCliLoopToolBusyException symbols to add a
small test (ideally via a fake IEditorRuntimeStatePort) that exercises both
ready and busy outcomes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 407acc2d-c440-42c0-a5d9-4ff8dac86918
⛔ Files ignored due to path filters (3)
Assets/Tests/Editor/ToolExecutionEditorReadyPolicyTests.cs.metais excluded by none and included by nonePackages/src/Editor/Application/UnityCliLoopEditorStateGuard.cs.metais excluded by none and included by nonePackages/src/Editor/Domain/ToolExecutionEditorReadyPolicy.cs.metais excluded by none and included by none
📒 Files selected for processing (4)
Assets/Tests/Editor/ToolExecutionEditorReadyPolicyTests.csAssets/Tests/Editor/UnityCliLoopEditorStateGuardTests.csPackages/src/Editor/Application/UnityCliLoopEditorStateGuard.csPackages/src/Editor/Domain/ToolExecutionEditorReadyPolicy.cs
💤 Files with no reviewable changes (1)
- Assets/Tests/Editor/UnityCliLoopEditorStateGuardTests.cs
Remove the now-single-use ValidateForState helper after retargeting tests to the Domain readiness policy.
Summary
User Impact
Changes
ToolExecutionEditorReadyPolicywith decision DTOs in Domain.UnityCliLoopEditorStateGuardin Application as the exception adapter.Verification
dist/darwin-arm64/uloop compile --project-path "$(git rev-parse --show-toplevel)"dist/darwin-arm64/uloop run-tests --project-path "$(git rev-parse --show-toplevel)" --test-mode EditMode --filter-type regex --filter-value "io.github.hatayama.UnityCliLoop.Tests.Editor.ToolExecutionEditorReadyPolicyTests.*"dist/darwin-arm64/uloop run-tests --project-path "$(git rev-parse --show-toplevel)" --test-mode EditMode --filter-type regex --filter-value "io.github.hatayama.UnityCliLoop.Tests.Editor.UnityCliLoopToolExecutionServiceTests.*"