Skip to content

#775 part 1: the accounts as rows, with the default one told (new code only) - #1836

Merged
benandez merged 1 commit into
UCSLabs:mainfrom
kartas39:775-accounts-one-place
Dec 1, 2026
Merged

benandez merged 1 commit into
UCSLabs:mainfrom
kartas39:775-accounts-one-place

Conversation

@kartas39

@kartas39 kartas39 commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Part 1 of #775: the first of your three steps, the two functions and AccountRow. The capability checks come next, then the call sites, so #775 stays open.

This draft was rewritten while only bots had looked at it: the checks that were here before are out, and come as the next PR.

What changes for the person using MailCraft

Nothing yet. All of it is new code (crates/model/src/accounts.rs and its lines in lib.rs), and nothing calls it yet.

  • Mailbox::account_rows(): every account as an AccountRow, in the folder pane's order (accounts_in_order()).
  • Mailbox::default_account_row(): the default account (default_account()) as a row.
  • Mailbox::account_row(id): the account with that id as a row.
  • AccountRow: the account (it works as an &Account, so row.id and row.email read as today) and is_default().

Two things differ from the text of #775:

  • accounts_in_order() and default_account() stay as they are, so no caller changes. The new functions are beside them.
  • A row doesn't hold the mailbox. What it says of the account is worked out when the row is made, so code that has a row can't reach the rest of the mailbox through it. The checks that need a shared mailbox's owner will get the owner the same way.

The default account is whatever default_account() returns, so a choice of default account (asked for in #775) only has to change that function's body.

How it was checked

crates/model/src/accounts_tests.rs: the rows against accounts_in_order() and default_account() after a move, with a shared mailbox whose owner is gone and with two accounts of one id; only one row is the default.

  • cargo xtask ci passes
  • A crash or data-loss fix has its regression test (none here)
  • "Allow edits by maintainers" is ticked (the box beside Create pull request)
  • I have signed the CLA, or will by commenting on this pull request

Not changed

Human-reviewed, AI-assisted, nobody's mailbox harmed.

Summary by CodeRabbit

  • New Features
    • Mailbox account listings now follow folder-pane order and identify the default account.
    • Accounts can be retrieved individually, including the default account.

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The model adds the public AccountRow type and mailbox methods to list account rows, retrieve the default row, and look up a row by ID. Tests cover ordering, duplicate IDs, shared mailboxes, empty mailboxes, account references, and debug output.

Changes: Mailbox account rows

Layer / File(s) Summary
Account row API
crates/model/src/accounts.rs, crates/model/src/lib.rs
AccountRow borrows an Account, records whether it is the mailbox default, and dereferences to Account. The crate root re-exports AccountRow.
Mailbox lookups and validation
crates/model/src/accounts.rs, crates/model/src/accounts_tests.rs, crates/model/src/lib.rs
Mailbox gains methods to list account rows in account order and retrieve rows by default status or ID. Tests cover ordering, duplicate IDs, shared mailboxes, empty mailboxes, account references, and debug output.

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Other

Possibly related issues

Suggested reviewers: benandez, vangel76

Merge Risk: Minimal · up to 86190 · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the change: adding accounts as rows (AccountRow and Mailbox row methods) and telling the default one. It also marks the PR as part 1 of #775 and as new code only. It matches the change…
Description check Passed The description follows the template. It states the PR is part 1 of #775 and gives a 'What changes for the person using MailCraft' section that says nothing calls the new code yet. The 'How it was che…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the change: adding accounts as rows (AccountRow and Mailbox row methods) and telling the default one. It also marks the PR as part 1 of #775 and as new code only. It matches the changeset's main change, so it passes.

Full details: Description check

Explanation

The description follows the template. It states the PR is part 1 of #775 and gives a 'What changes for the person using MailCraft' section that says nothing calls the new code yet. The 'How it was checked' section lists the tests and the checklist items. The 'Closes #' line is blank, and the description does not say it is a draft that builds on #775, though it does say #775 stays open. The description also has an extra 'Not changed' section. These gaps are minor, so the check passes.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 50f4c21 and 8619095.

Files ignored due to path filters: 2

  • docs/log.d/ROADMAP/progress/775-1.md is excluded by !docs/**
  • docs/log.d/ROADMAP/revisions/775-1.md is excluded by !docs/**
Files selected for processing: 3

  • crates/model/src/accounts.rs
  • crates/model/src/accounts_tests.rs
  • crates/model/src/lib.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@omg-review-bot omg-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 Automated review of 50f4c21

Additive only: crates/model/src/accounts.rs adds AccountRow plus one capability check per thing, with accounts_tests.rs pinning what each kind of account can do; nothing calls it yet and no existing behaviour changes. I found no correctness defect in the new code — its checks and its tables agree — but three of the new public checks/docs disagree with each other for the same account, which is worth settling before part 2 moves callers onto them. Those are quality items and do not block the merge.

No issues found.

✅ Approved: no unresolved findings at [P2] MAJOR or above.

3 lower-priority or previously reported findings were omitted.

Model deepseek-v4.1-flash:cloud · skill code-change-review · 5 files reviewed. Reply to an inline comment to discuss it.

@kartas39
kartas39 marked this pull request as draft November 22, 2026 14:41
…r, with the default one told

Mailbox::account_rows(), default_account_row() and account_row() give AccountRows: the account
and whether it is the default. A row holds nothing else of the mailbox. New code only: nothing
calls it yet, and accounts_in_order() and default_account() are as they were.

Human-reviewed, AI-assisted, nobody's mailbox harmed.
@kartas39
kartas39 force-pushed the 775-accounts-one-place branch from 50f4c21 to 8619095 Compare November 29, 2026 10:45
@kartas39 kartas39 changed the title #775 part 1: one place to ask which accounts there are and what each can do (new code only) #775 part 1: the accounts as rows, with the default one told (new code only) Nov 29, 2026
@kartas39
kartas39 marked this pull request as ready for review November 29, 2026 10:46
@sonarqubecloud

Copy link
Copy Markdown

@benandez benandez 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.

Thanks, this is a clean first step. Keeping accounts_in_order() and default_account() as they are and adding the rows beside them keeps the change small, and comparing the account by pointer rather than id is the right call for files with duplicate ids. The tests against the existing functions are a good way to pin it.

One small doc point, not blocking:

  1. crates/model/src/accounts.rs:62: "Each account is listed once, whatever it is or can do" isn't quite true, because accounts_in_order() leaves out online archives, while account_row(id) does give a row for an archive. Could you say so in both docs, so part 2 doesn't assume every account_row is in account_rows()?

Approving.

@benandez
benandez added this pull request to the merge queue Dec 1, 2026
Merged via the queue into UCSLabs:main with commit 28ecf03 Dec 1, 2026
23 checks passed
kartas39 added a commit to kartas39/mailcraft that referenced this pull request Dec 1, 2026
…hich has a row of its own

From benandez's review of UCSLabs#1836: account_rows follows accounts_in_order, which leaves out online
archives, while account_row gives a row for one. Both docs say so, and so does suitable_account,
which gives an archive only as the preferred account. A test pins it.

Human-reviewed, AI-assisted, nobody's mailbox harmed.
@kartas39

kartas39 commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

Done in #2124: the docs of account_rows and account_row now say that an online archive is left out of the rows but has a row of its own, and suitable_account says that it gives an archive only as the preferred account. A test pins it. None of the later parts assumes otherwise.

Human-reviewed, AI-assisted, nobody's mailbox harmed.

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.

2 participants