Repository navigation
fix(dashboard,desktop): align non-macOS titlebar and prevent silent single-instance downgrade - #447
Conversation
…ingle-instance downgrade
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Summary
Fixes two Windows desktop polish and upgrade issues in one PR:
1. Non-macOS titlebar alignment (
packages/dashboard/ui)windowChromeOptions()only enablestitleBarStyle: 'hiddenInset'ondarwin(Windows/Linux use the native OS title bar), butTitleBarunconditionally rendered the 74 px.lightsspacer and-webkit-app-region: dragon every OS, pushing the sidebar toggle button 80 px right.packages/dashboard/ui/src/lib/platform.ts(isMacPlatform/hasInsetTrafficLights, zero regexes, HappyDOM-deterministic).TitleBarrenders.lights,data-inset-lights, and⌘only when inset traffic lights are active; on Windows/Linux it omits.lights, showsCtrl K, and usespadding-inline: 12pxso the 16 pxPanelLefticon sits at[18px, 34px](center26px) — pixel-aligned with sidebar icons in expanded, rail, and narrow modes.-webkit-app-region: dragandWindowDragStrip's78pxleft inset to[data-inset-lights]while keeping.dragStripmounted soonboarding.tsx'sgrid-rows-[40px_minmax(0,1fr)_auto]layout stays intact.2. Windows upgrade & single-instance silent downgrade (
packages/desktop)v0.0.24,mlx-node.exeinDownloads) stayed running in the tray holding%APPDATA%\mlx-node\lockfile. Installingv0.0.26(Portato.exe) only checked$INSTDIR\Portato.exe, missed the running legacy copy, and on launchPortato.exelostrequestSingleInstanceLock(), focused0.0.24, and silently exited.packages/desktop/scripts/windows-nsis.ts):StopOtherStandaloneAppbeforeStopRunningApp install, using session-scopedPS_CHECK_OTHER_STANDALONE_SCRIPT(excludes$INSTDIRand*\WindowsApps\*, verifies siblingresources\app\package.json, 900 chars < 924 NSIS limit)./Ssilent mode; in interactive mode prompts withMB_RETRYCANCELto quit the other copy cleanly from the system tray (no force-kill of external copies). Uninstall remains strictly$INSTDIR-only.packages/desktop/src/main/single-instance.ts,index.ts,launch-visibility.ts,broker.ts):SingleInstancePayload(protocol: 1) torequestSingleInstanceLock()and writes a per-ownerinstance-<pid>-<startedAt>.jsoninuserData(kept on disk untilapp.releaseSingleInstanceLock()inwill-quit/relaunch, then only its own unique file is unlinked).requestSingleInstanceLockonce; if still held by a pre-fix (<= 0.0.26) copy, isolatesuserDatato a temp dir beforewhenReady(), enriches withdetectLegacyRunningVersionfrom~/.mlx-node/ledger, and displays a clear warning instead of silently exiting.second-instancefrom a different executable: validates asynchronously off the main thread (realpath, 64 KiB boundedpackage.jsonmanifest read, 1.5 s deadline, single-flight +pendingHandoffProbeswired toexitBlocked), derives version strictly from on-diskpackage.json, declines competing handoff if macOS Squirrel already has a staged update (updates.status() === 'ready'), prompts with safedefaultId: 0(Keep current) showingLocation, re-validates exact target identity (execPath,version,size,mtimeMs) before quit, and hands off viaapp.relaunch({ execPath, args: [] }).Scope Notes
Authenticode/codesign) and custom post-exit relauncher helpers are intentionally out of scope so unsigned local/CI builds and Linux.debstay supported via Electron's standardapp.relaunch({ execPath }).Test Plan
tsc -b(full workspace) — passvp build packages/dashboard/ui --config packages/dashboard/ui/vite.config.ts— passvp lint packages/desktop packages/dashboard— 0 warnings, 0 errors (913 files)vp fmt --checkon all 16 modified/added files — passvp testacross 11 suites (243/243passed):packages/dashboard/__test__/{title-bar,shell,middle-text,no-regex,onboarding}.test.tspackages/desktop/__test__/{windows-nsis,single-instance,launch-visibility,app-name,broker,quit}.test.ts(including live Windows PowerShell 5.1 verification of the embeddedStopOtherStandaloneAppcommand)