Skip to content

refactor: extract mouse UI one-shot drag execution - #1637

Merged
hatayama merged 2 commits into
v3-betafrom
refactor/hatayama/extract-mouse-ui-one-shot-drag
Jul 8, 2026
Merged

hatayama merged 2 commits into
v3-betafrom
refactor/hatayama/extract-mouse-ui-one-shot-drag

Conversation

@hatayama

@hatayama hatayama commented Jul 8, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • extract drag initiation, interpolation, raycast refresh, and finalization into MouseUiDragEventExecutor
  • extract complete one-shot drag orchestration into MouseUiOneShotDragExecutor
  • reduce SimulateMouseUiUseCase from 690 lines to 434 lines while leaving incremental drag state orchestration for the final stage

Behavioral Preservation

  • confirmed the full 32-test PlayMode suite was green before editing and after each extraction commit
  • preserved pointer down, potential drag, begin drag, drag, pointer up, drop, and end drag ordering
  • preserved frame waits, animation timing, timeout responses, cancellation, every ConfigureAwait(false), and overlay state updates
  • preserved the one-shot cleanup lambda with the same captured pointerData, target, and explicitDropTarget values and the same deferred scheduler timing
  • normalized the old one-shot body against the new executor after folding the scheduler name; the only difference was a trailing blank line
  • left MouseDragState ownership and all incremental drag orchestration unchanged

Planned Adaptations

  • the three shared mechanic entries are now internal static; their private raycast helper remains private
  • ExecuteDragOneShot is now an internal static entry and receives MouseUiMainThreadCleanupScheduler explicitly
  • six queued clears and one scheduled cleanup now use the explicit scheduler parameter
  • use-case callers reference the new owners directly; no wrappers, constructors, delegates, reverse references, or mutable static state were added

Validation

  • Unity compile: 0 errors, 0 warnings
  • SimulateMouseUiTests PlayMode: 32 passed at baseline and after both commits
  • related EditMode suites: 138 passed across 8 fixtures
  • helper-to-use-case reverse references: 0
  • old shared mechanic and one-shot definitions remaining in the use case: 0
  • new mutable static state: 0

Test Scope

  • no direct EditMode test was added for interpolation because it awaits Editor frames and would violate the freeze-prevention rules
  • existing PlayMode coverage exercises the shared mechanics through both one-shot and incremental drag flows

Compatibility

  • no IPC request or response shape changed
  • no protocol version bump is required
  • incremental drag, R2-40, and R2-41 remain intentionally out of scope

Review in cubic

hatayama added 2 commits July 9, 2026 06:13
Move drag initiation, interpolation, and finalization into a stateless helper so one-shot and incremental drag orchestration share the same pointer event lifecycle without depending on the use case.
Move complete drag orchestration into a stateless executor, passing the shared cleanup scheduler explicitly while preserving pointer event timing, captured cleanup state, and timeout behavior.
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

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

Next review available in: 1 minute

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: e2b04bee-27d0-48f0-9d58-9cc80bbf518e

📥 Commits

Reviewing files that changed from the base of the PR and between 14415de and fda8c3b.

⛔ Files ignored due to path filters (2)
  • Packages/src/Editor/FirstPartyTools/SimulateMouseUi/MouseUiDragEventExecutor.cs.meta is excluded by none and included by none
  • Packages/src/Editor/FirstPartyTools/SimulateMouseUi/MouseUiOneShotDragExecutor.cs.meta is excluded by none and included by none
📒 Files selected for processing (3)
  • Packages/src/Editor/FirstPartyTools/SimulateMouseUi/MouseUiDragEventExecutor.cs
  • Packages/src/Editor/FirstPartyTools/SimulateMouseUi/MouseUiOneShotDragExecutor.cs
  • Packages/src/Editor/FirstPartyTools/SimulateMouseUi/SimulateMouseUiUseCase.cs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/hatayama/extract-mouse-ui-one-shot-drag

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.

@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.

1 issue found across 5 files

You’re at about 98% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="Packages/src/Editor/FirstPartyTools/SimulateMouseUi/MouseUiOneShotDragExecutor.cs">

<violation number="1" location="Packages/src/Editor/FirstPartyTools/SimulateMouseUi/MouseUiOneShotDragExecutor.cs:28">
P2: `ExecuteDragOneShot` duplicates the drag-target resolution, `IDragHandler` lookup, and no-handler expand/dissipate fallback sequence that already exists in `SimulateMouseUiUseCase.ExecuteDragStart`. Both paths convert coordinates, branch on `BypassRaycast`, resolve `TargetPath`, call `ExecuteEvents.GetEventHandler<IDragHandler>`, and play identical overlay animations with the same failure messages. Extracting a shared helper (e.g., for target resolution + no-handler response) would keep future changes to bypass logic, error wording, or overlay timing in a single place.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

@hatayama
hatayama merged commit 9da9360 into v3-beta Jul 8, 2026
10 checks passed
@hatayama
hatayama deleted the refactor/hatayama/extract-mouse-ui-one-shot-drag branch July 8, 2026 21:29
RyanXie123 pushed a commit to RyanXie123/unity-cli-loop that referenced this pull request Sep 22, 2026
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