Conversation
…ssues during startup.
hqhq1025
left a comment
There was a problem hiding this comment.
Technical GO with one non-blocking P3.
The change moves revealMode above the first storage-root await, so the repair-dialog callback can no longer close over an uninitialized const. I verified the production path with the compiled Desktop main process: an isolated Electron launch with a deliberately stale root-identity marker opens the actionable workspace-repair dialog on this head, while the exact parent exits with ReferenceError: Cannot access 'revealMode' before initialization through confirmDesktopStorageRootRepair and showDesktopMessageBox.
I also checked that the initializer depends only on values already available at this point and that no other reveal behavior changes. Validation passed: build:test, full typecheck/lint/format, ASF headers, Desktop 2,481/2,481, focused startup suites 31/31, renderer architecture 112/112, E2E budget 38, changed-file Biome, diff check, and a clean merge with current main (ea990cab7). GitHub currently exposes only the successful label check; there is no hosted test check. Native Windows/macOS startup was not exercised.
Automated review notice: This comment was posted by an automated review agent operated by hqhq1025. It is not an independent human review and does not replace one.
| // Declared before showDesktopMessageBox: storage-root repair (and any other | ||
| // pre-window dialog) can run while the rest of this module is still awaiting | ||
| // startup steps. Closing over a later `const` hits the temporal dead zone. | ||
| const revealMode = resolveWindowRevealMode( |
There was a problem hiding this comment.
[P3] Please add a regression that exercises this production ordering. The four related suites (storage-root-startup, startup-step, main-startup-lifetime, and window-reveal-mode) all pass unchanged on the exact parent, while a real Electron launch with a stale root marker still crashes there with Cannot access 'revealMode' before initialization. The current head opens the repair dialog, so the code fix works, but no checked-in test would catch moving this initializer back below the first storage-root await. A source-order assertion in main-startup-lifetime.test.ts, matching the existing ordering checks there, or an Electron startup fixture for a root-identity collision would lock the regression down.
likun666661
left a comment
There was a problem hiding this comment.
The initialization reorder directly fixes the TDZ on the early storage-root repair dialog path. All inputs to resolveWindowRevealMode are already available at the new location, and the existing reveal policy is preserved. This is a minimal, appropriate fix. Non-blocking: please add regression coverage for the production startup ordering, as noted in the existing review thread. This review is based on source and call-chain inspection; I did not independently run Electron. Review submitted by an AI assistant at the explicit request of the account owner.
Summary
Packaged Desktop can crash during startup when a storage-root identity conflict opens the repair dialog.
showDesktopMessageBoxclosed overconst revealModebefore that binding was initialized. Storage-root repair runs earlier in boot, so the dialog path hit a temporal dead zone (Cannot access 'revealMode' before initialization) and aborted startup instead of showing the repair UI.Move
revealModeaboveshowDesktopMessageBoxso early startup dialogs can use it safely. After this change, the repair dialog opens instead of crashing.Verification
Reproduced on packaged nightly. Startup failed with this diagnostic report when
[storage-root] root-identity conflicttriggered the repair dialog:Maka Desktop diagnostic report
Captured at: 2026-09-14T08:30:30.837Z
Error
Surface: startup
Title: Maka failed to start
Description: Cannot access 'revealMode' before initialization
Details:
Root cause
revealModewas declared after the first await that can raise a person-owned dialog. Anyconstclosed over by that dialog helper is still in the TDZ until execution reaches its initializer.AI use
Select exactly one:
Tool(s) and scope:
Cursor (Composer): diagnosed the TDZ from the startup diagnostic report and applied the
revealModereorder inapps/desktop/src/main/runtime-host-boot.ts.Checklist
Does this PR entail a change in behavior?