Skip to content

People: first-class Contact Folders, contact-based rule conditions, MarkJunk, and in-place rules.edit - #1845

Draft
marian001 wants to merge 3 commits into
UCSLabs:mainfrom
marian001:feat/contact-folders-and-rules
Draft

marian001 wants to merge 3 commits into
UCSLabs:mainfrom
marian001:feat/contact-folders-and-rules

Conversation

@marian001

Copy link
Copy Markdown

Summary

Opened as a Draft PR for early feedback/review (rebased onto current main / 0.15.0). Note that parts of this overlap with claimed issues (#1275, #992); happy to split or adjust based on maintainer direction.

What's included

  1. First-class Contact Folders (crates/model, crates/engine, crates/ui-egui)

    • ContactFolder { id, name, parent: Option<Id>, origin: Origin } on Mailbox + Contact::folder: Id (0 = default / unfiled), kept strictly separate from colour Contact::categories.
    • Supports nested folders (parent), path formatting (Parent/Child), subtree deletion (contacts are moved to the parent or 0, never lost), and Mailbox::repair() validation.
    • Commands: people.newFolder, people.renameFolder, people.deleteFolder, people.listFolders, people.move, and view.peopleFolder.
    • People UI: Contact Folder switcher in the dropdown (Contact folder · <path>), New / Rename / Delete actions, ribbon button, Move to Folder context menu, and Folder selector in the contact form.
  2. Contact-based rule conditions & MarkJunk action (crates/model, crates/net, crates/engine, crates/ui-egui)

    • Condition::FromInContacts(ContactBook) and Condition::FromNotInContacts(ContactBook) (targeting all contacts, an account, a ContactFolder id, or a category), wired through Matching::in_contacts.
    • Action::MarkJunk (moves matching messages to the account's Junk E-mail folder).
    • Local-only: rejected by server_cannot and Graph rule serialization with clear reasons.
    • Unified UI wording: Sender is in contacts / Sender isn't in contacts and Contact folder · <path>.
  3. In-place rule editing (crates/engine, crates/ui-egui)

    • rules.edit updates local rules in place (preserving list order, enabled state, and account; refuses server-kept rules).
    • Rules dialog: Edit button loads a rule into the builder (Save Rule / Cancel).

Verification

  • cargo +1.95 test -p mailcraft-model --lib (719 passed)
  • cargo +1.95 test -p mailcraft-net --lib -- rules (20 passed)
  • cargo +1.95 test -p mailcraft-engine --lib -- rules people agent (392 passed)
  • cargo +1.95 test -p mailcraft-ui-egui --lib -- rules people address_book contact dialog agent_gate_binding_tests a_held_key_deletes_one_rule (247 passed)
  • cargo +1.95 test -p mailcraft -p mailcraft-cli --no-run (compiled cleanly)
  • cargo +1.95 fmt --all --check, xtask i18n --check, xtask spdx, xtask layers, xtask test-files, xtask wasm-clock — all green.

…kJunk action

- Introduce first-class ContactFolder (id, name, parent, origin) and Contact::folder
  (kept separate from colour Contact::categories), with CRUD, subtree/path helpers,
  and Mailbox::repair() validation.
- Add Condition::FromInContacts / FromNotInContacts(ContactBook) with optional
  account, folder, and category targeting, wired through Matching::in_contacts.
- Add Action::MarkJunk (moves message to the account's Junk E-mail folder).
- Reject local-only contact conditions and MarkJunk when serializing Graph server rules.
- Add people.newFolder, people.renameFolder, people.deleteFolder, people.listFolders,
  people.move, and view.peopleFolder (with ViewState::people_folder).
- Add rules.edit to update local rules in place (preserving position, enabled state,
  and account), plus parsing/server_cannot support for fromInContacts,
  fromNotInContacts, and markJunk.
- Classify all new commands for agent access and binding, and add engine tests.
- Add Contact Folder switcher, New/Rename/Delete actions, ribbon button, Move to Folder
  context menu, and Folder picker in the contact form (independent of Categories).
- Add in-place rule editing (Edit button -> Save Rule), Sender is/isn't in contacts
  conditions (targeting all contacts, account, or Contact folder), and Mark as junk action.
- Update i18n catalogues (xtask i18n) and UI tests.
@coderabbitai

coderabbitai Bot commented Nov 22, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • 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

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Every author has signed the CLA. Thank you.

@sonarqubecloud

Copy link
Copy Markdown

@marian001

Copy link
Copy Markdown
Author

I have read the MailCraft CLA and I agree to it.

github-actions Bot added a commit that referenced this pull request Nov 22, 2026
@benandez

benandez commented Dec 1, 2026

Copy link
Copy Markdown
Member

@marian001, thanks for this, and sorry nobody answered your question. Parts of it are already taken by others: rules.edit is #1177 (Pyrol), which we're landing now, and contacts folders are #1275, where thekk1 has #1365 open. Could you split the rest into small pull requests of their own: Mark as Junk on its own, and contact-based rule conditions built on #1177 once it's in? For contact folders, please talk it through on #1275 with thekk1 first, so nobody builds the same thing twice. We'll leave this draft open until the split ones exist.

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

@marian001

Copy link
Copy Markdown
Author

Thanks, @benandez — that plan works for me.

I'll leave this draft as it is until the split PRs exist.

This branch has not been deployed

No deployments
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