Skip to content

chore: Use direct schemas in remaining mapped tools#1599

Merged
hatayama merged 1 commit into
v3-betafrom
feature/hatayama/remove-schema-request-mapping-layer
Jul 8, 2026
Merged

chore: Use direct schemas in remaining mapped tools#1599
hatayama merged 1 commit into
v3-betafrom
feature/hatayama/remove-schema-request-mapping-layer

Conversation

@hatayama

@hatayama hatayama commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Simplify the remaining mapped bundled tools so their use cases consume tool schemas directly and return the existing response contracts.
  • Remove unused single-implementation service interfaces and intermediate request/result DTOs.

User Impact

  • CLI response JSON is intended to stay unchanged for FindGameObjects, GetHierarchy, RecordInput, ReplayInput, and Screenshot.
  • The internal flow is now consistent with the other bundled tools, reducing duplicate mapping code.

Changes

  • Removed Schema-to-request and result-to-response mapping layers for FindGameObjects, GetHierarchy, RecordInput, ReplayInput, and Screenshot.
  • Kept the existing public response classes and schema classes as the wire-facing contracts for those tools.
  • Removed intermediate types after dead-code scanner and repository-wide searches showed no external references; wire shape remains unchanged.
  • Kept screenshot coordinate constants because ScreenshotInfo still uses them.

Protocol

  • No IPC protocol version bump is needed because request and response JSON shapes are unchanged.
  • If the protocol reminder runs, treat it as a review prompt for confirming unchanged wire shape.

Verification

  • dist/darwin-arm64/uloop clear-console --project-path "$(git rev-parse --show-toplevel)"
  • 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 "(InputActionValidationTests|UnityCliLoopToolExecutionServiceTests|OnionAssemblyDependencyTests|FindGameObjects|GetHierarchy|RecordInput|ReplayInput|Screenshot)"
  • dotnet run --project tools/UnityCliLoop.DeadCodeScanner -- --scope public --include-types true --include-members false --include-locals false --include-test-only true --include-kept true --format table
  • Verified the five tool response types remain the wire-facing response contracts, so serialization output is unchanged.

Review in cubic

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@hatayama, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 23 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 40d03cd1-1f09-4cae-aecd-62f7369f3916

📥 Commits

Reviewing files that changed from the base of the PR and between c71c3a1 and ab886ee.

⛔ Files ignored due to path filters (2)
  • Packages/src/Editor/FirstPartyTools/Common/InputRecording/UnityCliLoopInputRecordingTypes.cs.meta is excluded by none and included by none
  • Packages/src/Editor/FirstPartyTools/GetHierarchy/UnityCliLoopHierarchyTypes.cs.meta is excluded by none and included by none
📒 Files selected for processing (18)
  • Assets/Tests/Editor/InputActionValidationTests.cs
  • Assets/Tests/Editor/OnionAssemblyDependencyTests.cs
  • Assets/Tests/Editor/UnityCliLoopToolExecutionServiceTests.cs
  • Packages/src/Editor/FirstPartyTools/Common/InputRecording/UnityCliLoopInputRecordingTypes.cs
  • Packages/src/Editor/FirstPartyTools/FindGameObjects/Application/FindGameObjectsResultExporter.cs
  • Packages/src/Editor/FirstPartyTools/FindGameObjects/FindGameObjectsTool.cs
  • Packages/src/Editor/FirstPartyTools/FindGameObjects/FindGameObjectsUseCase.cs
  • Packages/src/Editor/FirstPartyTools/FindGameObjects/UnityCliLoopGameObjectSearchTypes.cs
  • Packages/src/Editor/FirstPartyTools/GetHierarchy/GetHierarchyTool.cs
  • Packages/src/Editor/FirstPartyTools/GetHierarchy/GetHierarchyUseCase.cs
  • Packages/src/Editor/FirstPartyTools/GetHierarchy/UnityCliLoopHierarchyTypes.cs
  • Packages/src/Editor/FirstPartyTools/RecordInput/RecordInputTool.cs
  • Packages/src/Editor/FirstPartyTools/RecordInput/RecordInputUseCase.cs
  • Packages/src/Editor/FirstPartyTools/ReplayInput/ReplayInputTool.cs
  • Packages/src/Editor/FirstPartyTools/ReplayInput/ReplayInputUseCase.cs
  • Packages/src/Editor/FirstPartyTools/Screenshot/ScreenshotTool.cs
  • Packages/src/Editor/FirstPartyTools/Screenshot/ScreenshotUseCase.cs
  • Packages/src/Editor/ToolContracts/UnityCliLoopScreenshotTypes.cs
📝 Walkthrough

Walkthrough

This PR removes legacy UnityCliLoop-prefixed service interfaces and request/result DTOs (GetHierarchy, FindGameObjects, Screenshot, RecordInput, ReplayInput) and updates tools, use cases, an exporter, and tests to construct/consume the corresponding schema/response contract types directly, eliminating intermediate mapping helpers.

Changes

Schema/Response contract migration

Layer / File(s) Summary
GetHierarchy migration
Packages/src/Editor/FirstPartyTools/GetHierarchy/GetHierarchyTool.cs, GetHierarchyUseCase.cs, UnityCliLoopHierarchyTypes.cs (removed), Assets/Tests/Editor/OnionAssemblyDependencyTests.cs
Removes IUnityCliLoopHierarchyService and its request/result DTOs; GetHierarchyTool/GetHierarchyUseCase now use GetHierarchySchema/GetHierarchyResponse directly.
FindGameObjects migration
FindGameObjectsTool.cs, FindGameObjectsUseCase.cs, UnityCliLoopGameObjectSearchTypes.cs, FindGameObjectsResultExporter.cs, OnionAssemblyDependencyTests.cs
Removes IUnityCliLoopGameObjectSearchService and request/result/error DTOs; use case and exporter switch to FindGameObjectsSchema/FindGameObjectsResponse/FindGameObjectResult/ProcessingError across normal and selected-mode search paths.
Screenshot migration
ScreenshotTool.cs, ScreenshotUseCase.cs, UnityCliLoopScreenshotTypes.cs, OnionAssemblyDependencyTests.cs, UnityCliLoopToolExecutionServiceTests.cs
Removes IUnityCliLoopScreenshotService and its DTOs; tool and use case now use ScreenshotSchema/ScreenshotResponse/ScreenshotInfo for rendering and window capture, including timeout handling.
RecordInput migration
RecordInputTool.cs, RecordInputUseCase.cs, InputActionValidationTests.cs
Removes IUnityCliLoopRecordInputService reliance; tool and use case now use RecordInputSchema/RecordInputResponse across start/stop/countdown flows.
ReplayInput and shared contract removal
ReplayInputTool.cs, ReplayInputUseCase.cs, UnityCliLoopInputRecordingTypes.cs (removed), OnionAssemblyDependencyTests.cs, InputActionValidationTests.cs
Removes the shared UnityCliLoopInputRecordingTypes.cs contract file entirely; ReplayInputTool/ReplayInputUseCase now use ReplayInputSchema/ReplayInputResponse across start/stop/status flows.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Tool as FeatureTool
  participant UseCase as FeatureUseCase
  Tool->>UseCase: ExecuteAsync(Schema, ct)
  UseCase-->>Tool: Response
Loading

Possibly related PRs

  • hatayama/unity-cli-loop#1333: Prior change to the same ScreenshotTool_ToResponse_WhenCaptureTimedOut_PreservesTimeoutDetails test and timeout-detail contract now reflected via ScreenshotResponse.
  • hatayama/unity-cli-loop#1473: Related ScreenshotResponse/ScreenshotSchema DTO and ScreenshotTool capture/metadata changes preceding this migration.
  • hatayama/unity-cli-loop#1522: Related unknown/out-of-range action validation logic for record/replay input affecting the same InputActionValidationTests.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: switching the remaining mapped tools to direct schema usage.
Description check ✅ Passed The description is directly related to the changeset and accurately describes the schema-to-response refactor and removed DTOs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/hatayama/remove-schema-request-mapping-layer

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
Assets/Tests/Editor/UnityCliLoopToolExecutionServiceTests.cs (1)

100-114: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

This test is now tautological and its name is stale.

After removing the ToResponse mapping, this test constructs a ScreenshotResponse, sets TimedOut/Message/Screenshots, and then asserts those same values back—so it now only exercises ScreenshotResponse's auto-properties and ScreenshotCount, not any production behavior. The method name ScreenshotTool_ToResponse_WhenCaptureTimedOut_PreservesTimeoutDetails also references a method that no longer exists.

Consider redirecting it to exercise the real timeout path (e.g. ScreenshotUseCase.CreateTimedOutResult / a rendering-timeout capture) so the "preserves timeout details" guarantee is actually verified, and rename accordingly.

🤖 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 `@Assets/Tests/Editor/UnityCliLoopToolExecutionServiceTests.cs` around lines
100 - 114, The test is tautological and the name is stale because it no longer
exercises any production mapping logic. Update the test in
UnityCliLoopToolExecutionServiceTests so it drives the real timeout path via
ScreenshotUseCase.CreateTimedOutResult or the relevant rendering-timeout flow
instead of manually constructing ScreenshotResponse, then assert the resulting
response preserves TimedOut, Message, and ScreenshotCount. Rename the test to
match the actual behavior being verified and remove the reference to the removed
ToResponse method.
🤖 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 `@Assets/Tests/Editor/UnityCliLoopToolExecutionServiceTests.cs`:
- Around line 100-114: The test is tautological and the name is stale because it
no longer exercises any production mapping logic. Update the test in
UnityCliLoopToolExecutionServiceTests so it drives the real timeout path via
ScreenshotUseCase.CreateTimedOutResult or the relevant rendering-timeout flow
instead of manually constructing ScreenshotResponse, then assert the resulting
response preserves TimedOut, Message, and ScreenshotCount. Rename the test to
match the actual behavior being verified and remove the reference to the removed
ToResponse method.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2b78124c-b362-4680-a858-358a0df8ad94

📥 Commits

Reviewing files that changed from the base of the PR and between 9299025 and c71c3a1.

⛔ Files ignored due to path filters (2)
  • Packages/src/Editor/FirstPartyTools/Common/InputRecording/UnityCliLoopInputRecordingTypes.cs.meta is excluded by none and included by none
  • Packages/src/Editor/FirstPartyTools/GetHierarchy/UnityCliLoopHierarchyTypes.cs.meta is excluded by none and included by none
📒 Files selected for processing (18)
  • Assets/Tests/Editor/InputActionValidationTests.cs
  • Assets/Tests/Editor/OnionAssemblyDependencyTests.cs
  • Assets/Tests/Editor/UnityCliLoopToolExecutionServiceTests.cs
  • Packages/src/Editor/FirstPartyTools/Common/InputRecording/UnityCliLoopInputRecordingTypes.cs
  • Packages/src/Editor/FirstPartyTools/FindGameObjects/Application/FindGameObjectsResultExporter.cs
  • Packages/src/Editor/FirstPartyTools/FindGameObjects/FindGameObjectsTool.cs
  • Packages/src/Editor/FirstPartyTools/FindGameObjects/FindGameObjectsUseCase.cs
  • Packages/src/Editor/FirstPartyTools/FindGameObjects/UnityCliLoopGameObjectSearchTypes.cs
  • Packages/src/Editor/FirstPartyTools/GetHierarchy/GetHierarchyTool.cs
  • Packages/src/Editor/FirstPartyTools/GetHierarchy/GetHierarchyUseCase.cs
  • Packages/src/Editor/FirstPartyTools/GetHierarchy/UnityCliLoopHierarchyTypes.cs
  • Packages/src/Editor/FirstPartyTools/RecordInput/RecordInputTool.cs
  • Packages/src/Editor/FirstPartyTools/RecordInput/RecordInputUseCase.cs
  • Packages/src/Editor/FirstPartyTools/ReplayInput/ReplayInputTool.cs
  • Packages/src/Editor/FirstPartyTools/ReplayInput/ReplayInputUseCase.cs
  • Packages/src/Editor/FirstPartyTools/Screenshot/ScreenshotTool.cs
  • Packages/src/Editor/FirstPartyTools/Screenshot/ScreenshotUseCase.cs
  • Packages/src/Editor/ToolContracts/UnityCliLoopScreenshotTypes.cs
💤 Files with no reviewable changes (4)
  • Packages/src/Editor/FirstPartyTools/Common/InputRecording/UnityCliLoopInputRecordingTypes.cs
  • Packages/src/Editor/FirstPartyTools/GetHierarchy/UnityCliLoopHierarchyTypes.cs
  • Packages/src/Editor/FirstPartyTools/FindGameObjects/UnityCliLoopGameObjectSearchTypes.cs
  • Packages/src/Editor/ToolContracts/UnityCliLoopScreenshotTypes.cs

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 20 files

Re-trigger cubic

Remove the intermediate request/result mapping layer from the remaining mapped bundled tools so they follow the same schema-to-response flow as the rest of the tool set. The public response shapes stay unchanged while unused single-implementation service and DTO types are removed.
@hatayama
hatayama force-pushed the feature/hatayama/remove-schema-request-mapping-layer branch from c71c3a1 to ab886ee Compare July 8, 2026 06:32
@hatayama
hatayama merged commit 24fba69 into v3-beta Jul 8, 2026
9 checks passed
@hatayama
hatayama deleted the feature/hatayama/remove-schema-request-mapping-layer branch July 8, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant