Add IMAP write primitives and drain the outbox in the sync worker #12
Labels
No labels
bug
enhancement
epic
needs-info
needs-triage
ready-for-agent
ready-for-human
svd:go
svd:hold
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dev/mail-mind-mcp#12
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Epic: #7
IMAP write primitives and the outbox drain (ADR 0004 §1, §2, §3, §6).
What to build
src/imap_mailmind_mcp/actions.py. It uses the blade'sAccountSession.run(fn)(imap_blade_mcp/connection.py) with SELECT, not EXAMINE. Do not add write code to the blade: the blade is read-only by class.append_draft: build the message withemail.message.EmailMessage.Fromis the account identity from config. Parse recipients withemail.headerregistry. Refuse any header value with CR or LF. For a reply, setIn-Reply-To,ReferencesandRe:subject from the mirrored row. APPEND to the Drafts role with\Draft. Record the new UID (APPENDUID when UIDPLUS is present; else SEARCH by the generated Message-ID).store_flags:\Seenand\Flaggedonly, add or remove. Record previous flags as the inverse.move: UID MOVE (RFC 6851) when advertised; else UID COPY + UID STORE\Deleted+ UID EXPUNGE of that UID only, and only with UIDPLUS. Without MOVE or UIDPLUS, refuse withunsupported. The target must be a mirrored mailbox and must not have the Trash or Junk role. Record source mailbox and new UID (COPYUID) as the inverse.\Draftand its RFC822.SIZE matches the recorded size.next_actionsat the start of each pass and between IDLE checks. Poll at most every 2 s while idle (configurable). Apply each action, update the mirror rows and writechangesrows in one store transaction, thenfinish_action.Acceptance
make test-integration): append, flag, move, each undo, and the refusal cases (Trash target, unchanged-draft check).make checkgreen.Blocked by