feat: report patches discarded by the Play-entry domain reload in hot-reload status - #2374
Conversation
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>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (9)
Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughChangesThe change tracks hot-reload identities discarded during Play Mode entry. It persists ledger data in Play Mode entry drop tracking
Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: ⚪ Minimal · up to 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
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
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>
Summary
uloop hot-reload --statusnow explains leftover patches that were discarded instead of only reporting an active count of zero.DroppedByPlayModeEntryCountwhen the count is greater than zero.User Impact
--statusonly said how many changes were currently active. Discarded edits that were never compiled looked like they were simply gone.--statusnames the leftover count and tells the agent to re-applyuloop hot-reloador compile the files. A later successful apply removes only recovered identities; a failed compile keeps the leftover record.Changes
ExitingEditModewhen domain reload is enabled and at least one identity is active. Compile-caused reloads are not recorded.Patched/Addedidentities;--revert-allclears all; a successful compile clears all; a failed compile keeps the record;--statusdoes not clear.--statusreplaces Message with the Play-entry discard sentence only when the active count is 0 and leftovers remain.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.HotReloadPlayModeEntryDrop|HotReloadToolTests: TestCount 51, Passed 51, Failed 0.Device repro (this Editor had Enter Play Mode Options = DisableDomainReload; domain reload was enabled only for this sequence, then restored):
HotReloadCoreFixture.ReplaceableCompute).--statusshowedActivePatchTotal: 1and noDroppedByPlayModeEntryCount.uloop control-play-mode --action Playwith domain reload enabled. Warning included:Entering Play Mode triggers a domain reload that will discard 1 active hot-reload change(s).--statusafter 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 }