fix(windows): make installer upgrades version aware

This commit is contained in:
cabbage committed 2026-10-27 15:17:52 +00:00
1 parent 6906ed52f2
commit ee7844cb40
14 files changed
+824 -51

No files matched your search

+40
View File
@@ -2318,6 +2318,46 @@ equality check against `S_OK`: Explorer can return `S_FALSE` with valid icon
coordinates. A failed/cancelled installation must not start a tray; failure
to start the tray must explicitly report the already-installed service rather
than claiming complete success. No sign-out or reboot is required.
The interactive installer must inspect before mutating. Read the installed SCM
image command line with Windows argument decomposition, retaining its exact
executable and absolute config paths. Read the PE string `ProductVersion`
through `GetFileVersionInfo`/`VerQueryValue`, preserving prerelease labels; use
streamed SHA-256 equality when metadata is absent or `dev`. Never execute the
installed binary to query its version. Different release labels select the
replacement path; this is not a semantic version ordering/downgrade policy.
- Same version, running service, registered tray on this desktop: return quietly
without UAC, dialogs, file changes, or service restart.
- Same version with a missing component: start the service only if not running,
requesting UAC only on access denied; start the tray only if its icon is
missing. Wait up to 30 seconds for SCM pending states to settle/start/resume.
Do not reinstall, change Automatic/Manual, or show installation success.
- Fresh/different version: hold an ACL-protected global installer mutex in the
original parent on its locked OS thread through inspection/UAC/tray readiness.
A concurrent interactive installer returns quietly; the elevated child never
reacquires the parent's mutex. Release it before showing a result dialog.
Recheck installed identity after UAC. Validate any existing TOML with the
candidate parser before stopping the old service. Send the old current-desktop
tray `WM_CLOSE` and wait up to ten seconds for process exit, then stop SCM.
Preserve the actual installed paths and Automatic/Manual setting. Stage/fsync
the new binary beside the target and activate with `MoveFileEx` replacement
plus write-through; retry sharing/access/lock errors for at most five seconds.
Preserve a `.previous` binary before replacement. If replacement/startup fails,
stop the failed service, restore that binary, and restart the prior service
when it was running. Surface rollback errors; do not claim schema rollback or
forcibly kill unrelated processes/other sessions' trays. Preserve TOML contents
and spool/history. Remove the backup after successful service installation,
start the user tray, then show the single minimal success message.
Cover lifecycle decisions and failure short-circuiting in portable unit tests,
and SCM path preservation, actual version resources, concurrent mutex ownership,
and Win32 file replacement in native tests. Native acceptance must cover real
UAC, stopped/missing-tray activation, PID stability on a healthy same-version
launch, and upgrading an older package with existing data. When the fixture
host is offline, cross-compile these tests and explicitly leave native execution
for physical Windows/fixture testing; cross-compilation is not an acceptance pass.
Run its Win32 message pump on one locked OS thread,
recreate the icon after `TaskbarCreated`, and use bounded nonblocking IPC/UI
channels. Show a disabled `Status: ...` banner first in the context menu, with