Skip to content

Harden the updater after an outside review - #16

Merged
geeooff merged 1 commit into
mainfrom
fix/updater-review
Nov 24, 2026
Merged

geeooff merged 1 commit into
mainfrom
fix/updater-review

Conversation

@geeooff

@geeooff geeooff commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Why

GameModeExecutor's session reviewed the updater, at the maintainer's request, before 1.1.0 freezes the swap script. The script a version carries is the one that installs the next, so anything wrong in it reaches every 1.1.0 user.

What

Blockers fixed

  1. The recovery can no longer abort before restoring. $ErrorActionPreference = 'Stop' applies inside catch, so a failing Set-Content result.txt used to skip the restore. Each recovery step now runs in its own try:
    1. the new file set aside;
    2. the old one put back, retried;
    3. the restart;
    4. result.txt written last.
  2. A new executable that refuses to start (antivirus, held file) is set aside, and the old one is restored and started. Before, nothing was left running.
  3. PowerShell and winget start by absolute path. Rust's std, like CreateProcess, searches the application's own folder before System32, so a powershell.exe dropped beside the exe (a Downloads folder) would have run.

Should and nice items

  • Restart now warns that the queue is cleared, with the number of videos.
  • GitHub's hourly limit (60 per IP, shared) gets its own message, with the minutes left from x-ratelimit-reset.
  • The rename into place retries for 30 s instead of 5 s. OneDrive may still be uploading the new file; Windows 11 backs up the Desktop.
  • The wait applies only while the PID is still this program (by process name), against PID reuse.
  • Close is sent once.
  • Docs:
    • the GitHub digest counts "when GitHub gives one";
    • the trade with a TLS-inspecting proxy is stated;
    • the rate limit is explained;
    • the rare two-window cases are listed as known.

Checks

  • .\scripts\build.ps1 passes: 88 unit tests (new: the script parsed by Windows PowerShell's own parser, the rate-limit answer) and 3 end-to-end tests.
  • Field, this machine (scratch folder review test [it's], a debug build as 0.9.0):
    • a normal update to the published 1.0.0 (a55a5f19…);
    • the verified download replaced by a non-program just before Restart now: Start-Process failed, the old exe was restored and restarted, the reason was shown, and no .old or .new was left.

🤖 Generated with Claude Code

Reviewed by GameModeExecutor's session before 1.1.0 freezes the swap script into every installed copy: the recovery restores first (new file set aside, old one back, retried), then restarts, and writes result.txt last, each step in its own try; a new executable that refuses to start is set aside and the old one restarted; the rename into place gets 30 s of retries for OneDrive; the wait checks the process id is still this program. PowerShell and winget are started by absolute path (Windows searches the application's folder first). GitHub's hourly limit gets its own message with the minutes to wait; Restart now warns that the queue is cleared; Close is sent once. Docs: the digest when GitHub gives one, the TLS-inspecting proxy trade, the rare cases left.

Measured: a normal update to the published 1.0.0, and a new file that refuses to start (rolled back, reason shown, nothing left behind). A test runs the script through Windows PowerShell's parser.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@geeooff
geeooff enabled auto-merge November 24, 2026 01:54
@geeooff
geeooff merged commit 9f5ef7d into main Nov 24, 2026
2 checks passed
@geeooff
geeooff deleted the fix/updater-review branch November 24, 2026 02:18
@geeooff geeooff mentioned this pull request Nov 24, 2026
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