Skip to content

Non-disruptive upgrade: staged install with in-process file copy#1958

Open
tyrielv wants to merge 3 commits intomicrosoft:masterfrom
tyrielv:tyrielv/streamlined-upgrade
Open

Non-disruptive upgrade: staged install with in-process file copy#1958
tyrielv wants to merge 3 commits intomicrosoft:masterfrom
tyrielv:tyrielv/streamlined-upgrade

Conversation

@tyrielv
Copy link
Copy Markdown
Contributor

@tyrielv tyrielv commented May 4, 2026

Motivation

To roll out upgrades automatically (e.g. via fleet management or scheduled tasks), the installer needs to work without disrupting active GVFS mounts. Today, upgrading requires unmounting all repos — interrupting builds, IDE indexing, and any in-progress work. This PR adds a staged upgrade mode so users can be moved to newer versions transparently.

Changes

Installer (Setup.iss)

New /STAGEIFMOUNTED=true flag for silent installs (default: false — existing behavior preserved). Interactive installs show a dialog when mounts are detected. When staging:

  1. Files are written to {app}\PendingUpgrade\ instead of replacing in-place
  2. GVFS.Service.exe is replaced directly (brief stop/start — mounts unaffected)
  3. A .ready marker is written after all files are staged (guards against partial writes from interrupted installs)

CloseApplications=no prevents Restart Manager from killing GVFS processes. The clean upgrade path now force-kills processes if unmount-all fails to clean up.

Service (PendingUpgradeHandler.cs, RequestHandler.cs)

Completes the staged upgrade when no mounts are running:

  • On service start: checks before automount
  • After unmount: timer-based debounce (5s) fires once after the last repo unmounts

The upgrade uses atomic File.Move in two phases:

  1. Back up old files to PreviousVersion\ (with .phase1-complete marker for crash recovery)
  2. Move staged files to install dir

Safety: defers if GVFS.Mount processes are still running. Rejects PendingUpgrade without .ready marker. Crash mid-Phase-1 restores backed-up files and retries.

CI (upgrade-tests.yaml)

Five test scenarios: staging upgrade, clean upgrade, double staging, staging-then-clean, and mount safety deferral.

@tyrielv tyrielv force-pushed the tyrielv/streamlined-upgrade branch 13 times, most recently from 3118ffa to 0c938a7 Compare May 6, 2026 19:13
@tyrielv tyrielv marked this pull request as ready for review May 6, 2026 19:27
@tyrielv tyrielv requested a review from KeithIsSleeping May 6, 2026 19:27
Comment thread GVFS/GVFS.Installers/Setup.iss Outdated
Comment thread GVFS/GVFS.Installers/Setup.iss
Comment thread .github/workflows/upgrade-tests.yaml Outdated
Comment thread .github/workflows/upgrade-tests.yaml
Comment thread .github/workflows/upgrade-tests.yaml Outdated
@tyrielv tyrielv force-pushed the tyrielv/streamlined-upgrade branch from 0c938a7 to 2322165 Compare May 6, 2026 20:17
tyrielv added 3 commits May 6, 2026 13:47
Add staged upgrade mode to the installer, activated by /KEEPMOUNTED=true
in silent installs or via dialog in interactive mode. Without this flag,
the installer behaves as before.

When staging:
- Most files go to {app}\PendingUpgrade\ instead of replacing in-place
- GVFS.Service.exe is replaced directly (brief stop/start)
- Mount processes continue running on old binaries throughout
- .ready marker written after all files staged (guards against partial)

When not staging (clean upgrade):
- CloseApplications=no prevents Restart Manager from killing processes
- Force-kill GVFS processes if unmount-all fails to clean up
- WaitForServiceProcessToExit polls sc query after sc stop/delete

Assisted-by: Claude Opus 4.6
Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
Add PendingUpgradeHandler to apply staged upgrades using atomic file
moves (old files to PreviousVersion, staged files to install dir).
Skips GVFS.Service.exe (already replaced by installer, locked by
running service).

Safety mechanisms:
- .ready marker: rejects PendingUpgrade if installer was interrupted
- .phase1-complete marker: ensures crash during backup is recoverable
  (incomplete Phase 1 is restored and retried, not skipped)
- Defers if any GVFS.Mount processes are still running

Trigger upgrade in two ways:
- On service start: checks before automount
- After repo unmount: timer-based debounce (5s) so multiple unmounts
  in quick succession result in a single upgrade attempt

Assisted-by: Claude Opus 4.6
Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
Add upgrade-tests.yaml with matrix of 5 scenarios:
- staging-upgrade: LKG -> mount -> stage -> unmount -> verify completion
- clean-upgrade: LKG -> mount -> clean install -> verify
- double-staging: stage twice, verify second overwrites first
- staging-then-clean: stage then clean install removes PendingUpgrade
- mount-safety-deferral: verify upgrade defers while mount is running

Wire into build.yaml as a required check alongside functional tests.

Assisted-by: Claude Opus 4.6
Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
@tyrielv tyrielv force-pushed the tyrielv/streamlined-upgrade branch from 2322165 to 7dc96b3 Compare May 6, 2026 20:48
@tyrielv tyrielv enabled auto-merge May 6, 2026 21:28
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.

2 participants