v0.1.7: CleanupOldInstall now also cleans .update/ staging tree#11
Merged
Conversation
v0.1.6 wired DeleteDirectoryRobustly into the end-of-install cleanup of .update/, but that pass runs immediately after extraction — exactly when OneDrive is busiest scanning the freshly-written tree. The 1.4s retry budget loses the race often enough that .update/<tag>/ persists across sessions. CleanupOldInstall (the startup hook) previously only touched .old/, so nothing ever retried .update/ after OneDrive had hours to settle. Fix: CleanupOldInstall now cleans both .old/ and .update/. Same helper, same swallow-on-final-failure semantics, just a second call site. The immediate cleanup in InstallAsync's finally stays as a fast-path for contention-free installs. Interface XML doc updated to reflect the broader scope; method name kept (CleanupOldInstall) so consumers' existing Program.cs startup hooks keep working without edits. Two new tests: CleanupOldInstall removes a populated .update/, and the combined case where both .old/ and .update/ exist. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DeleteDirectoryRobustlyinto the end-of-install cleanup of.update/, but that pass runs immediately after extraction — exactly when OneDrive is busiest scanning the freshly-written tree. The 1.4 s retry budget loses the race often enough that.update/<tag>/accumulates across sessions.CleanupOldInstall(the startup hook) previously only touched.old/, so nothing ever retried.update/after OneDrive had time to release.CleanupOldInstallnow cleans both.old/and.update/. Same helper, same swallow-on-final-failure semantics, just a second call site. By the next CLI launch OneDrive has had hours / days to release the handles — the same logic that makes.old/cleanup work reliably now applies to.update/.InstallAsync's finally stays as a fast-path for installs where no contention exists.API impact
IUpdateInstaller.CleanupOldInstallmethod name unchanged for back-compat — consumers' existingProgram.csstartup hooks keep working without edits. XML doc updated to reflect the broader scope.IUpdateInstallernow notes both directories.Tests
2 new (177 → 179):
CleanupOldInstall_when_update_staging_exists_deletes_it— regression for the v0.1.7 behaviour: a populated.update/<tag>/tree is removed by the startup pass.CleanupOldInstall_cleans_both_old_and_update_directories— combined case.Test plan
dotnet build— clean.dotnet test— 179 passing.dotnet build -c Release— producesNextIteration.SpectreConsole.SelfUpdate.0.1.7.nupkg.pl-app update, the in-session.update/<tag>/may persist; on next launch of pl-app, both.old/and.update/should be cleaned.🤖 Generated with Claude Code