Skip to content

feat: let the standalone exe replace itself when it updates - #955

Merged
EVWorth merged 5 commits into
devfrom
feat/portable-exe-self-update
Nov 8, 2026
Merged

EVWorth merged 5 commits into
devfrom
feat/portable-exe-self-update

Conversation

@EVWorth

@EVWorth EVWorth commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

The standalone SQLPilot.exe now replaces itself when it updates, instead of running an installer. This hasn't run on Windows yet, so please don't merge #950 until the checks below pass.

Why

The updater plugin can only run an installer. Used by the standalone exe, that adds a second, installed copy and leaves the user's own file on the old version.

What changed

  • Detection: a new Portable install type. On Windows, a release build with no installer stamp (bundle_type() returns None) is standalone. The bundler stamps the binary for each installer, then restores it, so the published copy carries no stamp. Debug builds never count as standalone.
  • Download: download_portable_update uses the plugin's Update::download, which verifies the minisign signature, and stages the bytes next to the exe. A folder it can't write to is reported with what to do next, with no fallback to the installer.
  • Swap: apply_portable_update runs at "Restart to finish update", after the existing checks for running queries and unsaved tabs. It renames the running exe to .old, moves the new file into place, starts it and exits. If the second rename fails, the first is undone. The next launch deletes the old file.
  • Release: the Windows job signs SQLPilot.exe and uploads the .sig, and latest.json gains windows-x86_64-portable. The release fails if the exe carries an installer stamp.

Both commands refuse to run on any copy that isn't standalone. No new dependency: I dropped self-replace, since its main job is deleting the old file while still running, and the next launch can do that.

Also in this PR

cargo Audit runs here because this PR changes Cargo.lock, and it failed on RUSTSEC-2026-0429 in zip. So this PR also moves tauri-plugin-updater to 2.14.1 and tauri-plugin-shell to 2.6.0 (the bumps from #951), which takes zip from 4.6.1 to 9.2.1. That patches RUSTSEC-2026-0429, -0367, -0368 and -0369, and the three zip entries come out of KNOWN_ACCEPTED.

zip is held at 9.2.1 because the 9.4.2 in #951 was published on 2026-11-07, inside the seven-day rule.

Closes #760.

Upgrade path

Copies already released keep their old update code. They ignore the new manifest key and update through the installer once, and after that they're installed copies. People on those copies need to download SQLPilot.exe again to get this behaviour.

Testing

  • On Windows, in CI: the Test Windows job has a copy of the test binary rename itself while running, put the new file in place, restart from the original path and delete the old file (mas-update/tests/self_swap.rs). It also compiles the app for Windows.
  • Real installers, in CI: windows-bundle-check.yml builds NSIS and MSI and checks that installed copies are stamped and the published exe is not.
  • On Linux, in CI and locally: Clippy, cargo fmt, Rust unit tests, type-check, ESLint, Vitest, the manifest script tests, check-documented-commands, check-action-pins and dprint.

tauri signer sign was run with a throwaway key and produced the expected format, but no updater has verified one of its signatures.

This PR also replaces cache-apt-pkgs-action in Lint (Rust), which saved an empty cache after a failed install and broke the job on dev.

Still needs a person on Windows

  • Click through a real update in the app, using a release exe with a lower version and a local latest.json
  • A read-only folder shows the error, and no installer runs
  • Antivirus and SmartScreen don't interfere

A real update can't happen until v1.5.0 updates to the following release.

🤖 Generated with Claude Code

EVWorth and others added 5 commits November 8, 2026 14:48
The updater plugin can only run an installer. Used by the standalone
SQLPilot.exe, that left the user's file on the old version and added a
second, installed copy.

A standalone copy now downloads the new exe through the plugin, which
verifies its signature, and stages it beside itself. On restart it renames
itself aside, moves the new file into place, starts it and exits. The next
launch removes the old file. A failed swap puts the old exe back. A folder
it cannot write to is reported rather than falling back to an installer.

A copy counts as standalone when no installer stamped its binary. The
release now signs SQLPilot.exe, publishes a windows-x86_64-portable entry
in latest.json, and fails if the exe carries a stamp.

Copies from before this keep updating through the installer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
cache-apt-pkgs-action hit 404s on dev's first run and still reported
success, saving an empty cache under the real key. Every later Lint (Rust)
run hit that cache, installed nothing and failed in clippy on a missing
glib-2.0.

Install the packages the way Test Rust already does, with apt-get update
first, so a failed install fails its own step and cannot be cached.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI only ran on Linux, so nothing proved what the self-update depends on: that
a running exe can be renamed on Windows, that the new one starts from the same
path, and that the old file can then be deleted.

Move the file handling into mas-update, which has no Tauri, and add a test
where a copy of the test binary really replaces itself and restarts. A new
Test Windows job runs it and also compiles the app for Windows, which closes
the gap where a dependency bump first met Windows in the release build.

A new workflow builds the real NSIS and MSI installers and checks that
installed copies carry a stamp and the published exe does not.

The test also found that a staged file was not executable on Unix, so stage
now copies the old file's permissions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Bumps the tauri group with 2 updates: [@tauri-apps/plugin-shell](https://github.com/tauri-apps/plugins-workspace) and [@tauri-apps/plugin-updater](https://github.com/tauri-apps/plugins-workspace).


Updates `@tauri-apps/plugin-shell` from 2.5.0 to 2.6.0
- [Release notes](https://github.com/tauri-apps/plugins-workspace/releases)
- [Commits](tauri-apps/plugins-workspace@fs-v2.5.0...fs-v2.6.0)

Updates `@tauri-apps/plugin-updater` from 2.14.0 to 2.14.1
- [Release notes](https://github.com/tauri-apps/plugins-workspace/releases)
- [Commits](tauri-apps/plugins-workspace@updater-v2.14.0...updater-v2.14.1)
chore(deps): bump the tauri group in /src-tauri with 2 updates

Bumps the tauri group in /src-tauri with 2 updates: [tauri-plugin-shell](https://github.com/tauri-apps/plugins-workspace) and [tauri-plugin-updater](https://github.com/tauri-apps/plugins-workspace).


Updates `tauri-plugin-shell` from 2.5.0 to 2.6.0
- [Release notes](https://github.com/tauri-apps/plugins-workspace/releases)
- [Commits](tauri-apps/plugins-workspace@fs-v2.5.0...fs-v2.6.0)

Updates `tauri-plugin-updater` from 2.14.0 to 2.14.1
- [Release notes](https://github.com/tauri-apps/plugins-workspace/releases)
- [Commits](tauri-apps/plugins-workspace@updater-v2.14.0...updater-v2.14.1)

---
updated-dependencies:
- dependency-name: "@tauri-apps/plugin-shell"
  dependency-version: 2.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: tauri
- dependency-name: "@tauri-apps/plugin-updater"
  dependency-version: 2.14.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: tauri
- dependency-name: tauri-plugin-shell
  dependency-version: 2.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: tauri
- dependency-name: tauri-plugin-updater
  dependency-version: 2.14.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: tauri
...

Signed-off-by: dependabot[bot] <[email protected]>
cargo Audit was failing on RUSTSEC-2026-0429, a zip 4.x denial of service
reached through tauri-plugin-updater. Version 2.14.1 of the plugin moves to
zip 9, which also patches the three older zip advisories accepted in
KNOWN_ACCEPTED, so all four are fixed and the exceptions can go.

zip is held at 9.2.1 rather than the 9.4.2 Dependabot's lockfile chose,
because that was published a day ago and the repo waits seven days.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@EVWorth
EVWorth merged commit 3aec091 into dev Nov 8, 2026
18 checks passed
@EVWorth
EVWorth deleted the feat/portable-exe-self-update branch November 8, 2026 21:57
@github-actions github-actions Bot mentioned this pull request Nov 8, 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.

chore(deps): drop the zip advisories from KNOWN_ACCEPTED once tauri-plugin-updater moves to zip ≥ 9

1 participant