Skip to content

chore: Pass a cancellation token through mouse press cleanup helpers - #2930

Merged
hatayama merged 1 commit into
mainfrom
fix/mouse-press-cleanup-ct
Sep 23, 2026
Merged

hatayama merged 1 commit into
mainfrom
fix/mouse-press-cleanup-ct

Conversation

@hatayama

@hatayama hatayama commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • FinishHeldButton and ReleaseHeldButtonAfterPause in MouseInputPressActionExecutor were added (fix: simulate-mouse-input always releases the mouse button when a pause point interrupts a press #2856) as async methods without the standard CancellationToken ct parameter, so StaticFacadeStateGuardTests.RefactorTargets_WhenDeclaringAsyncMethods_RequireCancellationTokenCt fails in the nightly EditMode run.
  • Both methods now take ct and use it for their awaits. The callers still pass CancellationToken.None: the release runs in a finally block and must complete even when the command itself was cancelled, which is the same behavior as before.

No behavior change.

Verification

  • EditMode (class filter): StaticFacadeStateGuardTests, MouseInputSimulationResponseFactoryTests, SimulateMouseInputDryRunTests, SimulateMouseInputResponseWarningTests — 32/32 passed (the guard test failed before this change).
  • PlayMode (class filter): SimulateMouseInputTests, SimulateMouseInputMonitorRemovalTests, MouseInputSimulationResponseFactoryTests — 17/17 passed.

Review in cubic

FinishHeldButton and ReleaseHeldButtonAfterPause were added as async
methods without the standard ct parameter, which fails the async
cancellation-token guard in StaticFacadeStateGuardTests. The callers
still pass CancellationToken.None because the release runs in a finally
block and must complete even when the command itself was cancelled.
@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: hatayama/unity-cli-loop/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 195e4546-4b3e-42ae-ade2-53d4eaa08bd0

📥 Commits

Reviewing files that changed from the base of the PR and between ad7e8da and 28a83d6.

📒 Files selected for processing (1)
  • Packages/src/Editor/FirstPartyTools/SimulateMouseInput/MouseInputPressActionExecutor.cs

Included review availability: Your plan provides up to 4 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

Click and long-press cleanup now starts the button release with CancellationToken.None. The release helpers pass their supplied cancellation token to paused-release and main-thread switching operations.

Changes

Mouse button release

Layer / File(s) Summary
Pass cancellation tokens through release cleanup
Packages/src/Editor/FirstPartyTools/SimulateMouseInput/MouseInputPressActionExecutor.cs
The click and long-press finally blocks pass CancellationToken.None to FinishHeldButton. The release helpers use their supplied token for paused release, button release, and main-thread switching.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 28a83

Mouse-button cleanup remains able to release the button after command cancellation. No issue requiring a pre-merge fix is identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: passing a cancellation token through mouse press cleanup helpers.
Description check ✅ Passed The description directly explains the cancellation-token changes, the reason for passing CancellationToken.None during cleanup, and the verification results. It is related to the changeset.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

@hatayama
hatayama merged commit 8deba7c into main Sep 23, 2026
17 checks passed
@hatayama
hatayama deleted the fix/mouse-press-cleanup-ct branch September 23, 2026 05:04
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