Desktop: never a blank window (frozen-prototype fix, error screens, logs, state migration, boot check)

The signed release showed only its background colour and never started the sidecar. Tauri's freezePrototype
freezes Object.prototype before the bundle runs; d3-color and d3-format (under the visx charts) assign
`constructor` / `toString` on plain objects while loading, which throws on a frozen prototype, so the bundle
stopped before React drew anything. The saved state was not the cause.

- build/freeze-safe.ts: Vite plugin that rewrites those assignments in dependencies into a helper that defines
  the property when the frozen prototype would refuse it
- error boundaries for the window, each screen and each app tab (Copy details, Reload, Reset saved state with a
  backup); public/boot.js shows the same panel when the bundle fails or the window stays empty
- logs/host.log (start, saved state, sidecar start/stop, panics) and logs/webview.log (log_webview), rotated,
  home as ~, keys, tokens and e-mail addresses replaced
- state.json `version` 2 with an explicit 1 -> 2 migration (original kept as state.json.v1.bak), per-entry
  tolerant parsing, partial settings keep their fields, unreadable files kept aside
- folders that are gone: "Folder not found" with Locate... (project_locate) / Remove; portfolio reads skip them
- tools/desktop-boot-check.ts: the built window with the release CSP and the frozen prototype, a mocked host from
  the state fixtures (empty, D1 with folders gone, D3) and the real sidecar, through every screen; in bun run ci,
  the Forgejo CI workflow and the macOS release
This commit is contained in:
CRTkafa 2026-10-11 01:36:34 +00:00
parent 209b8d0559
commit 08eb314196
45 changed files with 2080 additions and 69 deletions

View file

@ -914,3 +914,14 @@ button.ck.ck-pick:focus-visible { outline: 2px solid var(--focus); outline-offse
button.ck.ck-pick[aria-checked="true"] { border-color: var(--accent-solid); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-solid) 16%, transparent); }
.studio-new { cursor: default; }
.studio-new:hover { border-color: var(--line); box-shadow: none; }
/* Error screens: React error boundaries (ui/ErrorBoundary.tsx) and the plain panel of public/boot.js when the bundle
itself failed. Kept simple: they must render when everything else did not. */
.crash { padding: 24px 28px; }
.crash-full { min-height: 100%; display: grid; place-items: center; background: var(--bg); color: var(--ink); }
.crash-box { max-width: 760px; display: grid; gap: 12px; padding: 20px 22px; border: 1px solid var(--line-2); border-left: 4px solid var(--bad-solid); border-radius: 12px; background: var(--surface); }
.crash-box h2 { margin: 0; font-size: 17px; }
.crash-box p { margin: 0; color: var(--ink-2); line-height: 1.5; }
.crash-msg, .crash-detail { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--bg-sunken); color: var(--ink); font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; }
.crash-box summary { cursor: pointer; color: var(--ink-2); font-size: 13px; }
.crash-box .actions { display: flex; gap: 8px; flex-wrap: wrap; }