fix(app): installer removes only its own files and stops on failed steps

- installer.sh lists every packaged file for the uninstaller, and folders
  are removed only when empty, so a chosen folder keeps other files.
- A virtual monitor driver removal that fails stops the uninstall with
  everything kept (silent exit code 4); the elevated half exits 2 when
  there is no driver of ours to remove, which the uninstaller accepts.
- WebView2 is installed before any file is copied; when it is still
  missing the installer asks to retry, or silently stops with code 3
  without installing or starting anything.
- The installer holds Global\JarvisBotSetup while it runs; jarvis.exe
  started meanwhile shows a message and exits before any window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-14 11:26:28 +09:00
parent 5ce832f51a
commit 1ae2521d58
7 changed files with 192 additions and 33 deletions

View File

@@ -302,7 +302,9 @@ the browser runs headless with a note.
devices, whatever their class (a device whose driver was declined has none).
The settings: one monitor, one mode (1280x720 at 30 Hz), no custom EDID. When another program's
copy of the same driver is installed (its `VDDPATH` is not ours) the app refuses to install or
remove and never touches its monitors. Uninstall removes the device, then the driver package (one
remove and never touches its monitors; the elevated half asked to remove a driver that is not
ours (another program's, or none) does nothing and exits with code 2, which the app and the
uninstaller take as nothing to remove. Uninstall removes the device, then the driver package (one
not in the driver store counts as gone), and only then the registry key, which makes it ours, and
the settings folder; when a device or the package stays, it fails with the reason and keeps the
registry key, so a retry is still allowed.
@@ -576,14 +578,23 @@ come with the first-run wizard into the data folder, which the installer never t
asks the SignPath question once; a failure says it can be installed later from the features
screen). Shortcuts are for every user of the PC.
- The WebView2 runtime is installed with Microsoft's bootstrapper (inside the installer) only when
the PC has none.
- Before installing or removing, the installer waits for `jarvis.exe` to close: it asks with a
retry, or silently waits up to 60 s (an update closes the app itself), then gives up.
the PC has none, before any file is copied. When it is still missing afterwards the installer
asks to retry or cancel; silently it stops with exit code 3, nothing installed and nothing
started.
- While it installs, updates or removes, the installer holds the named mutex
`Global\JarvisBotSetup` (`setup_lock.rs`); `jarvis.exe` started meanwhile says so in a message
box and exits (code 3) before any window or service. Before copying or removing, the installer
also waits for `jarvis.exe` to close: it asks with a retry, or silently waits up to 60 s (an
update closes the app itself), then gives up.
- `/S` installs silently with the default components; `/S /RUN` starts the app again afterwards
(the app's updates). The uninstall entry has the version, size and a quiet uninstall string.
- Uninstall: the driver goes too when this app installed it (the elevated half refuses another
program's copy), then only what the installer put there (a folder the person chose may hold
other things), the shortcuts and the registry keys. The data folder stays.
- Uninstall: the driver goes first when this app installed it (`--display-driver uninstall`:
0 removed, 2 nothing of ours to remove; the elevated half refuses another program's copy). Any
other result stops the uninstall with everything kept, so it can be run again (silently exit
code 4). Then only what the installer put there goes: `installer.sh` lists every file of
`python-src/` and `display-driver/` for the uninstaller (`uninstall-list.nsh`) and folders are
removed only when empty, so a folder the person chose keeps its other things. Then the
shortcuts and the registry keys. The data folder stays.
## Tests
@@ -656,5 +667,10 @@ entries, non-ASCII paths, the person's lists first, staying on until the game en
detection off) and its settings. A removal forgets the driver only when no device is left and the package
is gone or was not in the store; a failed install forgets it only under the same rule (and never
when it was ours before), reporting both reasons otherwise; a leftover offers removal; driver tasks refused while the services start, and a start (and a
second task) refused while one runs, also after it failed. On Linux the same window test runs on an X display (one window at the given place and
second task) refused while one runs, also after it failed; removing a driver that is not ours says
there is nothing to remove. The installer (by hand on a Windows VM): installing into a folder that
holds other files and uninstalling keeps them; a driver removal that fails stops the uninstall with
the files and entry kept, and nothing to remove lets it finish; with no WebView2 and its installer
failing nothing is installed or started; with the lock held the app shows its message and exits
after OK, and starts normally once released. On Linux the same window test runs on an X display (one window at the given place and
size, the bot's tab in it).