Fix what's-new re-appearing after a failed update (held for next release)

Replace the running-version-vs-saved-version trigger for the "what's new" popup with a
one-shot marker the updater writes ONLY on a successful update (UpdateApplier success
path). A failed/rolled-back update never writes it (and clears any stale one), so it can
no longer re-trigger what's-new — the old best-effort flag save could lose a race during
the update churn and leave the version mismatched, which was the bug.

New WhatsNewMarker seam (Write/Exists/Consume) + a SelfTest case for the consume-once
contract. MaybeShowWhatsNewAfterUpdate now shows iff the marker is present, then deletes
it; still records LastWhatsNewVersion for the import-offer's upgrade detection.

Not released yet — bundling with the connection-retry (#15) work in the next release.
No version bump, no manual change (internal fix).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Ednunp
2026-06-23 17:16:54 +01:00
co-authored by Claude Opus 4.8
parent 36431d6d39
commit e710834458
5 changed files with 107 additions and 17 deletions
+5
View File
@@ -72,6 +72,7 @@ internal static class UpdateApplier
RollBack(moved, created, Log);
TryDeleteDirectory(backupDir); // restored files were moved back out; drop the empty backup tree
WriteFailureMarker(target, logPath);
WhatsNewMarker.Consume(target); // a rolled-back update must never trigger "what's new"
Log("rolled back to previous version" + (noRestart ? "" : "; restarting it"));
if (!noRestart) RestartApp(target, resumeProfile, Log); // old version restored intact — safe to relaunch
CleanupStage(stageRoot, Log);
@@ -80,6 +81,10 @@ internal static class UpdateApplier
TryDeleteDirectory(backupDir);
WriteResumeSentinel(target, resumeProfile, Log);
// Positive one-shot signal that the update genuinely succeeded — drives the next launch's
// "what's new" popup. Written ONLY here, on the success path.
try { WhatsNewMarker.Write(target); Log("wrote what's-new marker"); }
catch (Exception ex) { Log($"could not write what's-new marker: {ex.Message}"); }
Log("apply-update OK" + (noRestart ? "" : " — restarting RemSound"));
if (!noRestart) RestartApp(target, resumeProfile, Log);
CleanupStage(stageRoot, Log);