Accept ADR 0013: Trash, forward drafts and draft edits; keywords declined #188

Closed
opened 2026-11-12 02:14:23 +00:00 by svc-agent-writer · 4 comments

Part of epic #187.

What to build

Write docs/adr/0013-trash-forward-and-draft-edits.md. It amends ADR 0004 (the reversible write path). Use the format of the other ADRs in docs/adr/: Status, Context, Decision, Consequences. Set the status to proposed. The owner accepts it in review. Write no application code in this issue.

The ADR must rule on each item below. The epic's "Implementation Decisions" section gives the recommended ruling for each one. Follow it unless the code shows it cannot work. If it cannot, state why in the ADR.

  1. Trash is the only delete. A new tool mail_trash and a new action kind trash. mail_move keeps refusing Trash and Junk. Permanent deletion, emptying Trash and Junk as a target stay forbidden.
  2. Trash target. Resolved by the trash role, whether or not the mirror includes that mailbox. Zero or several such mailboxes is unsupported.
  3. Trash undo. What the inverse stores on IMAP and on JMAP. The undo moves back only messages still in Trash at the stored identity. If none remain, the undo is refused with not_found.
  4. Mirror effect. What happens to the mirror rows and the changes log when the mirror excludes Trash, on apply and on undo.
  5. Trash cap. trash_per_day, default 20, counted in messages. Every other cap still counts requests. State how the store counts messages for this kind.
  6. Tool annotation. mail_trash carries the destructive hint.
  7. Forward drafts. mail_draft gains forward_id, exclusive with reply_to_id. The quoted block, the subject default, no threading headers, the size cut with a marker. No attachment bytes; one line names the attachments that are not included.
  8. Draft edits. A new tool mail_draft_edit and a new action kind edit. The target rule, the guard, the order (write the new draft, then remove the old one), the new draft id on both sources, the undo, and the count against drafts_per_day.
  9. Keywords declined. Tagging stays seen, flagged and seven colours. Record that free keywords were considered and declined, and why: mail content could steer an agent into inventing tags.
  10. Unchanged. No SMTP or submission path. ADR 0004 §2, §3, §5, §6, §7 and §8 stay as they are.
  11. Consequences. What a leaked write token can do after this change. Whether the schema version rises, and why an older reader still opens the store.

Acceptance criteria

  • The ADR file exists with status proposed and rules on all eleven items.
  • Each ruling that differs from the epic states the reason.
  • ADR 0004 gains one line under its Status that points to ADR 0013 as an amendment. No other text of ADR 0004 changes.
  • make check passes.
  • The PR changes files under docs/adr/ only.

Blocked by

None.

Part of epic #187. ## What to build Write `docs/adr/0013-trash-forward-and-draft-edits.md`. It amends ADR 0004 (the reversible write path). Use the format of the other ADRs in `docs/adr/`: Status, Context, Decision, Consequences. Set the status to `proposed`. The owner accepts it in review. Write no application code in this issue. The ADR must rule on each item below. The epic's "Implementation Decisions" section gives the recommended ruling for each one. Follow it unless the code shows it cannot work. If it cannot, state why in the ADR. 1. **Trash is the only delete.** A new tool `mail_trash` and a new action kind `trash`. `mail_move` keeps refusing Trash and Junk. Permanent deletion, emptying Trash and Junk as a target stay forbidden. 2. **Trash target.** Resolved by the `trash` role, whether or not the mirror includes that mailbox. Zero or several such mailboxes is `unsupported`. 3. **Trash undo.** What the inverse stores on IMAP and on JMAP. The undo moves back only messages still in Trash at the stored identity. If none remain, the undo is refused with `not_found`. 4. **Mirror effect.** What happens to the mirror rows and the changes log when the mirror excludes Trash, on apply and on undo. 5. **Trash cap.** `trash_per_day`, default 20, counted in messages. Every other cap still counts requests. State how the store counts messages for this kind. 6. **Tool annotation.** `mail_trash` carries the destructive hint. 7. **Forward drafts.** `mail_draft` gains `forward_id`, exclusive with `reply_to_id`. The quoted block, the subject default, no threading headers, the size cut with a marker. No attachment bytes; one line names the attachments that are not included. 8. **Draft edits.** A new tool `mail_draft_edit` and a new action kind `edit`. The target rule, the guard, the order (write the new draft, then remove the old one), the new draft id on both sources, the undo, and the count against `drafts_per_day`. 9. **Keywords declined.** Tagging stays seen, flagged and seven colours. Record that free keywords were considered and declined, and why: mail content could steer an agent into inventing tags. 10. **Unchanged.** No SMTP or submission path. ADR 0004 §2, §3, §5, §6, §7 and §8 stay as they are. 11. **Consequences.** What a leaked write token can do after this change. Whether the schema version rises, and why an older reader still opens the store. ## Acceptance criteria - [ ] The ADR file exists with status `proposed` and rules on all eleven items. - [ ] Each ruling that differs from the epic states the reason. - [ ] ADR 0004 gains one line under its Status that points to ADR 0013 as an amendment. No other text of ADR 0004 changes. - [ ] `make check` passes. - [ ] The PR changes files under `docs/adr/` only. ## Blocked by None.
Collaborator

⏸ SVD architect gate: dev/mail-mind-mcp#188 accept-adr-0013-trash-forward-drafts-and-draft-edits-keyword

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 effort medium

Run: 20261112T025545Z-cf2d7b33

Held because: CLEAN but 4 open risk(s) (1 verification · 3 decision) — HOLD-ALL parks everything. The risks, verbatim:

Open risks:

  1. Epic #187's 'Implementation Decisions', the default ruling for all 11 items, was not in the Half-A issue snapshot, and gh is denied here. The spec carries only code facts. Question: should dispatch fetch epic #187 itself (tea/forge API) and quote it per item in the PR, or will the architect append those decisions as an Architect Amendment before dispatch? If dispatch cannot read it, it must halt. [decision]
  2. The code leaves rulings open that the epic may not settle. (a) JMAP trash: remove only the source mailboxId (as move does, jmap.py:866) or replace all memberships? (b) Unmirrored Trash (the default, config.py:40): never refresh it; on JMAP undo, re-add the row via _add, since record_move returns False for unknown rows (store.py:1983-1998), or wait for the next pass? (c) Forward quoted block: the mirror's trim_quoted body_text, or the raw message? (d) mail_undo of a draft/edit action whose draft a later edit replaced. Question: are these ruled in #187, and if not, does the narrower option stand? [decision]
  3. Issue item 10 lists ADR 0004 §2, §3, §5-§8 as unchanged but omits §9 (Deployment: which hostname may carry a write token). A token that can trash and forward may change the starbase ADR 0023 posture. Question: should ADR 0013 restate §9 unchanged, or flag that the deployment decision must be revisited before a public host carries a write token with mail_trash? [decision]
  4. make check was not run in Half A (the target repo is read-only). Check after dispatch: run make check in the dispatch worktree on the pristine base before the first edit and again after the edit, and confirm the same pass result. The CI lane .woodpecker/validation.yaml re-runs it on the PR. [verification]

Change: Docs-only. Step 0: dispatch reads epic #187 'Implementation Decisions' (tea/forge API) and halts if unreadable. Then write docs/adr/0013-trash-forward-and-draft-edits.md mirroring docs/adr/0004-reversible-write-path.md:1-45 (H1 '# ADR 0013: …', 'Status: proposed', ## Context / ## Decision with numbered bold-lead rulings / ## Consequences), one ruling per issue item 1-11, each consistent with the verified code facts: FORBIDDEN_TARGET_ROLES outbox.py:26 kept at server.py:1588, actions.py:296, jmap.py:857; trash role resolved by the worker from the server list because store mailboxes are mirrored-only (jmap.py:568-569, ingest.py:213); partial trash undo differs from the all-or-nothing move undo (actions.py:184-188/325, jmap.py:885-886); Trash is unmirrored by default (config.py:40), delete_uids writes changes+peer del (store.py:1434-1460), record_move returns False for unknown rows (store.py:1983-1998); cap counting via SUM(json_array_length(params,'$.refs')) beside enqueue_action (store.py:3289-3317); destructiveHint constants at server.py:96-100; forward quotes the trim_quoted body_text (ingest.py:388, jmap.py:1113) under MAX_BODY_CHARS outbox.py:29; the draft-edit guard mirrors _undo_draft (actions.py:388-402, jmap.py:925-932); keywords closed set outbox.py:20-25; schema v17→v18 because of the actions CHECK constraint rebuild (store.py:178-200), older reader still opens via >= wait (store.py:832-845). Add exactly one line under ADR 0004 line 3 linking ADR 0013 as an amendment (git diff --numstat → 1 0).

Files: docs/adr/0013-trash-forward-and-draft-edits.md · docs/adr/0004-reversible-write-path.md

Decision: accept the 4 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):

  • add label svd:go — approve; Half-B dispatch accepts exactly this spec (open risks accepted)
  • add label svd:fire beside svd:go — approve AND authorise the Half-B fire from the phone; never on its own
  • add label svd:skip — park it; dispatch refuses it and the issue stays for a human
  • add label svd:respec — discard this spec; the next Half-A run re-produces it with this record as prior-attempt context

Spec: /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-12-accept-adr-0013-trash-forward-drafts-and-draft-edits-keyword.md — next: codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-12-accept-adr-0013-trash-forward-drafts-and-draft-edits-keyword.md

### ⏸ SVD architect gate: dev/mail-mind-mcp#188 accept-adr-0013-trash-forward-drafts-and-draft-edits-keyword **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 effort `medium` **Run:** `20261112T025545Z-cf2d7b33` **Held because:** CLEAN but 4 open risk(s) (1 verification · 3 decision) — HOLD-ALL parks everything. The risks, verbatim: **Open risks:** 1. Epic #187's 'Implementation Decisions', the default ruling for all 11 items, was not in the Half-A issue snapshot, and gh is denied here. The spec carries only code facts. Question: should dispatch fetch epic #187 itself (tea/forge API) and quote it per item in the PR, or will the architect append those decisions as an Architect Amendment before dispatch? If dispatch cannot read it, it must halt. [decision] 2. The code leaves rulings open that the epic may not settle. (a) JMAP trash: remove only the source mailboxId (as move does, jmap.py:866) or replace all memberships? (b) Unmirrored Trash (the default, config.py:40): never refresh it; on JMAP undo, re-add the row via _add, since record_move returns False for unknown rows (store.py:1983-1998), or wait for the next pass? (c) Forward quoted block: the mirror's trim_quoted body_text, or the raw message? (d) mail_undo of a draft/edit action whose draft a later edit replaced. Question: are these ruled in #187, and if not, does the narrower option stand? [decision] 3. Issue item 10 lists ADR 0004 §2, §3, §5-§8 as unchanged but omits §9 (Deployment: which hostname may carry a write token). A token that can trash and forward may change the starbase ADR 0023 posture. Question: should ADR 0013 restate §9 unchanged, or flag that the deployment decision must be revisited before a public host carries a write token with mail_trash? [decision] 4. make check was not run in Half A (the target repo is read-only). Check after dispatch: run `make check` in the dispatch worktree on the pristine base before the first edit and again after the edit, and confirm the same pass result. The CI lane .woodpecker/validation.yaml re-runs it on the PR. [verification] **Change:** Docs-only. Step 0: dispatch reads epic #187 'Implementation Decisions' (tea/forge API) and halts if unreadable. Then write docs/adr/0013-trash-forward-and-draft-edits.md mirroring docs/adr/0004-reversible-write-path.md:1-45 (H1 '# ADR 0013: …', 'Status: proposed', ## Context / ## Decision with numbered bold-lead rulings / ## Consequences), one ruling per issue item 1-11, each consistent with the verified code facts: FORBIDDEN_TARGET_ROLES outbox.py:26 kept at server.py:1588, actions.py:296, jmap.py:857; trash role resolved by the worker from the server list because store mailboxes are mirrored-only (jmap.py:568-569, ingest.py:213); partial trash undo differs from the all-or-nothing move undo (actions.py:184-188/325, jmap.py:885-886); Trash is unmirrored by default (config.py:40), delete_uids writes changes+peer del (store.py:1434-1460), record_move returns False for unknown rows (store.py:1983-1998); cap counting via SUM(json_array_length(params,'$.refs')) beside enqueue_action (store.py:3289-3317); destructiveHint constants at server.py:96-100; forward quotes the trim_quoted body_text (ingest.py:388, jmap.py:1113) under MAX_BODY_CHARS outbox.py:29; the draft-edit guard mirrors _undo_draft (actions.py:388-402, jmap.py:925-932); keywords closed set outbox.py:20-25; schema v17→v18 because of the actions CHECK constraint rebuild (store.py:178-200), older reader still opens via >= wait (store.py:832-845). Add exactly one line under ADR 0004 line 3 linking ADR 0013 as an amendment (git diff --numstat → 1 0). **Files:** `docs/adr/0013-trash-forward-and-draft-edits.md` · `docs/adr/0004-reversible-write-path.md` **Decision:** accept the 4 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`): - add label `svd:go` — approve; Half-B dispatch accepts exactly this spec (open risks accepted) - add label `svd:fire` **beside** `svd:go` — approve AND authorise the Half-B fire from the phone; never on its own - add label `svd:skip` — park it; dispatch refuses it and the issue stays for a human - add label `svd:respec` — discard this spec; the next Half-A run re-produces it with this record as prior-attempt context <sub>Spec: `/Users/piers/.local/state/exhaust/groupthink/specs/2026-11-12-accept-adr-0013-trash-forward-drafts-and-draft-edits-keyword.md` — next: `codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-12-accept-adr-0013-trash-forward-drafts-and-draft-edits-keyword.md`</sub>
Collaborator

✅ SVD architect gate: dev/mail-mind-mcp#188 accept-adr-0013-trash-forward-drafts-and-draft-edits-keyword

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 effort unclassified

Run: 20261112T025545Z-cf2d7b33

Files: docs/adr/0013-trash-forward-and-draft-edits.md · docs/adr/0004-reversible-write-path.md

Write-set divergence: present table wins. 0 sourceHashes vs 19-row table.

Decision: dispatch this spec (svd:go)?

Your call (when this issue is held at the gate via svd:hold):

  • add label svd:go — approve; Half-B dispatch accepts exactly this spec (open risks accepted)
  • add label svd:fire beside svd:go — approve AND authorise the Half-B fire from the phone; never on its own
  • add label svd:skip — park it; dispatch refuses it and the issue stays for a human
  • add label svd:respec — discard this spec; the next Half-A run re-produces it with this record as prior-attempt context

Spec: /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-12-accept-adr-0013-trash-forward-drafts-and-draft-edits-keyword.md — next: codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-12-accept-adr-0013-trash-forward-drafts-and-draft-edits-keyword.md

### ✅ SVD architect gate: dev/mail-mind-mcp#188 accept-adr-0013-trash-forward-drafts-and-draft-edits-keyword **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 effort `unclassified` **Run:** `20261112T025545Z-cf2d7b33` **Files:** `docs/adr/0013-trash-forward-and-draft-edits.md` · `docs/adr/0004-reversible-write-path.md` **Write-set divergence:** present table wins. 0 sourceHashes vs 19-row table. **Decision:** dispatch this spec (`svd:go`)? **Your call** (when this issue is held at the gate via `svd:hold`): - add label `svd:go` — approve; Half-B dispatch accepts exactly this spec (open risks accepted) - add label `svd:fire` **beside** `svd:go` — approve AND authorise the Half-B fire from the phone; never on its own - add label `svd:skip` — park it; dispatch refuses it and the issue stays for a human - add label `svd:respec` — discard this spec; the next Half-A run re-produces it with this record as prior-attempt context <sub>Spec: `/Users/piers/.local/state/exhaust/groupthink/specs/2026-11-12-accept-adr-0013-trash-forward-drafts-and-draft-edits-keyword.md` — next: `codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-12-accept-adr-0013-trash-forward-drafts-and-draft-edits-keyword.md`</sub>
Collaborator

✅ SVD architect gate: dev/mail-mind-mcp#188 accept-adr-0013-trash-forward-drafts-and-draft-edits-keyword

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 effort unclassified

Run: 20261112T025545Z-cf2d7b33

Files: docs/adr/0013-trash-forward-and-draft-edits.md · docs/adr/0004-reversible-write-path.md

Write-set divergence: present table wins. 0 sourceHashes vs 19-row table.

Decision: dispatch this spec (svd:go)?

Your call (when this issue is held at the gate via svd:hold):

  • add label svd:go — approve; Half-B dispatch accepts exactly this spec (open risks accepted)
  • add label svd:fire beside svd:go — approve AND authorise the Half-B fire from the phone; never on its own
  • add label svd:skip — park it; dispatch refuses it and the issue stays for a human
  • add label svd:respec — discard this spec; the next Half-A run re-produces it with this record as prior-attempt context

Spec: /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-12-accept-adr-0013-trash-forward-drafts-and-draft-edits-keyword.md — next: codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-12-accept-adr-0013-trash-forward-drafts-and-draft-edits-keyword.md

### ✅ SVD architect gate: dev/mail-mind-mcp#188 accept-adr-0013-trash-forward-drafts-and-draft-edits-keyword **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 effort `unclassified` **Run:** `20261112T025545Z-cf2d7b33` **Files:** `docs/adr/0013-trash-forward-and-draft-edits.md` · `docs/adr/0004-reversible-write-path.md` **Write-set divergence:** present table wins. 0 sourceHashes vs 19-row table. **Decision:** dispatch this spec (`svd:go`)? **Your call** (when this issue is held at the gate via `svd:hold`): - add label `svd:go` — approve; Half-B dispatch accepts exactly this spec (open risks accepted) - add label `svd:fire` **beside** `svd:go` — approve AND authorise the Half-B fire from the phone; never on its own - add label `svd:skip` — park it; dispatch refuses it and the issue stays for a human - add label `svd:respec` — discard this spec; the next Half-A run re-produces it with this record as prior-attempt context <sub>Spec: `/Users/piers/.local/state/exhaust/groupthink/specs/2026-11-12-accept-adr-0013-trash-forward-drafts-and-draft-edits-keyword.md` — next: `codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-12-accept-adr-0013-trash-forward-drafts-and-draft-edits-keyword.md`</sub>
Collaborator

spec-verify-dispatch Half B for dev/mail-mind-mcp#188 accept-adr-0013-trash-forward-drafts-and-draft-edits-keyword completed integration verify.

  • PR: #190
  • Branch: feat/svd-dev-mail-mind-mcp-188-accept-adr-0013-trash-forward-f3581e2a
  • Commit: 06f8c8d53f
  • Build: none
  • Test: green
  • Reader audit clean: True
  • Spec fidelity: True
  • Ready for merge: True
  • Check ci/woodpecker/pr/validation: green https://ci.groupthink.asia/repos/72/pipeline/67/1
  • Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll
  • Warning: The first make check run failed in the pytest step: the worktree .venv had no dev dependencies, so conftest raised ModuleNotFoundError for mail_mind_mcp and pytest was absent. After uv sync --all-groups --all-extras, the same pytest command gave 1475 passed, 8 skipped, 22 deselected. The subagent's 149 failures came from the unprovisioned environment, not from the diff.
  • Warning: Ruff check, ruff format --check and mypy --strict passed on the PR commit.
  • Warning: The docs-only diff leaves the test result unchanged. Spec checks pass: numstat shows 0013 with 28 added and 0 removed, and 0004 with 1 added and 0 removed. The grep for Context, Decision and Consequences returns 3, and Status: proposed has one hit.
  • Warning: The spec's Test Strategy has no scenario table and no -k or -m filter, so nothing needed tracing.
  • Warning: Remote CI (Woodpecker) is still pending. The runner should re-poll it.
  • CI wait: ci/woodpecker/pr/validation -> pass
  • Decision: review the PR and merge? (codex-svd ship --run-id 20261112T041841Z-f3581e2a --confirm-merge)
spec-verify-dispatch Half B for dev/mail-mind-mcp#188 accept-adr-0013-trash-forward-drafts-and-draft-edits-keyword completed integration verify. - PR: https://git.groupthink.asia/dev/mail-mind-mcp/pulls/190 - Branch: feat/svd-dev-mail-mind-mcp-188-accept-adr-0013-trash-forward-f3581e2a - Commit: 06f8c8d53fe2d5c748a1c4ab9325dd3b8d09025e - Build: none - Test: green - Reader audit clean: True - Spec fidelity: True - Ready for merge: True - Check ci/woodpecker/pr/validation: green https://ci.groupthink.asia/repos/72/pipeline/67/1 - Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll - Warning: The first `make check` run failed in the pytest step: the worktree .venv had no dev dependencies, so conftest raised ModuleNotFoundError for mail_mind_mcp and pytest was absent. After `uv sync --all-groups --all-extras`, the same pytest command gave 1475 passed, 8 skipped, 22 deselected. The subagent's 149 failures came from the unprovisioned environment, not from the diff. - Warning: Ruff check, ruff format --check and mypy --strict passed on the PR commit. - Warning: The docs-only diff leaves the test result unchanged. Spec checks pass: numstat shows 0013 with 28 added and 0 removed, and 0004 with 1 added and 0 removed. The grep for Context, Decision and Consequences returns 3, and `Status: proposed` has one hit. - Warning: The spec's Test Strategy has no scenario table and no -k or -m filter, so nothing needed tracing. - Warning: Remote CI (Woodpecker) is still pending. The runner should re-poll it. - CI wait: ci/woodpecker/pr/validation -> pass - Decision: review the PR and merge? (`codex-svd ship --run-id 20261112T041841Z-f3581e2a --confirm-merge`)
piers closed this issue 2026-11-12 06:08:15 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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#188
No description provided.