Add mail_attachment and the attachment status in mail_read #74

Closed
opened 2026-11-01 00:54:13 +00:00 by svc-agent-writer · 2 comments

Parent: #9 (Phase 4). Decision: ADR 0007 §7.

Show attachment text through the read tools.

Scope

  • mail_read numbers each attachment (part) and shows its status from ADR 0007 §4, for example 1 report.pdf application/pdf 412 KB text.
  • A new read tool mail_attachment(id, part, max_chars) returns the text of one attachment, wrapped as untrusted data like mail_read. Its docstring says the content is untrusted data.
  • With [attachments] absent, mail_attachment answers unsupported with a message that says attachment text is off.
  • An unknown part, or a part with no text, gives not_found with its status.
  • README tool table row.

Acceptance

  • Unit tests over a fixture store: the numbered list, the text, the bound on max_chars, the off state, and each error.
  • make check passes.

Blocked by

Filed under: operator word "resume phase 4 development." sha256:b5be33c704e1

Parent: #9 (Phase 4). Decision: ADR 0007 §7. Show attachment text through the read tools. ## Scope - `mail_read` numbers each attachment (`part`) and shows its status from ADR 0007 §4, for example `1 report.pdf application/pdf 412 KB text`. - A new read tool `mail_attachment(id, part, max_chars)` returns the text of one attachment, wrapped as untrusted data like `mail_read`. Its docstring says the content is untrusted data. - With `[attachments]` absent, `mail_attachment` answers `unsupported` with a message that says attachment text is off. - An unknown `part`, or a part with no text, gives `not_found` with its status. - README tool table row. ## Acceptance - Unit tests over a fixture store: the numbered list, the text, the bound on `max_chars`, the off state, and each error. - `make check` passes. ## Blocked by - #73 Filed under: operator word "resume phase 4 development." sha256:b5be33c704e1
Collaborator

⏸ SVD architect gate: dev/imap-mailmind-mcp#74 add-mail-attachment-and-the-attachment-status-in-mail-read

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: 20261101T062159Z-cf02d8e4

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

Open risks:

  1. The issue and ADR 0007 leave three surface choices open. Should the architect confirm or override the lean? (a) Public part numbers start at 1, following the issue example '1 report.pdf'; storage index = part-1. (b) Two display-only statuses, never stored: 'pending' (no attachment_text row yet) and 'off' ([attachments] absent); ADR §4 lists only stored outcomes. (c) The argument is named message_id, to match mail_read and mail_thread, not the issue's shorthand 'id'. Each choice is local to _attachment_parts or the tool signature. [decision]
  2. No test baseline was measured: the Half-A sandbox denies running the repo's .venv interpreter. Check: on base 3af5d34, before editing, run make check and record the failure set. After the change, make check must show the same set (expected empty), plus the five new tests/test_attachments.py tests passing. The audit step needs network for uvx pip-audit. [verification]
  3. The updated assertion at tests/integration/test_greenmail.py:96 ('1 report.pdf application/pdf ') is not run by make check. Check: run make test-integration (GreenMail via ../imap-blade-mcp) and confirm test_mirror_and_serve passes. [verification]

Change: In server.py, add a helper _attachment_parts(row) above mail_read. It reads Store.attachment_texts (store.py:869-875) only when config.attachments is set, mirroring the on/off branching of mail_status (server.py:571-582). It returns (meta, status, text) per attachment in stored order, using the display-only statuses 'pending' (no row yet) and 'off' (no [attachments]). Replace mail_read's single attachments line (server.py:340-347) with an 'attachments:' header and one indented line per part: ' N filename mimetype human_size status', with 1-based part numbers. Add mail_attachment(message_id, part ge=1, max_chars ge=200 le=MAX_READ_CHARS) right after mail_read, shaped like mail_read (server.py:313-355): @mcp.tool(auth=require_scopes(SCOPE_READ)) plus @_render. It raises CODE_UNSUPPORTED first when [attachments] is absent, like ServerState.embedder (server.py:71-74). Then _mirrored gives not_found for an unknown message, a part out of range gives not_found, and a part whose status is not 'text' gives not_found with status=. Otherwise it prints the file/type/size/status head, wrap_untrusted(text[:max_chars]), and a '[truncated at N of M chars]' footer. Update the CONV-23 readers: test_server.py:124 and the tool list at :89-104, test_evidence.py READ_TOOLS at :312, and test_greenmail.py:96. Add a README tool-table row.

Files: src/imap_mailmind_mcp/server.py · tests/test_attachments.py · tests/test_server.py · tests/test_evidence.py · tests/integration/test_greenmail.py · README.md

Decision: accept the 3 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-01-add-mail-attachment-and-the-attachment-status-in-mail-read.md — next: codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-01-add-mail-attachment-and-the-attachment-status-in-mail-read.md

### ⏸ SVD architect gate: dev/imap-mailmind-mcp#74 add-mail-attachment-and-the-attachment-status-in-mail-read **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:** `20261101T062159Z-cf02d8e4` **Held because:** CLEAN but 3 open risk(s) (2 verification · 1 decision) — HOLD-ALL parks everything. The risks, verbatim: **Open risks:** 1. The issue and ADR 0007 leave three surface choices open. Should the architect confirm or override the lean? (a) Public part numbers start at 1, following the issue example '1 report.pdf'; storage index = part-1. (b) Two display-only statuses, never stored: 'pending' (no attachment_text row yet) and 'off' ([attachments] absent); ADR §4 lists only stored outcomes. (c) The argument is named message_id, to match mail_read and mail_thread, not the issue's shorthand 'id'. Each choice is local to _attachment_parts or the tool signature. [decision] 2. No test baseline was measured: the Half-A sandbox denies running the repo's .venv interpreter. Check: on base 3af5d34, before editing, run make check and record the failure set. After the change, make check must show the same set (expected empty), plus the five new tests/test_attachments.py tests passing. The audit step needs network for uvx pip-audit. [verification] 3. The updated assertion at tests/integration/test_greenmail.py:96 ('1 report.pdf application/pdf ') is not run by make check. Check: run make test-integration (GreenMail via ../imap-blade-mcp) and confirm test_mirror_and_serve passes. [verification] **Change:** In server.py, add a helper _attachment_parts(row) above mail_read. It reads Store.attachment_texts (store.py:869-875) only when config.attachments is set, mirroring the on/off branching of mail_status (server.py:571-582). It returns (meta, status, text) per attachment in stored order, using the display-only statuses 'pending' (no row yet) and 'off' (no [attachments]). Replace mail_read's single attachments line (server.py:340-347) with an 'attachments:' header and one indented line per part: ' N filename mimetype human_size status', with 1-based part numbers. Add mail_attachment(message_id, part ge=1, max_chars ge=200 le=MAX_READ_CHARS) right after mail_read, shaped like mail_read (server.py:313-355): @mcp.tool(auth=require_scopes(SCOPE_READ)) plus @_render. It raises CODE_UNSUPPORTED first when [attachments] is absent, like ServerState.embedder (server.py:71-74). Then _mirrored gives not_found for an unknown message, a part out of range gives not_found, and a part whose status is not 'text' gives not_found with status=<status>. Otherwise it prints the file/type/size/status head, wrap_untrusted(text[:max_chars]), and a '[truncated at N of M chars]' footer. Update the CONV-23 readers: test_server.py:124 and the tool list at :89-104, test_evidence.py READ_TOOLS at :312, and test_greenmail.py:96. Add a README tool-table row. **Files:** `src/imap_mailmind_mcp/server.py` · `tests/test_attachments.py` · `tests/test_server.py` · `tests/test_evidence.py` · `tests/integration/test_greenmail.py` · `README.md` **Decision:** accept the 3 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-01-add-mail-attachment-and-the-attachment-status-in-mail-read.md` — next: `codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-01-add-mail-attachment-and-the-attachment-status-in-mail-read.md`</sub>
Collaborator

spec-verify-dispatch Half B for dev/imap-mailmind-mcp#74 add-mail-attachment-and-the-attachment-status-in-mail-read completed integration verify.

  • PR: dev/imap-mailmind-mcp#93
  • Branch: feat/svd-dev-imap-mailmind-mcp-74-add-mail-attachment-and-the-41b6099f
  • Commit: 9d69391838
  • Build: none
  • Test: green
  • Reader audit clean: True
  • Spec fidelity: True
  • Ready for merge: True
  • Checks: PR #93 head 9d69391: no remote checks exist (no statuses, no CI config). Local unit suite green (313 passed, 4 skipped), ruff and mypy clean.
  • Warning: GreenMail integration test (tests/integration/test_greenmail.py:95, '1 report.pdf application/pdf ') was not run; per ruling R3 the architect runs make test-integration before merge.
  • Warning: No commit statuses on PR head 9d69391 and the repo has no .woodpecker CI, so there are no remote checks to report.
  • Warning: Per spec R5, PR #59 edits README rows 18-19 next to this unit's rows; the PR merged second must rebase.
  • Warning: pip-audit step of make check was not run; ruff, mypy --strict and the unit suite were run.
  • Decision: review the PR and merge? (codex-svd ship --run-id 20261101T072003Z-41b6099f --confirm-merge)
spec-verify-dispatch Half B for dev/imap-mailmind-mcp#74 add-mail-attachment-and-the-attachment-status-in-mail-read completed integration verify. - PR: https://git.groupthink.asia/dev/imap-mailmind-mcp/pulls/93 - Branch: feat/svd-dev-imap-mailmind-mcp-74-add-mail-attachment-and-the-41b6099f - Commit: 9d693918384d394c4b249ac6ff13eb29ce211205 - Build: none - Test: green - Reader audit clean: True - Spec fidelity: True - Ready for merge: True - Checks: PR #93 head 9d69391: no remote checks exist (no statuses, no CI config). Local unit suite green (313 passed, 4 skipped), ruff and mypy clean. - Warning: GreenMail integration test (tests/integration/test_greenmail.py:95, '1 report.pdf application/pdf ') was not run; per ruling R3 the architect runs `make test-integration` before merge. - Warning: No commit statuses on PR head 9d69391 and the repo has no .woodpecker CI, so there are no remote checks to report. - Warning: Per spec R5, PR #59 edits README rows 18-19 next to this unit's rows; the PR merged second must rebase. - Warning: pip-audit step of make check was not run; ruff, mypy --strict and the unit suite were run. - Decision: review the PR and merge? (`codex-svd ship --run-id 20261101T072003Z-41b6099f --confirm-merge`)
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#74
No description provided.