Skip to content

v0.1.7: CleanupOldInstall now also cleans .update/ staging tree#11

Merged
StuartMeeks merged 1 commit into
mainfrom
cleanup-update-staging-at-startup
May 25, 2026
Merged

v0.1.7: CleanupOldInstall now also cleans .update/ staging tree#11
StuartMeeks merged 1 commit into
mainfrom
cleanup-update-staging-at-startup

Conversation

@StuartMeeks
Copy link
Copy Markdown
Owner

@StuartMeeks StuartMeeks commented May 25, 2026

Summary

  • 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.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.
  • Fix: CleanupOldInstall now 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/.
  • The immediate cleanup in InstallAsync's finally stays as a fast-path for installs where no contention exists.

API impact

  • IUpdateInstaller.CleanupOldInstall method name unchanged for back-compat — consumers' existing Program.cs startup hooks keep working without edits. XML doc updated to reflect the broader scope.
  • The class-level XML doc on IUpdateInstaller now 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 — produces NextIteration.SpectreConsole.SelfUpdate.0.1.7.nupkg.
  • Maintainer to verify against the pl-app OneDrive scenario: after a 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

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>
@StuartMeeks StuartMeeks merged commit 47d614e into main May 25, 2026
4 checks passed
@StuartMeeks StuartMeeks deleted the cleanup-update-staging-at-startup branch May 25, 2026 06:39
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