fix(email): serialize default-account mutations#5656
Open
RaresKeY wants to merge 2 commits into
Open
Conversation
3 tasks
RaresKeY
marked this pull request as ready for review
July 21, 2026 12:20
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
Serialize email-account default mutations across app workers and enforce one
default per normalized owner. Create, promote, delete, owner-rename, legacy
seed, and demo-account paths now share the same durable invariant and choose a
replacement default atomically.
The migration normalizes pre-existing duplicate defaults deterministically and
is idempotent. The change is limited to account/default persistence behavior;
it does not change mail transport or OAuth protocol behavior.
Target branch
dev, notmain.Linked Issue
Fixes #5646
Part of #5637
Type of Change
Checklist
dev.How to Test
Run:
Race two creates or set-default mutations for the same normalized owner and verify no more than one default commits.
Delete the current default and verify the earliest remaining account is promoted in the same transaction.
Rename an account across owners while another default mutation runs and verify both owner partitions remain valid.
Seed legacy or demo accounts repeatedly and verify migration/setup remains idempotent.
Exact-head validation passes 69 focused concurrency/rename tests and 147
broader email tests. Python compilation, diff checks, and an independent
source/concurrency review pass.
Visual / UI changes — REQUIRED if you touched anything that renders
No visual or frontend files changed.