Skip to content

fix(email): serialize default-account mutations#5656

Open
RaresKeY wants to merge 2 commits into
odysseus-dev:devfrom
RaresKeY:fix/email-account-default-serialization
Open

fix(email): serialize default-account mutations#5656
RaresKeY wants to merge 2 commits into
odysseus-dev:devfrom
RaresKeY:fix/email-account-default-serialization

Conversation

@RaresKeY

Copy link
Copy Markdown
Collaborator

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

  • This PR targets dev, not main.

Linked Issue

Fixes #5646

Part of #5637

Type of Change

  • Bug fix (non-breaking — fixes a confirmed issue)
  • New feature (non-breaking — adds new behaviour)
  • Breaking change (changes or removes existing behaviour)
  • Refactor / cleanup (behaviour unchanged)
  • Documentation only
  • CI / tooling / configuration

Checklist

  • I searched open issues and open PRs — this cross-worker default-account invariant is not already owned.
  • This PR targets dev.
  • My changes are limited to email-account default serialization, migration normalization, and focused regressions.
  • I ran the app end-to-end. Deterministic database concurrency tests were used instead of a live multi-worker mail deployment.

How to Test

  1. Run:

    python -m pytest -q tests/test_email_account_default_serialization.py tests/test_rename_user_owner_sync.py tests/test_email_oauth.py
  2. Race two creates or set-default mutations for the same normalized owner and verify no more than one default commits.

  3. Delete the current default and verify the earliest remaining account is promoted in the same transaction.

  4. Rename an account across owners while another default mutation runs and verify both owner partitions remain valid.

  5. 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.

  • Screenshot or short clip — not applicable; no rendering changed.
  • Style match — no UI change.
  • No new component patterns.
  • I am not an LLM agent submitting a bulk PR. Contributor attestation remains for the human author.

@github-actions github-actions Bot added the ready for review Description complete — ready for maintainer review label Jul 20, 2026
@RaresKeY
RaresKeY marked this pull request as ready for review July 21, 2026 12:20
@RaresKeY RaresKeY added the bug Something isn't working label Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ready for review Description complete — ready for maintainer review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

email: serialize default-account mutations across workers

1 participant