fix(desktop): onboarding wizard preload + install verbosity#357
Merged
Conversation
…l verbosity)
The BrowserWindow runs with sandbox: true, but tsc emitted a preload that does
`require("./ipcTypes")`. A sandboxed preload only gets a limited require and
cannot load local modules, so the preload failed ("module not found: ./ipcTypes"),
`window.omadia` was never exposed, and every wizard/loading bridge call silently
failed. On Windows this surfaced as: key test stuck on "Testing…", the data-folder
picker never opening, and setup not continuing. (macOS never hit it because the
boot tests pre-seeded setup.json and skipped the wizard.)
Fix: bundle the preload into a self-contained dist/preload.js with esbuild
(electron external), so it loads under the sandbox while keeping one source of
truth for the channel names + types.
Renderer hardening so a bridge failure can never silently hang again:
- guard every bridge call (testLlmKey / chooseDataDir / exportRecoveryKey /
complete); show a clear error instead of hanging.
- the key test resets its button and surfaces any error rather than sticking on
"Testing…".
- the folder picker reports failure and falls back to the default location.
Install verbosity (requested): the kernel / web-ui / Postgres output all funnel
through `log`, so add an onLog tap that the main process mirrors to the wizard +
loading UI (new bootLog IPC channel, gated to boot only). The provisioning step
and the loading screen now show a live scrolling log plus an elapsed-time
counter, so a long first boot (migrations) visibly stays alive.
Verified on the packaged macOS .app via CDP against the actual wizard:
window.omadia is defined; testLlmKey round-trips and RESOLVES
({ ok:false, "Key was rejected (unauthorized)." }) instead of hanging;
chooseDataDir + onBootLog are present.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #355 (native installer + bundled PostgreSQL 17, already merged). Fixes the onboarding wizard, which was broken on all platforms but only surfaced when actually running the wizard on Windows.
Symptoms (reported on Windows)
Root cause (one bug)
The BrowserWindow runs with
sandbox: true, buttscemitted a preload doingrequire("./ipcTypes"). A sandboxed preload only gets a limitedrequireand cannot load local modules, so the preload failed (module not found: ./ipcTypes),window.omadiawas never exposed, and every wizard/loading bridge call silently rejected with no catch → it hung. macOS never hit it because the boot tests pre-seededsetup.jsonand skipped the wizard entirely.Fix
dist/preload.jswith esbuild (electronexternal), so it loads under the sandbox while keeping one source of truth for the channel names + types. (Adds an esbuild devDep + a build step.)testLlmKey/chooseDataDir/exportRecoveryKey/complete) is guarded and try/caught, so a bridge failure shows a clear error instead of hanging. The key test resets its button and surfaces results; the folder picker reports failure and falls back to the default location.log, so anonLogtap mirrors lines to the wizard + loading UI via a new gatedbootLogIPC channel. Both screens now show a live scrolling log plus an elapsed-time counter, so a long first boot (migrations) visibly stays alive.Verification
On the packaged macOS
.app, driven against the actual wizard via CDP:The key test now resolves through the full IPC→main→fetch cycle instead of hanging;
chooseDataDir/completeuse the same now-working bridge. The fix is platform-agnostic (sandbox preload behaves identically on Windows). All three desktop builds are green.Note: I can't run the Windows installer on the macOS dev box, so the final click-through of onboarding on Windows is still worth a manual confirmation.