mail_draft_edit on JMAP: guard, order and undo #196
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dev/mail-mind-mcp#196
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?
Part of epic #187. Implements ADR 0013 item 8 for JMAP.
Read
docs/adr/0013-trash-forward-and-draft-edits.mdand ADR 0004 first. ADR 0013 is the contract. If the code shows that a ruling cannot work, stop and report; do not change the ruling here.Standing rules: tools only queue to the outbox and never call a mail server. The sync worker applies each action through the existing source
applyinterface. Logs carry counts, roles and error codes only. Secrets are files. Add no new test seam: use the tools over HTTP with the stand-in worker, the sourceapplyinterface with the fake IMAP session or the fake JMAP server, and the GreenMail and Stalwart integration targets.What to build
unsupportedrefusal from the IMAP edit issue.$draftand its recorded blob id.Notes from the IMAP issue (#195, PR #205)
mail_draft_edit, the target rule, the shared draft cap, the refusal of a replaced target inmail_undoand the worker's target check already exist. Change none of them unless a JMAP case needs it.invalid_argument.reply_toorforwardreference of the action it replaces. The undo rebuilds the previous content from the replaced action's stored params.editwithunsupported. Replace it.Acceptance criteria
make checkpasses.Out of scope
Any change to the tool, the target rule or the cap.
Blocked by
⏸ SVD architect gate: dev/mail-mind-mcp#196 mail-draft-edit-on-jmap-guard-order-and-undo
Status: CLEAN after 0 rework round(s) · 0 blocking defect(s) · 0 lens(es) INCONCLUSIVE (could not run) · 0 lens(es) DEGRADED (deterministic denial) · complexity
standard· dispatch effortmediumRun:
20261112T213532Z-a14a09f0Held because: CLEAN but 2 open risk(s) (1 verification · 1 decision) — HOLD-ALL parks everything. The risks, verbatim:
Open risks:
make test-stalwart. It passes when tests/integration/test_stalwart.py::test_draft_edit_and_undo passes and test_writes_and_their_undo still passes. This also confirms that Stalwart's Email/get blobId equals the Email/import created blobId, which the guard depends on. [verification]Change: Mirror #205's IMAP split in actions.py (_compose/_append_draft/_edit/_undo_edit/_check_draft/_expunge_draft) on JmapSource. Split _draft (jmap.py:970-1003) into _compose(action_id, params) -> raw and _import_draft(raw) -> (location, drafts_id, wanted), with no mirroring. Split _undo_draft (jmap.py:1005-1012) into _check_draft(inverse) -> state ($draft + blob_id guard via _current) and _destroy_draft(state, inverse) (Email/set destroy with ifInState, then delete_sources). Add _replace(inverse, raw): guard -> import -> re-guard and RE-READ state (the import advances the Email state) -> destroy -> _add the new id if Drafts is wanted. _edit uses edit_target, refuses a non-JMAP inverse (no source_id/blob_id) with invalid_argument, composes from action.params and returns the new {mailbox, source_id, blob_id}. _undo_edit composes from the replaced action's params and returns the restored location. In apply (jmap.py:489-522), remove the two unsupported refusals and route edit and undo-of-edit to the new helpers. Update the module and apply docstrings. Leave server.py, source.py and store.py untouched.
Files:
src/mail_mind_mcp/jmap.py·tests/test_jmap.py·tests/integration/test_stalwart.pyDecision: accept the 2 open risk(s) above and dispatch this spec (
svd:go), or park (svd:skip) / re-spec (svd:respec)?Your call (when this issue is held at the gate via
svd:hold):svd:go— approve; Half-B dispatch accepts exactly this spec (open risks accepted)svd:firebesidesvd:go— approve AND authorise the Half-B fire from the phone; never on its ownsvd:skip— park it; dispatch refuses it and the issue stays for a humansvd:respec— discard this spec; the next Half-A run re-produces it with this record as prior-attempt contextSpec:
/Users/piers/.local/state/exhaust/groupthink/specs/2026-11-12-mail-draft-edit-on-jmap-guard-order-and-undo.md— next:codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-12-mail-draft-edit-on-jmap-guard-order-and-undo.md✅ SVD architect gate: dev/mail-mind-mcp#196 mail-draft-edit-on-jmap-guard-order-and-undo
Status: CLEAN after 0 rework round(s) · 0 blocking defect(s) · 0 lens(es) INCONCLUSIVE (could not run) · 0 lens(es) DEGRADED (deterministic denial) · complexity
unclassified· dispatch effortunclassifiedRun:
20261112T213532Z-a14a09f0Files:
src/mail_mind_mcp/jmap.py·tests/test_jmap.py·tests/integration/test_stalwart.pyWrite-set divergence: present table wins. 0 sourceHashes vs 15-row table.
Decision: dispatch this spec (
svd:go)?Your call (when this issue is held at the gate via
svd:hold):svd:go— approve; Half-B dispatch accepts exactly this spec (open risks accepted)svd:firebesidesvd:go— approve AND authorise the Half-B fire from the phone; never on its ownsvd:skip— park it; dispatch refuses it and the issue stays for a humansvd:respec— discard this spec; the next Half-A run re-produces it with this record as prior-attempt contextSpec:
/Users/piers/.local/state/exhaust/groupthink/specs/2026-11-12-mail-draft-edit-on-jmap-guard-order-and-undo.md— next:codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-12-mail-draft-edit-on-jmap-guard-order-and-undo.mdspec-verify-dispatch Half B for dev/mail-mind-mcp#196 mail-draft-edit-on-jmap-guard-order-and-undo completed integration verify.
5fc41e0c3d-k "edit or stable_ids"filter collects it. The original name would be filtered out. The spec has no scenario-trace table, so this is not a blocker.-k "edit or stable_ids"collects 15 tests, so it is not empty. Every other named spec test collects.codex-svd ship --run-id 20261112T222737Z-88adb39b --confirm-merge)