Skip to content

fix(desktop): onboarding wizard preload + install verbosity#357

Merged
Weegy merged 1 commit into
mainfrom
fix/desktop-onboarding-wizard
Jun 22, 2026
Merged

fix(desktop): onboarding wizard preload + install verbosity#357
Weegy merged 1 commit into
mainfrom
fix/desktop-onboarding-wizard

Conversation

@Weegy

@Weegy Weegy commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

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)

  1. Key Test stuck on "Testing…" forever.
  2. Data-folder picker never opens.
  3. Setup does not continue after that.

Root cause (one bug)

The BrowserWindow runs with sandbox: true, but tsc emitted a preload doing 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 rejected with no catch → it hung. macOS never hit it because the boot tests pre-seeded setup.json and skipped the wizard entirely.

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. (Adds an esbuild devDep + a build step.)
  • Renderer hardening: every bridge call (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.
  • Install verbosity (requested): kernel / web-ui / Postgres output all funnel through log, so an onLog tap mirrors lines to the wizard + loading UI via a new gated bootLog IPC 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:

window.omadia  = object        (was undefined → the whole bug)
testLlmKey     = function
chooseDataDir  = function
onBootLog      = function
testLlmKey round-trip = RESOLVED {"ok":false,"error":"Key was rejected (unauthorized)."}

The key test now resolves through the full IPC→main→fetch cycle instead of hanging; chooseDataDir / complete use 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.

…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.
@Weegy Weegy merged commit bdb1cd9 into main Jun 22, 2026
5 checks passed
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