chore: Collapse the input-simulation tools' redundant intermediate DTO layer#1516
Conversation
The three input-simulation tools (simulate-keyboard, simulate-mouse-input, simulate-mouse-ui) each carried a pure field-copy layer between the wire schema/response and the use case: a per-tool service interface plus a Request and Result DTO that only forwarded fields with matching names. The tool executor did the copy on the way in and out, adding weight without adding a boundary — the use cases already reach into Unity Editor APIs directly, so the interface offers no substitutable seam. Fold the use cases so each one accepts its own Schema and returns its own Response directly; keep the shared enums, mouse-UI defaults, and the PausePointHit value object because the wire responses still use them. This is the third PR in the collapse series after Compile (#1514) and RunTests (#1515) and follows the same reviewer feedback: explicit null guards at the use case entry, no comments referencing pre-collapse shape, and domain value objects preserved.
|
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 (8)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughLegacy input simulation service interfaces and request/result DTO types are removed and replaced with a unified schema/response contract. SimulateKeyboard, SimulateMouseInput, and SimulateMouseUi tools now delegate directly to use-case ChangesInput simulation ExecuteAsync migration
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Tool as SimulateXTool
participant UseCase as SimulateXUseCase
participant Device as Keyboard/Mouse
Tool->>UseCase: ExecuteAsync(schema, ct)
UseCase->>UseCase: validate schema, PlayMode/pause state
UseCase->>Device: dispatch action-specific handler
Device-->>UseCase: interaction result
UseCase-->>Tool: typed Response object
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
…wait Self-review follow-up: SimulateMouseInputUseCase now names its schema parameter "parameters" like SimulateKeyboardUseCase, and SimulateMouseUiTool no longer calls ConfigureAwait(false) on a body that has no code after the await, matching its sibling tools. SimulateMouseUiUseCase keeps "request" because "parameters" is already taken by the MouseUiSimulationCommand used throughout that file.
Summary
IUnityCliLoop*SimulationServiceinterfaces and sixUnityCliLoop*SimulationRequest/Resultclasses, which only performed field-by-field copies. Third PR in the series after chore: Collapse the Compile tool's redundant intermediate DTO layer #1514 (Compile) and chore: Collapse the RunTests tool's redundant intermediate DTO layer #1515 (RunTests).User Impact
Changes
UnityCliLoopInputSimulationDefaults,UnityCliLoopPausePointHit) — those are consumed by the wire DTOs themselves.Verification
dist/darwin-arm64/uloop compile→ 0 errors, 0 warnings.dist/darwin-arm64/uloop run-tests --filter-type regex --filter-value "(Simulate|StaticFacadeStateGuard|OnionAssemblyDependency).*Tests"→ 93 passed, 0 failed, 0 skipped.