Repository navigation
Installer: versioned folder layout with Current junction - #2028
Tyrie Vella (tyrielv) wants to merge 2 commits into
Conversation
15beccb to
8181c35
Compare
8181c35 to
344af6c
Compare
Replaces flat {app}\ deployment with versioned Versions\<ver>\ + Current junction.
Eliminates PendingUpgrade staging flow — new version goes to new folder, junction
swaps atomically, mounts continue running from old version until unmounted.
Changes:
- [Files]: Deploy to {app}\Versions\{version}\ instead of {app}\
- [Registry]: PATH points to {app}\Current (junction) instead of {app}\
- [Dirs]: ProgramData under versioned folder
- [Code]: Add CreateOrUpdateCurrentJunction() — creates/updates junction post-install
- [Code]: Add GarbageCollectOldVersions() — keeps 1 most recent old version, deletes older
(skips versions with running mounts detected via Get-Process gvfs.mount | .Path)
- [Code]: Remove KeepMountsRunning variable, IsNormalInstall/IsStagingInstall checks
- [Code]: Remove StagingUpdateService, ShowMountChoiceDialog (no longer needed)
- [Code]: Simplify PrepareToInstall — no mount detection, no staging, just stop service
- [Code]: Update InstallGVFSService to reference {app}\Current\GVFS.Service.exe
- [Code]: Update MountRepos, MigrateConfigAndStatusCacheFiles, WriteOnDiskVersion16CapableFile
to use Current junction paths
- CurStepChanged: Remove staging logic, call CreateOrUpdateCurrentJunction + GarbageCollectOldVersions
- CurUninstallStepChanged: Remove {app}\Current from PATH instead of {app}
Flat-layout migration stub added (detects {app}\GVFS.exe, logs version) but defers
actual file move to future PR to reduce complexity.
Assisted-by: Claude Sonnet 4.5
Signed-off-by: Tyrie Vella <[email protected]>
b21d4c5 to
6460eff
Compare
6460eff to
0ac9032
Compare
Fixes 5 critical issues in the Phase 2 versioned-layout installer:
1. Forward reference violation - Move CreateOrUpdateCurrentJunction,
GetFileVersion, IsProcessRunningFromPath, and GarbageCollectOldVersions
before CurStepChanged. Inno Setup Pascal does not allow forward refs.
2. Service starts before junction exists - Create Current junction in
CurStepChanged(ssInstall) BEFORE file extraction, ensuring the junction
exists when InstallGVFSService runs (AfterInstall callback during file
copy). Service binPath references {app}\Current\GVFS.Service.exe.
3. Old PATH entry not cleaned up - On upgrade from flat to versioned layout,
remove legacy {app} PATH entry in CurStepChanged(ssPostInstall). New
entry points to {app}\Current.
4. Non-atomic junction swap - Use Current.new temporary: create junction at
Current.new, rmdir old Current (check ResultCode), rename Current.new to
Current. Eliminates window where Current doesn't exist.
5. Add upgrade test scenarios - Add versioned-fresh-install,
versioned-upgrade, and flat-to-versioned-upgrade scenarios to
.github/workflows/upgrade-tests.yaml with full test implementations.
Assisted-by: Claude Sonnet 4.5
Signed-off-by: Tyrie Vella <[email protected]>
0ac9032 to
3dc5a38
Compare
NUnit --explore outputs [TestFixtureSource] classes as a single parameterized entry (e.g. CheckoutTests(Full)) rather than per-method entries like [TestFixture] classes produce. The greedy bucket algorithm counted each class-level entry as weight=1, so CheckoutTests (38 tests, ~16 min) landed in one slice while others had only fast tests. Detect class-level entries via regex (ends with `(Param)`, no `.Method` suffix) and expand each one by running a targeted --explore sub-pass. The individual method names are then distributed into buckets one at a time, spreading slow fixtures across slices. This is the same effective distribution that already works for [TestFixture] classes like RepairTests -- it just wasn't firing for [TestFixtureSource] classes because their entries never reached the per-method level in the outer explore pass. From PR microsoft#2028 timing data: expected critical path drops from 18.9 min (Slice 9, dominated by CheckoutTests) to ~9-11 min. Assisted-by: Claude Sonnet 4.6 Signed-off-by: Tyrie Vella <[email protected]>
The greedy bucket slicer keeps consecutive tests from the same fixture class together when they share state. The grouping regex previously included the GitCommands namespace: ^.*\.(?:EnlistmentPerFixture|MultiEnlistmentTests|GitCommands)\..+\. This caused all 38 CheckoutTests(Full) methods (~16 min) to land in one slice because NUnit --explore outputs them consecutively and the regex captured CheckoutTests(Full). as the keep-together prefix. GitCommands tests don't need this protection: [TestFixtureSource] classes with enlistmentPerTest=true create a fresh enlistment per test, and classes with enlistmentPerTest=false call git-checkout in [SetUp] to reset to a known clean state. Either way, tests are independent and safe to distribute across slices. EnlistmentPerFixture and MultiEnlistmentTests tests retain their grouping because they genuinely share state across test methods. From PR microsoft#2028 timing data: expected critical path drops from 18.9 min (slice dominated by CheckoutTests) to ~9-11 min. Assisted-by: Claude Sonnet 4.6 Signed-off-by: Tyrie Vella <[email protected]>
The greedy bucket slicer keeps consecutive tests from the same fixture class together when they share state. The grouping regex previously included the GitCommands namespace: ^.*\.(?:EnlistmentPerFixture|MultiEnlistmentTests|GitCommands)\..+\. This caused all 38 CheckoutTests(Full) methods (~16 min) to land in one slice because NUnit --explore outputs them consecutively and the regex captured CheckoutTests(Full). as the keep-together prefix. GitCommands tests don't need this protection: [TestFixtureSource] classes with enlistmentPerTest=true create a fresh enlistment per test, and classes with enlistmentPerTest=false call git-checkout in [SetUp] to reset to a known clean state. Either way, tests are independent and safe to distribute across slices. EnlistmentPerFixture and MultiEnlistmentTests tests retain their grouping because they genuinely share state across test methods. From PR microsoft#2028 timing data: expected critical path drops from 18.9 min (slice dominated by CheckoutTests) to ~9-11 min. Assisted-by: Claude Sonnet 4.6 Signed-off-by: Tyrie Vella <[email protected]>
The greedy bucket slicer keeps consecutive tests from the same fixture
class together when they share state. The grouping regex was overly
broad, using whole namespaces instead of specific class names:
OLD: ^.*\.(?:EnlistmentPerFixture|MultiEnlistmentTests)\..+\.
NEW: ^.*\.(?:EnlistmentPerFixture\..+|MultiEnlistmentTests\.ConfigVerbTests)\.
Two problems fixed:
1. GitCommands namespace (previous PR run): included all GitCommands
tests, causing all 38 CheckoutTests(Full) methods (~16 min) to land
in one slice. GitCommands tests are safe to split: they use either a
per-test enlistment or a git-checkout reset in [SetUp].
2. MultiEnlistmentTests namespace (this change): included all classes
in the namespace, keeping SharedCacheTests (10 tests, ~7 min) and
ServiceVerbTests together unnecessarily.
- SharedCacheTests: [SetUp] generates a Guid-based cache path per
test — no shared state across test methods. Safe to split.
- ServiceVerbTests: [NonParallelizable] blocks within-process
concurrency; different slices run on different machines. Safe.
- ConfigVerbTests: uses [Order(1..8)] with each test reading config
written by the previous. Must stay together — kept explicitly.
- EnlistmentPerFixture: still grouped per-class as before.
From PR microsoft#2028 baseline: critical path was 18.9 min.
After GitCommands fix: 9.85 min.
Expected after this change: ~6-7 min.
Assisted-by: Claude Sonnet 4.6
Signed-off-by: Tyrie Vella <[email protected]>
The greedy bucket algorithm previously balanced slices by test count. Switch to balancing by estimated wall-clock duration so that slices with a few slow tests are padded with fewer short tests, reducing variance. Changes: - Add GVFS.FunctionalTests/Resources/test-weights.json: per-test estimated duration in seconds (minimum 1), generated from PR microsoft#2028 TestResult.xml artifacts (659 tests, x64 run). Embedded as a resource in GVFS.FunctionalTests.exe so it is always present at runtime. - NUnitRunner.PrepareTestSlice: load the embedded weights, use a weighted sum (seconds) as the priority-queue key instead of test count. Fail hard with a list of unknown tests if any explored test is absent from the weights file -- forces the developer to regenerate after adding, renaming, or removing tests. - Add scripts/Update-TestWeights.ps1: regenerate test-weights.json from one or more TestResult.xml artifacts. Run this script and commit the result whenever the slicer fails due to unknown tests. Assisted-by: Claude Sonnet 4.6 Signed-off-by: Tyrie Vella <[email protected]>
The greedy bucket algorithm previously balanced slices by test count. Switch to balancing by estimated wall-clock duration so that slices with a few slow tests are padded with fewer fast tests, reducing variance. Changes: - Add GVFS.FunctionalTests/Resources/test-weights.json (JSONC): per-test estimated duration in seconds, rounded to the nearest 5 s. Only the 239 tests whose rounded duration exceeds the default (5 s) are listed; all others are handled by the default. Generated from PR microsoft#2028 TestResult.xml artifacts. Embedded as a resource in the test exe. - NUnitRunner.PrepareTestSlice: load the embedded weights; use a weighted sum (seconds) as the priority-queue key instead of test count. Unknown tests silently use the 5 s default -- adding or removing a test never breaks the slicer. The JSONC comment header is stripped before parsing since System.Text.Json does not support comments natively. - Add scripts/Update-TestWeights.ps1: merge new TestResult.xml duration measurements into the existing JSON. Semantics: update existing entries, add new ones above the threshold, keep orphans (pass -Prune to remove them). Accepts partial runs -- only the measured tests are affected. Assisted-by: Claude Sonnet 4.6 Signed-off-by: Tyrie Vella <[email protected]>
|
Note This comment was drafted by an AI assistant and reviewed and approved by a human before posting. Closing this. The versioned layout is correct and becomes the foundation of the revised update design, but several details need to change, so the work restarts rather than continues here. The layout itself, the version garbage collection, the migration from the flat layout, and the upgrade test scenarios all carry forward. Four corrections: Register through Retarget the junction in place. The current sequence creates Rewriting the reparse data of the existing junction with Do not use a recursive delete for version cleanup. Correct the path resolution fallback. |
Summary
Switches the installer from flat binary deployment to a versioned folder structure:
Changes
{app}\Versions\{version}with aCurrentjunction{app}\Current\instead of flat{app}; cleans up legacy entry on upgradeCurrent.new+ rename strategy to minimize unavailable windowMotivation
With versioned folders, upgrades become zero-downtime: new version goes in a new folder, junction swaps immediately, running mounts continue from their old version folder until remounted. This eliminates the PendingUpgrade complexity and will enable simplifying the GVFS service to reduce elevation surface
Part of Plan UAC-Free Install Modernization (Phase 1)