Skip to content

Respect UI raycast priority in simulate-mouse-ui#1318

Merged
hatayama merged 5 commits into
hatayama:mainfrom
prog-k-dev:fix/simulate-mouse-ui-overlay-priority
Jun 14, 2026
Merged

Respect UI raycast priority in simulate-mouse-ui#1318
hatayama merged 5 commits into
hatayama:mainfrom
prog-k-dev:fix/simulate-mouse-ui-overlay-priority

Conversation

@prog-k-dev

@prog-k-dev prog-k-dev commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #1317.

This updates simulate-mouse-ui raycast selection so it better matches real user input priority when mixed raycasters or multiple ScreenSpace-Overlay canvases overlap at the same screen position.

Previously, simulate-mouse-ui used the first EventSystem.RaycastAll result directly. In some scenes that result can be a lower-priority target, such as:

  • a Physics2D collider behind a visible overlay UI button
  • a lower-sorting-order full-screen uGUI mask in front of gameplay but behind a higher-sorting-order modal button

That could cause simulate-mouse-ui to dispatch to the wrong target or report that no clickable UI handler was hit even though manual user input reaches the frontmost button.

Changes

  • Reuse the ScreenSpace-Overlay canvas-space hit test before returning the first EventSystem.RaycastAll result.
  • Prefer the overlay Graphic hit when the first EventSystem hit is not from a GraphicRaycaster.
  • When both candidates are UI hits, compare raycaster/canvas priority before selecting the target.
  • Populate canvas-space RaycastResult candidates with module, sorting layer/order, and depth.
  • Use the shared helper while updating drag pointer raycasts.
  • Add PlayMode regression tests for:
    • Physics2D first-hit behind an overlay UI target
    • lower-order full-screen UI mask behind a higher-order modal Canvas target

Testing

  • Verified compilation in a Unity 6000.1 project that consumes the package.
  • Manually validated a runtime setup where EventSystem.RaycastAll first returned a Physics2D collider, while simulate-mouse-ui clicked the visible ScreenSpace-Overlay button.
  • Manually validated a layered modal setup where a lower-order full-screen uGUI mask previously intercepted the simulated click; after this change, simulate-mouse-ui clicked the higher-order modal button and the flow completed.
  • Added PlayMode regression tests in this repository.
  • The repository PlayMode test suite was not run locally because Unity 2022.3.62f3 is not installed in this environment.

Review in cubic

Summary

Problem

The simulate-mouse-ui tool was selecting raycast targets based on the first result from EventSystem.RaycastAll(), which doesn't accurately reflect UI visual priority when multiple raycasters overlap. This caused clicks to be dispatched to lower-priority targets such as Physics2D colliders behind visible overlay UI buttons, or lower-sorting-order full-screen UI masks positioned between gameplay and higher-priority modal buttons.

Solution

Implemented priority-aware raycast selection that compares candidate hits using UI priority factors (raycaster module priority, canvas sorting layer/order, and graphic depth) before selecting the target. The fix reuses canvas-space hit testing and prefers GraphicRaycaster-based UI results over non-UI raycaster results.

Changes

Core Logic (UiRaycastHelper.cs)

  • Enhanced RaycastUI() to compute canvas-space hits before EventSystem results and apply intelligent preference logic via ShouldPreferCanvasSpaceHit()
  • Expanded RaycastCanvasSpace() to build fully populated RaycastResult candidates with complete metadata (module, sorting layer/order, graphic depth) instead of partial hits
  • Added comprehensive priority-ranking system (CompareRaycastPriority) that orders hits by:
    1. Raycaster module sort order priority
    2. Raycaster module render order priority
    3. Canvas sorting layer value
    4. Canvas sorting order
    5. Graphic depth

Integration (SimulateMouseUiTool.cs)

  • Updated UpdatePointerRaycast() to delegate raycast selection to UiRaycastHelper.RaycastUI() instead of directly using EventSystem results, removing prior first-result selection logic

Test Coverage (SimulateMouseUiTests.cs)

  • Added three regression tests validating correct target selection:
    • Click_Should_PreferClippedOverlayUiOverNonUiRaycastHit(): Clipped ScreenSpace-Overlay UI preferred over non-UI raycaster hit
    • Click_Should_PreferOverlayUiOverPhysics2DRaycastHit(): Overlay UI correctly selected even when Physics2D collider appears first in raycast ordering
    • Click_Should_PreferClippedHigherOrderOverlayUiOverLowerGraphicRaycasterHit(): Higher-order overlay UI preferred over lower-priority GraphicRaycaster hit
  • Introduced deterministic test-only raycaster types:
    • AlwaysHitRaycaster: Simulates non-UI raycaster (e.g., PhysicsRaycaster) without requiring physics modules
    • AlwaysHitGraphicRaycaster: Lower-priority GraphicRaycaster for testing canvas-order scenarios
    • HighPriorityPhysics2DRaycaster: Physics2D raycaster with maximum sort/render priority for testing priority comparison

Dependencies (Packages/manifest.json)

  • Added com.unity.modules.physics2d (1.0.0) to support Physics2D test scenarios

CI/CD (build-and-test.yml)

  • Added fork PR validation: Verifies built artifacts (dist/server.bundle.js) are committed by fork contributors, preventing workflow failures on missing builds
  • Simplified main repository PR builds with conditional commit guard

Verification

The fix has been validated against both original failure scenarios described in issue #1317:

  • Physics2D collider behind overlay UI button: Click now correctly dispatches to the visible button instead of the hidden collider
  • Lower-sorting-order full-screen UI mask behind modal button: Click now reaches the frontmost modal button instead of being intercepted by the lower-priority mask

Backward compatibility maintained by limiting Physics2D module dependency to test project only, not the main package manifest.

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Enhances UI raycast selection to prefer ScreenSpace-Overlay Graphic hits over mixed EventSystem results using priority-ranked comparison, integrates the logic into pointer updates, adds three playmode regression tests validating click dispatch with overlaid raycasters, includes test helper raycasters and dependencies, and implements CI workflow verification for built artifacts in fork PRs.

Changes

UI Raycast Prioritization and Validation

Layer / File(s) Summary
Core UI raycast selection and prioritization logic
Packages/src/Editor/Api/McpTools/SimulateMouseUi/UiRaycastHelper.cs
Enhanced RaycastUI to precompute manual canvas-space hits and conditionally prefer them over EventSystem results via new ShouldPreferCanvasSpaceHit and CompareRaycastPriority helpers. Expanded RaycastCanvasSpace to build fully populated RaycastResult candidates with module, sorting layer, sorting order, and depth, then rank them by priority.
Tool integration with new raycast helper
Packages/src/Editor/Api/McpTools/SimulateMouseUi/SimulateMouseUiTool.cs
UpdatePointerRaycast now uses UiRaycastHelper.RaycastUI(...) instead of calling EventSystem.RaycastAll directly, defaulting to an empty RaycastResult when null. Cleaned up unused imports.
Playmode regression tests and test support
Assets/Tests/PlayMode/SimulateMouseUiTests.cs, Packages/manifest.json, Packages/packages-lock.json
Added three click regression tests that validate overlay UI preference: clipped overlay UI over non-UI raycasters, overlay UI over Physics2D colliders, and higher-order clipped UI over lower-priority Graphics. Included custom raycasters (AlwaysHitRaycaster, AlwaysHitGraphicRaycaster, HighPriorityPhysics2DRaycaster), a physics plane conversion helper, and Physics2D package dependency.
CI workflow fork-PR verification
.github/workflows/build-and-test.yml
Conditioned the "Commit built files (if changed)" step on internal PRs only. For fork PRs, added "Verify built files are committed" step that fails the workflow if dist/server.bundle.js and .map differ from committed versions, ensuring contributors commit built artifacts.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Respect UI raycast priority in simulate-mouse-ui' accurately and concisely summarizes the main change: fixing raycast target selection to respect UI priority rather than using the first result.
Linked Issues check ✅ Passed The PR fully addresses issue #1317 objectives by implementing priority-aware raycast selection that accounts for GraphicRaycaster priority, Canvas sorting layer/order, and Graphic depth, fixing both identified failure modes: Physics2D behind overlay UI and lower-order mask vs higher-order modal.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the raycast priority fix: test coverage in SimulateMouseUiTests.cs, raycast logic in SimulateMouseUiTool.cs and UiRaycastHelper.cs, Physics2D test dependency, and workflow guards for fork PRs are all related to the core objective.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@prog-k-dev
prog-k-dev marked this pull request as draft June 12, 2026 10:52

@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)
Packages/src/Editor/Api/McpTools/SimulateMouseUi/UiRaycastHelper.cs (1)

21-21: ⚡ Quick win

Consider deferring overlayHit computation for better performance.

Computing overlayHit upfront means RaycastCanvasSpace (which calls FindObjectsByType<Canvas> and enumerates Graphics) runs even when the first EventSystem result is already from GraphicRaycaster. Deferring the computation until you confirm the first hit is non-Graphics avoids unnecessary work in the common case where overlay UI is correctly prioritized by EventSystem.

⚡ Suggested optimization
-        RaycastResult? overlayHit = RaycastCanvasSpace(screenPosition);
-
         if (results.Count > 0)
         {
             RaycastResult firstHit = results[0];
-            if (overlayHit != null && !IsGraphicRaycast(firstHit))
+            if (!IsGraphicRaycast(firstHit))
             {
-                return overlayHit;
+                RaycastResult? overlayHit = RaycastCanvasSpace(screenPosition);
+                if (overlayHit != null)
+                {
+                    return overlayHit;
+                }
             }
 
             return firstHit;
         }
 
         // EventSystem clips at Screen.width/height, which can be smaller than the
         // Canvas layout space (Game view target resolution). Fall back to manual hit testing.
-        return overlayHit;
+        return RaycastCanvasSpace(screenPosition);
🤖 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/Api/McpTools/SimulateMouseUi/UiRaycastHelper.cs` at line
21, The current code eagerly calls RaycastCanvasSpace and assigns overlayHit
even when the first EventSystem result comes from a GraphicRaycaster; change
this to defer computing overlayHit: after you get the EventSystem raycast
results, inspect the first result's module/gameObject (or whether it's a
GraphicRaycaster/Graphic) and only call RaycastCanvasSpace() to compute
overlayHit if the first hit is not already a UI Graphic; update the overlayHit
variable to be nullable/uninitialized and assign it only in that conditional
branch so you avoid unnecessary FindObjectsByType<Canvas> and Graphics
enumeration.
🤖 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/Api/McpTools/SimulateMouseUi/UiRaycastHelper.cs`:
- Line 21: The current code eagerly calls RaycastCanvasSpace and assigns
overlayHit even when the first EventSystem result comes from a GraphicRaycaster;
change this to defer computing overlayHit: after you get the EventSystem raycast
results, inspect the first result's module/gameObject (or whether it's a
GraphicRaycaster/Graphic) and only call RaycastCanvasSpace() to compute
overlayHit if the first hit is not already a UI Graphic; update the overlayHit
variable to be nullable/uninitialized and assign it only in that conditional
branch so you avoid unnecessary FindObjectsByType<Canvas> and Graphics
enumeration.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f3791767-5fe9-4544-a856-159afaaac2f3

📥 Commits

Reviewing files that changed from the base of the PR and between 65ae42a and 829b53e.

📒 Files selected for processing (3)
  • Assets/Tests/PlayMode/SimulateMouseUiTests.cs
  • Packages/src/Editor/Api/McpTools/SimulateMouseUi/SimulateMouseUiTool.cs
  • Packages/src/Editor/Api/McpTools/SimulateMouseUi/UiRaycastHelper.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.

2 issues found across 3 files

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

Re-trigger cubic

Comment thread Packages/src/Editor/Api/McpTools/SimulateMouseUi/UiRaycastHelper.cs Outdated
Comment thread Assets/Tests/PlayMode/SimulateMouseUiTests.cs Outdated
@prog-k-dev
prog-k-dev marked this pull request as ready for review June 12, 2026 11:00
@prog-k-dev
prog-k-dev marked this pull request as draft June 12, 2026 11:41
@prog-k-dev

Copy link
Copy Markdown
Contributor Author

Added a second fix for the same hit-priority mismatch: when EventSystem returns a lower-priority GraphicRaycaster hit, simulate-mouse-ui now compares it with the Screen Space Overlay canvas-space candidate using raycaster/canvas priority before choosing the target.\n\nThis covers the case where a lower-order full-screen UI mask is returned before a higher-order modal canvas. I also added a PlayMode regression test for that canvas-order case.\n\nVerification note: I could not run this repository's PlayMode suite locally because Unity 2022.3.62f3 is not installed on this machine. I validated the change in a downstream Unity project by temporarily applying the same package-cache patch: compile passed, and a modal button behind a lower-order full-screen mask changed from a stalled/no-hit click to the expected button hit, allowing the flow to complete.

@prog-k-dev prog-k-dev changed the title Prefer overlay UI raycasts in simulate-mouse-ui Respect UI raycast priority in simulate-mouse-ui Jun 12, 2026

@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)
Packages/src/Editor/Api/McpTools/SimulateMouseUi/UiRaycastHelper.cs (1)

133-196: 💤 Low value

Priority comparison logic correctly implements Unity's raycast ordering.

The comparison follows Unity's documented GraphicRaycaster priority order (sortOrderPriority → renderOrderPriority → sortingLayer → sortingOrder → depth) and properly handles null modules by returning 0 as a safe default.

♻️ Optional: Use int.CompareTo for brevity

The Compare helper (lines 183-196) could be simplified using int.CompareTo:

 private static int Compare(int left, int right)
 {
-    if (left > right)
-    {
-        return 1;
-    }
-
-    if (left < right)
-    {
-        return -1;
-    }
-
-    return 0;
+    return left.CompareTo(right);
 }

The explicit logic is clear and readable, so this is purely a style preference.

🤖 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/Api/McpTools/SimulateMouseUi/UiRaycastHelper.cs` around
lines 133 - 196, The Compare helper implements numeric comparison manually;
simplify by replacing usages in CompareRaycastPriority and removing the custom
Compare method—use left.CompareTo(right) (or right.CompareTo left appropriately)
directly where Compare(...) is called (references: CompareRaycastPriority and
the Compare method) to make the code more concise while preserving behavior.
🤖 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/Api/McpTools/SimulateMouseUi/UiRaycastHelper.cs`:
- Around line 133-196: The Compare helper implements numeric comparison
manually; simplify by replacing usages in CompareRaycastPriority and removing
the custom Compare method—use left.CompareTo(right) (or right.CompareTo left
appropriately) directly where Compare(...) is called (references:
CompareRaycastPriority and the Compare method) to make the code more concise
while preserving behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ed632951-4170-4a9f-ba2d-d2bb5d4e1936

📥 Commits

Reviewing files that changed from the base of the PR and between 158fdad and b23479b.

📒 Files selected for processing (2)
  • Assets/Tests/PlayMode/SimulateMouseUiTests.cs
  • Packages/src/Editor/Api/McpTools/SimulateMouseUi/UiRaycastHelper.cs
🚧 Files skipped from review as they are similar to previous changes (1)
  • Assets/Tests/PlayMode/SimulateMouseUiTests.cs

@prog-k-dev
prog-k-dev marked this pull request as ready for review June 12, 2026 11:56

@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 3 files

Re-trigger cubic

@hatayama

Copy link
Copy Markdown
Owner

Thanks again for this PR and the investigation behind it! Quick heads-up in case you watch this thread more closely than the issue: I've posted my findings on #1317 (including what I could and couldn't reproduce on 2022.3.62f3) and opened #1324 with an alternative minimal fix for the failure mode I could reproduce. There's a manifest.json snippet in that comment to try the branch directly — I'd really appreciate it if you could check whether it resolves your original scenarios. Keeping this PR open in the meantime.

@prog-k-dev

Copy link
Copy Markdown
Contributor Author

I added a minimal Unity repro project and posted the verification details on #1317:

#1317 (comment)

Repro project:

https://github.com/prog-k-dev/uloop-raycast-repro

Short version: with the saved repro scene, #1324 still reports no UI element hit for the front overlay button, while this PR's current commit (b23479b1395b730a779988430b591187e28ddf69) hits UloopReproOverlayButton and increments the click count.

Align the contributor PR with the verified issue 1317 repro coverage by replacing unstable Physics2D assumptions, adding the test-project Physics2D module dependency, and preserving the package manifest without Physics2D dependencies.
@hatayama

Copy link
Copy Markdown
Owner

Thanks again for the PR and the follow-up repro details.

Your broader priority-comparison approach was the right direction for this issue. I pushed a maintainer follow-up commit on top of this PR to keep that approach while tightening the regression coverage:

  • replace the unstable Physics2D first-hit assumption with a deterministic Physics2D raycaster coverage test
  • add the Physics2D module dependency only to the test Unity project, not to the package manifest
  • add coverage for the clipped overlay UI vs lower-priority GraphicRaycaster case from the minimal repro

The package itself still does not depend on Physics2D.

@hatayama

Copy link
Copy Markdown
Owner

One more thing: could you please try the updated PR branch again against your minimal repro project and, if possible, the original failing setup?

I verified the updated branch locally on this repository with:

  • uloop compile --force-recompile false --wait-for-domain-reload true
  • the three related PlayMode regression tests
  • the full Tests.PlayMode.SimulateMouseUiTests.* suite

All of those passed on my side, but your repro is the source of truth for the original issue. I'd appreciate it if you could confirm whether the front overlay button now receives the click in your environment too.

@prog-k-dev

Copy link
Copy Markdown
Contributor Author

Thanks for the follow-up commit. I retested the updated PR branch (7697de1bc7f9c61457f3e71035a939882a3b2681) on my side.

Minimal repro project:

Result:

uloop compile --force-recompile false --wait-for-domain-reload true
=> ErrorCount=0, WarningCount=0

uloop screenshot --capture-mode rendering --annotate-elements true --elements-only true
=> UloopReproOverlayButton at SimX=678, SimY=913

uloop simulate-mouse-ui --action Click --x 678 --y 913
=> HitGameObjectName=UloopReproOverlayButton

The repro button click count changed from 0 to 1, and Unity logged:

[UloopRaycastRepro] UloopReproOverlayButton clicked count=1

I also retested the original downstream failing setup by temporarily pointing that project to the same updated PR branch. In that setup, a lower-priority full-screen UI mask is present behind a front ScreenSpace-Overlay button while a guided overlay is active.

Result there:

  • compile passed with ErrorCount=0, WarningCount=0
  • annotation found the intended front overlay button coordinate
  • simulate-mouse-ui clicked the intended front button instead of the lower-priority mask
  • the front modal dismissed and the flow continued

So the updated PR branch fixes both the saved minimal UI-vs-UI repro and the original downstream scenario in my environment.

Avoid fetching fork PR head branches from the base repository when the TypeScript server bundle workflow runs. Same-repository PRs can still auto-commit rebuilt bundles, while fork PRs now verify that generated bundle files are already committed.

@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/PlayMode/SimulateMouseUiTests.cs (1)

859-859: 💤 Low value

Consider using nullable Camera type.

The eventCamera property returns null but uses the null-forgiving operator null! with a non-nullable Camera return type. This suppresses the nullability warning but is inconsistent with the actual return value.

♻️ Cleaner nullability annotation
-        public override Camera eventCamera => null!;
+        public override Camera? eventCamera => null;
🤖 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/PlayMode/SimulateMouseUiTests.cs` at line 859, The eventCamera
property override declares a non-nullable Camera return type while returning
null with the null-forgiving operator null!, which is inconsistent and masks the
actual nullability. Change the return type of the eventCamera property from
Camera to Camera? (nullable Camera type) to properly reflect that it returns
null, which removes the need for the null-forgiving operator and makes the code
cleaner and more consistent with its actual behavior.
🤖 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/PlayMode/SimulateMouseUiTests.cs`:
- Line 859: The eventCamera property override declares a non-nullable Camera
return type while returning null with the null-forgiving operator null!, which
is inconsistent and masks the actual nullability. Change the return type of the
eventCamera property from Camera to Camera? (nullable Camera type) to properly
reflect that it returns null, which removes the need for the null-forgiving
operator and makes the code cleaner and more consistent with its actual
behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 73abf90d-94a3-4be1-8345-da5d63f5f31e

📥 Commits

Reviewing files that changed from the base of the PR and between b23479b and bb49f3a.

📒 Files selected for processing (6)
  • .github/workflows/build-and-test.yml
  • Assets/Tests/PlayMode/SimulateMouseUiTests.cs
  • Packages/manifest.json
  • Packages/packages-lock.json
  • Packages/src/Editor/Api/McpTools/SimulateMouseUi/SimulateMouseUiTool.cs
  • Packages/src/Editor/Api/McpTools/SimulateMouseUi/UiRaycastHelper.cs
💤 Files with no reviewable changes (1)
  • Packages/src/Editor/Api/McpTools/SimulateMouseUi/SimulateMouseUiTool.cs
✅ Files skipped from review due to trivial changes (1)
  • Packages/manifest.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • Packages/src/Editor/Api/McpTools/SimulateMouseUi/UiRaycastHelper.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.

1 issue found across 1 file (changes from recent commits).

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=".github/workflows/build-and-test.yml">

<violation number="1" location=".github/workflows/build-and-test.yml:132">
P1: Fork-PR artifact verification can miss untracked bundle files: `git diff --quiet` only compares tracked files and will succeed if a previously-tracked bundle file was removed from git and regenerated by the build as an untracked file. Add a tracked-file check (e.g., `git ls-files --error-unmatch`) before `git diff --quiet` to ensure the paths are actually in git history.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

run: |
echo "Fork PR detected; skipping automatic bundle commit."
echo "Verifying built server bundle matches committed files..."
if git diff --quiet -- Packages/src/TypeScriptServer~/dist/server.bundle.js Packages/src/TypeScriptServer~/dist/server.bundle.js.map; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1: Fork-PR artifact verification can miss untracked bundle files: git diff --quiet only compares tracked files and will succeed if a previously-tracked bundle file was removed from git and regenerated by the build as an untracked file. Add a tracked-file check (e.g., git ls-files --error-unmatch) before git diff --quiet to ensure the paths are actually in git history.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/build-and-test.yml, line 132:

<comment>Fork-PR artifact verification can miss untracked bundle files: `git diff --quiet` only compares tracked files and will succeed if a previously-tracked bundle file was removed from git and regenerated by the build as an untracked file. Add a tracked-file check (e.g., `git ls-files --error-unmatch`) before `git diff --quiet` to ensure the paths are actually in git history.</comment>

<file context>
@@ -123,6 +123,20 @@ jobs:
+      run: |
+        echo "Fork PR detected; skipping automatic bundle commit."
+        echo "Verifying built server bundle matches committed files..."
+        if git diff --quiet -- Packages/src/TypeScriptServer~/dist/server.bundle.js Packages/src/TypeScriptServer~/dist/server.bundle.js.map; then
+          echo "Built server bundle is already committed."
+        else
</file context>
Suggested change
if git diff --quiet -- Packages/src/TypeScriptServer~/dist/server.bundle.js Packages/src/TypeScriptServer~/dist/server.bundle.js.map; then
# Ensure files are tracked before diffing; untracked files bypass git diff
for f in Packages/src/TypeScriptServer~/dist/server.bundle.js Packages/src/TypeScriptServer~/dist/server.bundle.js.map; do
if ! git ls-files --error-unmatch "$f" >/dev/null 2>&1; then
echo "File is not tracked in git: $f"
echo "Please commit the built server bundle files."
exit 1
fi
done
if git diff --quiet -- Packages/src/TypeScriptServer~/dist/server.bundle.js Packages/src/TypeScriptServer~/dist/server.bundle.js.map; then

@hatayama
hatayama merged commit acb40a6 into hatayama:main Jun 14, 2026
9 checks passed
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.

simulate-mouse-ui can select lower-priority raycast targets instead of frontmost UI

3 participants