Skip to content

fix: clear persisted performance snapshot on Restore All and serialize baseline capture#933

Merged
laurentiu021 merged 1 commit into
mainfrom
fix/p2-performance-snapshot
Jun 18, 2026
Merged

fix: clear persisted performance snapshot on Restore All and serialize baseline capture#933
laurentiu021 merged 1 commit into
mainfrom
fix/p2-performance-snapshot

Conversation

@laurentiu021

Copy link
Copy Markdown
Owner

Two Performance Mode reversibility defects.

Changes

  • Stale persisted baseline after Restore AllRestoreAllAsync cleared the in-memory _snapshot but never deleted performance-snapshot.json. Since EnsureSnapshotAsync seeds the baseline with LoadSnapshot(), the next Apply reloaded the now-reverted pre-restore state as its baseline, and a later Restore All could re-apply stale values. Added PerformanceService.DeleteSnapshot() (guarded like SaveSnapshot) and call it after a successful Restore All.
  • Racy baseline capture — the six independent Apply commands each call EnsureSnapshotAsync, which does an unguarded _snapshot ??= Load() ?? Take(). Two running together could both see null and race the capture/save. Wrapped the load-modify in a SemaphoreSlim(1,1) so the baseline is captured exactly once. (Disposed in Dispose.)

Notes

  • The broader "serialize ALL Apply mutations through OperationLockService" suggestion is a larger UX/behavior change deferred; this PR fixes the concrete data races without changing which buttons are enabled.

Build: 0 warnings / 0 errors. Version 1.20.41. (Stacks on #930; will rebase before merge.)

@laurentiu021 laurentiu021 force-pushed the fix/p2-performance-snapshot branch from 20196fc to 6330a1b Compare June 18, 2026 00:29
@laurentiu021 laurentiu021 merged commit fafa004 into main Jun 18, 2026
4 checks passed
@laurentiu021 laurentiu021 deleted the fix/p2-performance-snapshot branch June 18, 2026 00:35
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