Skip to content

feat(account): decouple account management and storage from legacy Preferences - #11708

Merged
wmontwe merged 20 commits into
thunderbird:mainfrom
wmontwe:feat-decouple-account-usage-from-legacy-account-part-2
Oct 15, 2026
Merged

wmontwe merged 20 commits into
thunderbird:mainfrom
wmontwe:feat-decouple-account-usage-from-legacy-account-part-2

Conversation

@wmontwe

@wmontwe wmontwe commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Contribution Summary

Linked Issue/Ticket: Resolves #11644

RFC / Technical Design (if applicable):

Description

Decouple account management and persistence from the legacy K-9 Preferences singleton and remove LegacyAccountDto / LegacyAccountDtoManager.

  • Add StorageProvider and DefaultStorageProvider in core:preference for thread-safe preference storage transactions.
  • Implement LegacyAccountLocalDataSource and LegacyAccountStorageHandler for serialized account persistence without legacy DTO mappings.
  • Introduce AccountCache and InMemoryAccountCache for synchronized in-memory caching of account domain objects.
  • Replace legacy Preferences singleton usages in MessagingController, NotificationChannelManager, and UI components with LegacyAccountManager.
  • Add AccountNotificationIdRegistry for dynamic, account-scoped notification ID allocation.
  • Expose AccountRepository and DeleteAccount use cases in feature:account:api.

This removed Legacy God-Objects & DTOs:

  • Deleted Preferences.kt the old singleton holding account state in memory.
  • Deleted LegacyAccountDto.kt & LegacyAccountDtoManager.kt.
  • Deleted DefaultLegacyAccountDataMapper.kt.
  • Deleted NotificationIds.kt and replaced with dynamic AccountNotificationIdRegistry.

API Migration:

  • Replaced 1,100+ references to LegacyAccountDto and Preferences.getPreferences(...) with type-safe AccountId and LegacyAccountManager.

Testing

As this touches the app vertically, testing was done by ensuring all existing tests are either reworked of green. Added a couple of tests to verify behavior that was previously untested.

AI Disclosure

Select one of the following (mandatory)

  • This contribution does not include any changes created or assisted by AI.
  • This contribution includes changes assisted by AI.
    • AI was used to review the changes and suggest improvements
  • This contribution includes changes created by AI.

Stack

  • #11708 feat(account): decouple account management and storage from legacy Preferences ← current
  • #11744 feat(account): unified special folders
  • #11749 fix(preference): read settings from the cached storage snapshot to reduce startup reads

@wmontwe
wmontwe deployed to botmobile October 8, 2026 17:38 — with GitHub Actions Active
@github-actions github-actions Bot added the tb-team Tasks and features handled by project maintainers label Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ Validation Passed: All report and feature-flag labels are correctly set.

@wmontwe

wmontwe commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

I opened this as draft as there is still a known bug with the special folder mapping during account creation. This is an old bug, that surfaces now consistently.

@wmontwe wmontwe added the report: include Include changes in user-facing reports. label Oct 8, 2026
@wmontwe
wmontwe deployed to botmobile October 12, 2026 17:05 — with GitHub Actions Active
@wmontwe
wmontwe marked this pull request as ready for review October 12, 2026 17:06
@wmontwe
wmontwe requested a review from a team as a code owner October 12, 2026 17:06
@wmontwe
wmontwe requested a review from rafaeltonholo October 12, 2026 17:06
@wmontwe
wmontwe deployed to botmobile October 12, 2026 17:06 — with GitHub Actions Active
@wmontwe
wmontwe deployed to botmobile October 12, 2026 17:06 — with GitHub Actions Active
@thunderbird-botmobile thunderbird-botmobile Bot added the pr-sentinel: needs updates Pull request flagged by PR Sentinel for not following guidelines. label Oct 12, 2026
@wmontwe
wmontwe force-pushed the feat-decouple-account-usage-from-legacy-account-part-2 branch from dda882c to 848dcd5 Compare October 12, 2026 17:16
@wmontwe
wmontwe force-pushed the feat-decouple-account-usage-from-legacy-account-part-2 branch from 848dcd5 to 377a45c Compare October 12, 2026 17:31
@wmontwe
wmontwe deployed to botmobile October 12, 2026 17:31 — with GitHub Actions Active
@thunderbird-botmobile thunderbird-botmobile Bot added pr-sentinel: ready for review Passed all automated PR Sentinel checks. Ready for maintainer review. and removed pr-sentinel: needs updates Pull request flagged by PR Sentinel for not following guidelines. labels Oct 12, 2026
@wmontwe
wmontwe deployed to botmobile October 13, 2026 16:25 — with GitHub Actions Active

@rafaeltonholo rafaeltonholo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since GitHub plugin feels a bit buggy, I will already comment the findings I've got so far.

Reviewed 301/494 files so far.

Comment thread legacy/core/src/main/java/com/fsck/k9/notification/NotificationActionService.kt Outdated
Comment thread legacy/core/src/main/java/com/fsck/k9/notification/NotificationChannelManager.kt Outdated
Comment thread legacy/core/src/main/java/com/fsck/k9/notification/NotificationChannelManager.kt Outdated
Comment thread legacy/core/src/main/java/com/fsck/k9/notification/NotificationDataStore.kt Outdated

@rafaeltonholo rafaeltonholo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since GitHub plugin feels a bit buggy, I will already comment the findings I've got so far.

Reviewed 301/494 files so far.

@wmontwe
wmontwe force-pushed the feat-decouple-account-usage-from-legacy-account-part-2 branch from 6ec0f85 to 8a55849 Compare October 14, 2026 13:49
@wmontwe
wmontwe deployed to botmobile October 14, 2026 13:49 — with GitHub Actions Active
@wmontwe
wmontwe force-pushed the feat-decouple-account-usage-from-legacy-account-part-2 branch from 8a55849 to 7a39a4d Compare October 14, 2026 16:03
@wmontwe
wmontwe deployed to botmobile October 14, 2026 16:03 — with GitHub Actions Active
@wmontwe
wmontwe deployed to botmobile October 14, 2026 16:17 — with GitHub Actions Active
@wmontwe
wmontwe force-pushed the feat-decouple-account-usage-from-legacy-account-part-2 branch from 67098be to 360ae2e Compare October 15, 2026 15:19
@wmontwe
wmontwe deployed to botmobile October 15, 2026 15:19 — with GitHub Actions Active
@thunderbird-botmobile thunderbird-botmobile Bot added pr-sentinel: ready for review Passed all automated PR Sentinel checks. Ready for maintainer review. and removed pr-sentinel: needs updates Pull request flagged by PR Sentinel for not following guidelines. labels Oct 15, 2026

@rafaeltonholo rafaeltonholo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

@wmontwe
wmontwe deployed to botmobile October 15, 2026 15:33 — with GitHub Actions Active
@wmontwe
wmontwe deployed to botmobile October 15, 2026 15:34 — with GitHub Actions Active
@wmontwe
wmontwe deployed to botmobile October 15, 2026 15:41 — with GitHub Actions Active
@wmontwe
wmontwe merged commit e010342 into thunderbird:main Oct 15, 2026
25 checks passed
@wmontwe
wmontwe deleted the feat-decouple-account-usage-from-legacy-account-part-2 branch October 15, 2026 16:15
@wmontwe
wmontwe deployed to botmobile October 15, 2026 16:15 — with GitHub Actions Active
@thunderbird-botmobile thunderbird-botmobile Bot added this to the Thunderbird 26 milestone Oct 15, 2026

This branch was successfully deployed

2 active (1 outdated) deployments
botmobile — 360ae2e2 Deployed Oct 15, 2026 by wmontwe via pr-merged #605
review — 83f078df Deployed Oct 8, 2026 by wmontwe via label-tb-team #586
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-sentinel: ready for review Passed all automated PR Sentinel checks. Ready for maintainer review. report: include Include changes in user-facing reports. tb-team Tasks and features handled by project maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Global Database 0.1.16 - decouple account usage from legacy account

2 participants