Fix draft refresh race blocking release - #24
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2d22db321c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (current is null || current.IsQueued) return; | ||
| await _store.QueueDraftDeletionAsync(current); | ||
| // A refresh started before this commit must not resurrect its stale snapshot. | ||
| Interlocked.Increment(ref _draftRefreshVersion); |
There was a problem hiding this comment.
Refresh collections after invalidating a pending snapshot
When quick deletion overlaps another draft operation—such as the background reconciliation started during initialization or a composer save—this increment can invalidate that operation's already-read post-change snapshot. RefreshDraftsAsync then returns without applying anything, while DeleteDraftQuickAsync removes only its own draft; if the subsequent sync is blocked processing the remote deletion, unrelated imported/saved drafts or outbox changes remain invisible until a later refresh. Apply a fresh post-deletion snapshot or otherwise preserve the unrelated changes instead of only invalidating the pending refresh.
Useful? React with 👍 / 👎.
The v0.2.62 release was blocked on Windows by
DraftQuickDeletionDoesNotWaitForOtherDraftsToSync: a draft snapshot read before deletion could finish afterward and restore a deleted draft to the visible list.Version draft refresh requests and invalidate in-flight snapshots after committing quick deletion. Only a current snapshot can replace Drafts/Outbox. The regression explicitly delivers an older snapshot after deleting both drafts while provider deletion remains blocked, and verifies that it is rejected.
Validation: Release build succeeds with zero warnings/errors; all 522 tests pass locally. The failed v0.2.62 tag is unchanged and no release was published. A release containing this fix must use a new tag after merge.