Skip to content

feat: Warn on Play Mode compiles with active pause points - #1895

Merged
hatayama merged 2 commits into
feature/pause-point-round4-integrationfrom
feat/pause-point-callback-and-compile-warnings
Jul 20, 2026
Merged

hatayama merged 2 commits into
feature/pause-point-round4-integrationfrom
feat/pause-point-callback-and-compile-warnings

Conversation

@hatayama

@hatayama hatayama commented Jul 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • uloop compile now warns when it compiles while Play Mode is active and pause points are still enabled, since the domain reload that follows discards both the Play session state and every pause-point patch.
  • Verified the existing physical/message-callback pause-point warning (OnCollisionEnter, OnTriggerEnter, etc.) already covers this case fully — no new implementation was needed there.

User Impact

  • Before: compiling during Play Mode silently dropped the Play session and any enabled pause points, with no indication anything was lost. Users only noticed later when a pause point stopped firing.
  • After: the compile response includes a Warning field naming how many pause points were active and explaining that they need to be re-enabled after the compile completes.

Changes

  • CompileResponse gains an additive Warning: string field.
  • CompileUseCase captures whether Play Mode was active and the number of enabled pause points before Play Mode gets stopped for compilation, then attaches the warning text on the path where compilation actually runs.
  • UloopPausePointRegistry gains GetActiveCount().
  • Compile.Editor is wired to the PausePoints runtime assembly using the same InternalsVisibleTo + asmdef-reference pattern already used by several other first-party tool assemblies.
  • The warning-decision logic lives in a small pure CompilePausePointWarningBuilder, unit-tested directly (avoids needing a real Play Mode session inside an EditMode test).
  • Shared compile_status_response_contract.json fixture updated additively for the new field; both the C# and Go contract tests were re-verified.

Verification

  • dist/darwin-arm64/uloop compile --project-path <repo> → 0 errors / 0 warnings.
  • dist/darwin-arm64/uloop run-tests --filter-type all → 2240/2250 passed, 3 pre-existing failures unrelated to this change (dispatcher pin version drift, an unrelated schema-attribute test), 7 skipped.
  • cd cli/project-runner && go test ./internal/projectrunner/... -run TestCompileStatusResponseMatchesSharedContract → pass.
  • sh scripts/check-go-cli.sh → all Go modules pass (format, vet, lint, tests, build).

Review in cubic

…ause points

Compiling while Play Mode is active stops Play Mode and triggers a
domain reload, silently discarding both the Play session state and
every enabled pause-point Harmony patch. Users had no signal this
happened until they noticed their pause points stopped firing.

CompileUseCase now captures whether Play Mode was active and how many
pause points were enabled before the PlayMode-stop step mutates that
state, and surfaces a Warning on the compile response describing the
loss. UloopPausePointRegistry gains GetActiveCount(); Compile.Editor
is wired to it via the same InternalsVisibleTo + asmdef-reference
pattern already used by PausePoint.Editor, RunTests.Editor, and other
consumers. The decision logic itself lives in a pure
CompilePausePointWarningBuilder, unit-tested directly to avoid needing
a real Play Mode session in an EditMode test.

Also verified the physical/message-callback pause-point warning
(OnCollisionEnter, OnTriggerEnter, etc.) is already fully implemented
and test-covered from a prior PR; no new code was needed there.
@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Compilation now captures Play Mode pause-point state, builds an optional warning, propagates it through compilation and result persistence, exposes it in CompileResponse.Warning, and updates editor callers, contracts, and tests.

Changes

Compile pause-point warning flow

Layer / File(s) Summary
Warning inputs and construction
Packages/src/Runtime/PausePoints/*, Packages/src/Editor/FirstPartyTools/Compile/CompilePausePointWarningBuilder.cs, Assets/Tests/Editor/CompilePausePointWarningBuilderTests.cs
The pause-point registry counts enabled entries, and CompilePausePointWarningBuilder returns warning text only when Play Mode and active pause points were present at request start.
Response and persistence contracts
Packages/src/Editor/FirstPartyTools/Compile/CompileResponse.cs, CompileResponseFactory.cs, CompileResultSessionRecorder.cs, Assets/Tests/Editor/CompileResponseFactoryTests.cs, Assets/Tests/Editor/CompileSessionResultStoreTests.cs, tests/contracts/compile_status_response_contract.json
CompileResponse.Warning is populated across normal, forced, and indeterminate results and included in recorded JSON responses.
Compile warning propagation
Packages/src/Editor/FirstPartyTools/Compile/CompileUseCase.cs, CompilationExecutionService.cs, CompileController.cs
The warning is passed through execution and controller state, included in completed results, omitted on the external-scene early-return path, and cleared during finalization and cleanup.
Call-site and use-case alignment
Assets/Editor/CompileCheckWindow/*, Assets/Tests/Editor/CompileUseCaseTests.cs
Editor compile callers use the expanded controller signature, while use-case tests update the execution delegate and verify null warnings outside Play Mode.

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

Sequence Diagram(s)

sequenceDiagram
  participant CompileUseCase
  participant UloopPausePointRegistry
  participant CompilePausePointWarningBuilder
  participant CompilationExecutionService
  participant CompileController
  participant CompileResultSessionRecorder
  CompileUseCase->>UloopPausePointRegistry: Read active pause-point count
  CompileUseCase->>CompilePausePointWarningBuilder: Build pause-point warning
  CompileUseCase->>CompilationExecutionService: Execute compilation with warning
  CompilationExecutionService->>CompileController: TryCompileAsync with warning
  CompileController->>CompileResultSessionRecorder: Record result with warning
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% 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
Title check ✅ Passed The title clearly summarizes the main change: warnings on Play Mode compiles with active pause points.
Description check ✅ Passed The description matches the changeset and explains the new warning behavior, propagation, and verification.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/pause-point-callback-and-compile-warnings

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.

… polling path

CompileUseCase.CompileAsync attached the pause-point Warning only to the
CompileResponse it directly returns, but the default `uloop compile`
flow (WaitForDomainReload=true) instead polls get-compile-status, which
reads a separately constructed CompileResponse stored by
CompileController via CompileResultSessionRecorder. Thread the computed
warning string through CompilationExecutionService, CompileController,
and CompileResultSessionRecorder so both response-construction call
sites share the same value, and update the CompileController/
CompileResponseFactory call sites broken by the new required parameter.
@hatayama
hatayama merged commit 6902039 into feature/pause-point-round4-integration Jul 20, 2026
1 of 2 checks passed
@hatayama
hatayama deleted the feat/pause-point-callback-and-compile-warnings branch July 20, 2026 21:16

@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/FirstPartyTools/Compile/CompileController.cs (1)

110-145: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Move state mutation below validation and early returns.

Assigning _pendingPausePointWarning at the very beginning of the method overwrites the warning for any currently running compilation (if this instance is reused and called concurrently, as it is designed to handle gracefully by awaiting _currentCompileTask). Furthermore, if the method returns early due to a scene change validation failure, this state is never cleared by the finally block.

Move the assignment to immediately follow _isCompiling = true; to ensure it only tracks state for a successfully initiated compile task.

♻️ Proposed refactor
-            _pendingPausePointWarning = pausePointWarning;
-
             if (_isCompiling)
             {
                 // If compilation is already in progress, wait for the current task.
                 if (_currentCompileTask != null)
                 {
                     VibeLogger.LogInfo(
                         "compile_controller_wait_existing_task",
                         "Compilation is already in progress; waiting for the existing task.",
                         BuildCompileControllerStateContext(new Dictionary<string, object>
                         {
                             ["requested_force_recompile"] = forceRecompile
                         }));
                     return await _currentCompileTask.Task.ConfigureAwait(false);
                 }
                 throw new InvalidOperationException("Compilation is in progress, but the task could not be found.");
             }

             (bool CanProceed, string Message, string[] ScenePaths) sceneChangeResult =
                 ExternalSceneChangeTracker.ResolveForCompile(_reloadExternalSceneChanges);
             if (!sceneChangeResult.CanProceed)
             {
                 VibeLogger.LogWarning(
                     "compile_external_scene_change_resolution_failed",
                     sceneChangeResult.Message,
                     new
                     {
                         reload_external_scene_changes = _reloadExternalSceneChanges,
                         scene_paths = sceneChangeResult.ScenePaths
                     });
                 CompileResult result =
                     CompileResultFactory.CreateExternalSceneChangeFailureResult(sceneChangeResult);
                 RecordCompileResultIfNeeded(result, pausePointWarning: null);
                 return result;
             }

             _isCompiling = true;
+            _pendingPausePointWarning = pausePointWarning;
             _compileMessages.Clear();
🤖 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/FirstPartyTools/Compile/CompileController.cs` around
lines 110 - 145, Move the _pendingPausePointWarning assignment in the compile
method to immediately after _isCompiling is set to true. Remove the initial
assignment so concurrent calls awaiting _currentCompileTask and scene-change
validation failures do not overwrite or retain pending warning state.
🤖 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/FirstPartyTools/Compile/CompileController.cs`:
- Around line 110-145: Move the _pendingPausePointWarning assignment in the
compile method to immediately after _isCompiling is set to true. Remove the
initial assignment so concurrent calls awaiting _currentCompileTask and
scene-change validation failures do not overwrite or retain pending warning
state.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ac3052be-ace6-43bb-849e-8d7ac5d40e21

📥 Commits

Reviewing files that changed from the base of the PR and between 152a788 and 8f0bdf3.

⛔ Files ignored due to path filters (3)
  • Assets/Tests/Editor/CompilePausePointWarningBuilderTests.cs.meta is excluded by none and included by none
  • Packages/src/Editor/FirstPartyTools/Compile/CompilePausePointWarningBuilder.cs.meta is excluded by none and included by none
  • Packages/src/Editor/FirstPartyTools/Compile/UnityCLILoop.FirstPartyTools.Compile.Editor.asmdef is excluded by none and included by none
📒 Files selected for processing (16)
  • Assets/Editor/CompileCheckWindow/CompileCheckerExample.cs
  • Assets/Editor/CompileCheckWindow/CompileEditorWindow.cs
  • Assets/Tests/Editor/CompilePausePointWarningBuilderTests.cs
  • Assets/Tests/Editor/CompileResponseFactoryTests.cs
  • Assets/Tests/Editor/CompileSessionResultStoreTests.cs
  • Assets/Tests/Editor/CompileUseCaseTests.cs
  • Packages/src/Editor/FirstPartyTools/Compile/CompilationExecutionService.cs
  • Packages/src/Editor/FirstPartyTools/Compile/CompileController.cs
  • Packages/src/Editor/FirstPartyTools/Compile/CompilePausePointWarningBuilder.cs
  • Packages/src/Editor/FirstPartyTools/Compile/CompileResponse.cs
  • Packages/src/Editor/FirstPartyTools/Compile/CompileResponseFactory.cs
  • Packages/src/Editor/FirstPartyTools/Compile/CompileResultSessionRecorder.cs
  • Packages/src/Editor/FirstPartyTools/Compile/CompileUseCase.cs
  • Packages/src/Runtime/PausePoints/AssemblyInfo.cs
  • Packages/src/Runtime/PausePoints/UloopPausePointRegistry.cs
  • tests/contracts/compile_status_response_contract.json

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