Skip to content

feat: report patches discarded by the Play-entry domain reload in hot-reload status - #2374

Merged
hatayama merged 2 commits into
v3-betafrom
feat/hot-reload-status-domain-reload-drop
Aug 23, 2026
Merged

feat: report patches discarded by the Play-entry domain reload in hot-reload status#2374
hatayama merged 2 commits into
v3-betafrom
feat/hot-reload-status-domain-reload-drop

Conversation

@hatayama

@hatayama hatayama commented Aug 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • After Play Mode starts with a domain reload, uloop hot-reload --status now explains leftover patches that were discarded instead of only reporting an active count of zero.
  • Remaining unrecovered identities are exposed as DroppedByPlayModeEntryCount when the count is greater than zero.

User Impact

  • Before: Play-entry domain reload wiped in-memory patches, and --status only said how many changes were currently active. Discarded edits that were never compiled looked like they were simply gone.
  • After: --status names the leftover count and tells the agent to re-apply uloop hot-reload or compile the files. A later successful apply removes only recovered identities; a failed compile keeps the leftover record.

Changes

  • Record active method identities in SessionState on ExitingEditMode when domain reload is enabled and at least one identity is active. Compile-caused reloads are not recorded.
  • Clear rules: apply removes only that run's Patched / Added identities; --revert-all clears all; a successful compile clears all; a failed compile keeps the record; --status does not clear.
  • --status replaces Message with the Play-entry discard sentence only when the active count is 0 and leftovers remain.
  • Go CLI does not remarsal hot-reload status fields; the new count is a C# response field only.

Verification

  • scripts/check-file-length.sh: no files exceeded the 500 SLOC limit.
  • dist/darwin-arm64/uloop compile --project-path "<PROJECT_ROOT>": Success, ErrorCount 0.
  • Filter HotReloadPlayModeEntryDrop|HotReloadToolTests: TestCount 51, Passed 51, Failed 0.
  • Full EditMode: TestCount 3407, Passed 3399, Failed 0, Skipped 8 (suite Status=Skipped because of those skips).

Device repro (this Editor had Enter Play Mode Options = DisableDomainReload; domain reload was enabled only for this sequence, then restored):

  1. Hot-reload an uncompiled method-body edit (HotReloadCoreFixture.ReplaceableCompute).
  2. --status showed ActivePatchTotal: 1 and no DroppedByPlayModeEntryCount.
  3. uloop control-play-mode --action Play with domain reload enabled. Warning included: Entering Play Mode triggers a domain reload that will discard 1 active hot-reload change(s).
  4. --status after Play:
{
  "Methods": [],
  "Warnings": [],
  "PatchedTotal": 0,
  "ActivePatchTotal": 0,
  "UnchangedTotal": 0,
  "ClearedCount": 0,
  "AddedFields": [],
  "Message": "0 change(s) currently active. 1 change(s) were discarded by the domain reload when Play Mode was entered — hot-reloaded edits that were never compiled are not in effect. Re-apply 'uloop hot-reload', or edit the files and run 'uloop compile'.",
  "DroppedByPlayModeEntryCount": 1,
  "Success": true
}

Review in cubic

After Play starts with domain reload, in-memory patches disappear
and --status only reported the active count. Persist discarded
method identities in SessionState so leftover unrecovered patches
stay visible, and keep that record across a failed compile.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f1ea6c1d-973e-40fe-ac54-5d22f6478856

📥 Commits

Reviewing files that changed from the base of the PR and between e10bcb7 and dfe44e1.

⛔ Files ignored due to path filters (1)
  • Assets/Tests/Editor/HotReload/HotReloadPlayModeEntryDropLedgerSessionScope.cs.meta is excluded by none and included by none
📒 Files selected for processing (9)
  • .agents/skills/uloop-hot-reload/SKILL.md
  • .claude/skills/uloop-hot-reload/SKILL.md
  • Assets/Tests/Editor/HotReload/HotReloadPlayModeEntryDropLedgerSessionScope.cs
  • Assets/Tests/Editor/HotReload/HotReloadPlayModeEntryDropLedgerTests.cs
  • Assets/Tests/Editor/HotReload/HotReloadPlayModeEntryDropRecorderTests.cs
  • Assets/Tests/Editor/HotReload/HotReloadPlayModeEntryDropStatusTests.cs
  • Assets/Tests/Editor/HotReload/HotReloadToolTests.cs
  • Packages/src/Editor/FirstPartyTools/HotReload/HotReloadPlayModeEntryDropRecorder.cs
  • Packages/src/Editor/FirstPartyTools/HotReload/Skill/SKILL.md

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


📝 Walkthrough

Walkthrough

Changes

The change tracks hot-reload identities discarded during Play Mode entry. It persists ledger data in SessionState, updates it during compilation and recovery, and reports dropped counts and messages through status responses.

Play Mode entry drop tracking

Layer / File(s) Summary
Drop identity ledger
Packages/src/Editor/FirstPartyTools/HotReload/HotReloadConstants.cs, Packages/src/Editor/FirstPartyTools/HotReload/HotReloadPlayModeEntryDropLedger.cs, Assets/Tests/Editor/HotReload/HotReloadPlayModeEntryDropLedgerTests.cs, Assets/Tests/Editor/HotReload/HotReloadPlayModeEntryDropLedgerSessionScope.cs
Adds the SessionState key and implements recording, removal, sorting, counting, serialization, clearing, and isolated test state restoration.
Play Mode and compilation recording
Packages/src/Editor/FirstPartyTools/HotReload/HotReloadPlayModeEntryDropRecorder.cs, Packages/src/Editor/FirstPartyTools/HotReload/HotReloadEditorStartup.cs, Assets/Tests/Editor/HotReload/HotReloadPlayModeEntryDropRecorderTests.cs
Initializes lifecycle event handling, records eligible identities, retains drops after compilation errors, and removes recovered or reverted identities.
Status response integration
Packages/src/Editor/FirstPartyTools/HotReload/HotReloadPlayModeEntryDropStatusMessageBuilder.cs, Packages/src/Editor/FirstPartyTools/HotReload/HotReloadTools.cs, Assets/Tests/Editor/HotReload/HotReloadPlayModeEntryDropStatusMessageBuilderTests.cs, Assets/Tests/Editor/HotReload/HotReloadPlayModeEntryDropStatusTests.cs, Assets/Tests/Editor/HotReload/HotReloadToolTests.cs, .agents/skills/uloop-hot-reload/SKILL.md, .claude/skills/uloop-hot-reload/SKILL.md, Packages/src/Editor/FirstPartyTools/HotReload/Skill/SKILL.md
Adds the drop-status message, conditionally serializes the dropped count, connects apply, revert-all, and status flows to the ledger, and documents the output field.

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

Merge Risk: ⚪ Minimal · up to dfe44

The change improves hot-reload status reporting for edits discarded when Play Mode triggers a domain reload. No actionable merge-blocking risk remains after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant UnityEditor
  participant HotReloadPlayModeEntryDropRecorder
  participant HotReloadPlayModeEntryDropLedger
  participant HotReloadTools
  UnityEditor->>HotReloadPlayModeEntryDropRecorder: Enter Play Mode
  HotReloadPlayModeEntryDropRecorder->>HotReloadPlayModeEntryDropLedger: Record dropped identities
  HotReloadTools->>HotReloadPlayModeEntryDropLedger: Read dropped count
  HotReloadTools->>HotReloadTools: Build status message and response
  HotReloadTools->>HotReloadPlayModeEntryDropRecorder: Notify apply or revert-all
  HotReloadPlayModeEntryDropRecorder->>HotReloadPlayModeEntryDropLedger: Remove recovered identities or clear all
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the discarded-patch reporting behavior, cleanup rules, user impact, and verification results.
Title check ✅ Passed The title clearly and concisely identifies the main change: reporting patches discarded by the Play-entry domain reload.
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
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/hot-reload-status-domain-reload-drop

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.

A cancelled Play start never reloads, so the ExitingEditMode record
must be removed when the next playModeStateChanged arrives in the
same domain. Tests snapshot the live ledger key so EditMode runs
do not wipe a developer's leftover identities.

Co-authored-by: Cursor <cursoragent@cursor.com>
@hatayama
hatayama merged commit 8e51087 into v3-beta Aug 23, 2026
14 checks passed
@hatayama
hatayama deleted the feat/hot-reload-status-domain-reload-drop branch August 23, 2026 15:35
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