Add iOS flag colours to mail_flag and the read rows #68

Closed
opened 2026-11-01 00:10:06 +00:00 by svc-agent-writer · 0 comments

Parent: #51 (Phase 6), as a follow-on after #57. Decision: ADR 0004 (the write rules), ADR 0006 §10 (JMAP writes).

iOS Mail and Apple Mail show seven flag colours. They store a colour as \Flagged plus a 3-bit code in the keywords $MailFlagBit0, $MailFlagBit1 and $MailFlagBit2. The mirror already stores these keywords for both sources (ingest.py _flags, jmap.py _flags). No tool shows them, and no tool can set them.

What to build

  • Read side:
    • Search and thread rows show the colour of a flagged message.
    • mail_search gains a flag_color filter.
    • Unknown keywords stay hidden, as they are today.
  • Write side:
    • mail_flag gains color, one of red, orange, yellow, green, blue, purple and grey. A colour also sets \Flagged.
    • Removing flagged also clears the three bits, as iOS Mail does.
    • The inverse records the previous \Flagged and the three bits, so mail_undo restores the previous colour.
    • IMAP: the three keywords join ALLOWED_FLAGS for this action only. Before the STORE, check that the mailbox's PERMANENTFLAGS lists the keywords or \*. Otherwise refuse with unsupported.
    • JMAP: the same patch on keywords, with ifInState (#57).
  • Marking a message read stays a separate, explicit mail_flag call. A colour change never touches \Seen.

Acceptance

  • Unit tests for the 3-bit mapping in both directions, for each colour.
  • Integration tests on GreenMail and Stalwart: set a colour, change it, clear it, and undo each.
  • A live check on one iCloud account and on Fastmail that the colour set by an agent shows in iOS Mail. The test instance needs the write token (ADR 0004 §9).
  • make check and make test-integration pass.

Blocked by

Human act

ruling: the operator rules that agents may write flag colours (CONV-40)

Filed under: operator word "option A. proceed 57" sha256:c6d452190dd3

Parent: #51 (Phase 6), as a follow-on after #57. Decision: ADR 0004 (the write rules), ADR 0006 §10 (JMAP writes). iOS Mail and Apple Mail show seven flag colours. They store a colour as `\Flagged` plus a 3-bit code in the keywords `$MailFlagBit0`, `$MailFlagBit1` and `$MailFlagBit2`. The mirror already stores these keywords for both sources (`ingest.py` `_flags`, `jmap.py` `_flags`). No tool shows them, and no tool can set them. ## What to build - Read side: - Search and thread rows show the colour of a flagged message. - `mail_search` gains a `flag_color` filter. - Unknown keywords stay hidden, as they are today. - Write side: - `mail_flag` gains `color`, one of red, orange, yellow, green, blue, purple and grey. A colour also sets `\Flagged`. - Removing `flagged` also clears the three bits, as iOS Mail does. - The inverse records the previous `\Flagged` and the three bits, so `mail_undo` restores the previous colour. - IMAP: the three keywords join `ALLOWED_FLAGS` for this action only. Before the STORE, check that the mailbox's PERMANENTFLAGS lists the keywords or `\*`. Otherwise refuse with `unsupported`. - JMAP: the same patch on `keywords`, with `ifInState` (#57). - Marking a message read stays a separate, explicit `mail_flag` call. A colour change never touches `\Seen`. ## Acceptance - Unit tests for the 3-bit mapping in both directions, for each colour. - Integration tests on GreenMail and Stalwart: set a colour, change it, clear it, and undo each. - A live check on one iCloud account and on Fastmail that the colour set by an agent shows in iOS Mail. The test instance needs the write token (ADR 0004 §9). - `make check` and `make test-integration` pass. ## Blocked by - #57 ## Human act ruling: the operator rules that agents may write flag colours (CONV-40) Filed under: operator word "option A. proceed 57" sha256:c6d452190dd3
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dev/mail-mind-mcp#68
No description provided.