Compact rows and mail_read: escaped cells, cleaned snippets, capped address lists #109

Closed
opened 2026-11-01 20:54:33 +00:00 by svc-agent-writer · 4 comments

This was generated by AI during triage.

Part of #106 (items 3 and 5). Decided at triage 2026-11-02: snippets are cleaned at render; address cap default 5 with a numeric override. Scope cut 2026-11-02: the batch read moved to #133, and the tool annotations shipped with #116.

Agent Brief

Category: enhancement
Summary: Make rows and mail_read cheaper and exact: escaped cells, cleaned and sized snippets, capped address lists

Current behavior:
Search, thread, people and evidence rows are pipe-delimited. No cell escapes |, so a subject that holds one adds a cell. The subject is cut at 120 characters and the snippet at 160 with no mark. The snippet is the stored source text with URLs, Markdown syntax and JSON-LD blocks left in. mail_read prints every to and cc address, which can run to thousands of characters for a short body.

Desired behavior:

  • Every row format replaces | inside a cell with a fixed substitute character, and a cell cut by a length cap ends with …. Search, thread, people, evidence, changes, triage and wake rows all follow this.
  • mail_search takes fields (a closed list of cell names; default the current set) and snippet_chars (0 to 400, default 160; 0 drops the snippet line). Rendering removes URLs, Markdown link and emphasis syntax and JSON-LD blocks from the snippet; the stored snippet and the FTS index are unchanged.
  • mail_read takes max_addresses (1 to 200, default 5). Each of to and cc shows at most that many addresses, then (+M more). The same cap applies to every tool that prints an address list.
  • The triage panel keeps working with the changed row shape.

Key interfaces:

  • The row-cell renderer shared by the row tools; a single escape-and-cap helper used by all of them.
  • mail_search, mail_read signatures and the triage panel's calls into them.
  • mail_evidence keeps its closed field list (ADR 0008 §2); only cell escaping changes.

Acceptance criteria:

  • A message whose subject is a | b renders as one row with the same cell count as every other row.
  • A 300-character subject renders as 119 characters plus ….
  • snippet_chars=0 returns rows with no snippet line; snippet_chars=40 returns snippets of at most 40 characters ending with … when cut.
  • A snippet holding see https://example.test/x and **bold** [link](u) renders without the URL, the asterisks and the link syntax, and a snippet holding a JSON-LD block renders without it.
  • A message with 45 cc addresses prints 5 and (+40 more) by default and all 45 with max_addresses=45.
  • The panel tests pass, and make check passes.

Out of scope:

  • Cleaning snippets at ingest or changing the stored snippet.
  • Date form or paging (the UTC sub-issue).
  • New fields on mail_evidence.
  • Reading several ids in one call (#133).
  • Tool annotations: they shipped with #116 (server.py TOOL_HINTS).

Blocked by

  • #108 (both change _row_cells in server.py)

Filed under: operator word "accept" sha256:c125d0397b60

> *This was generated by AI during triage.* Part of #106 (items 3 and 5). Decided at triage 2026-11-02: snippets are cleaned at render; address cap default 5 with a numeric override. Scope cut 2026-11-02: the batch read moved to #133, and the tool annotations shipped with #116. ## Agent Brief **Category:** enhancement **Summary:** Make rows and mail_read cheaper and exact: escaped cells, cleaned and sized snippets, capped address lists **Current behavior:** Search, thread, people and evidence rows are pipe-delimited. No cell escapes `|`, so a subject that holds one adds a cell. The subject is cut at 120 characters and the snippet at 160 with no mark. The snippet is the stored source text with URLs, Markdown syntax and JSON-LD blocks left in. mail_read prints every to and cc address, which can run to thousands of characters for a short body. **Desired behavior:** - Every row format replaces `|` inside a cell with a fixed substitute character, and a cell cut by a length cap ends with `…`. Search, thread, people, evidence, changes, triage and wake rows all follow this. - mail_search takes `fields` (a closed list of cell names; default the current set) and `snippet_chars` (0 to 400, default 160; 0 drops the snippet line). Rendering removes URLs, Markdown link and emphasis syntax and JSON-LD blocks from the snippet; the stored snippet and the FTS index are unchanged. - mail_read takes `max_addresses` (1 to 200, default 5). Each of to and cc shows at most that many addresses, then `(+M more)`. The same cap applies to every tool that prints an address list. - The triage panel keeps working with the changed row shape. **Key interfaces:** - The row-cell renderer shared by the row tools; a single escape-and-cap helper used by all of them. - `mail_search`, `mail_read` signatures and the triage panel's calls into them. - `mail_evidence` keeps its closed field list (ADR 0008 §2); only cell escaping changes. **Acceptance criteria:** - [ ] A message whose subject is `a | b` renders as one row with the same cell count as every other row. - [ ] A 300-character subject renders as 119 characters plus `…`. - [ ] `snippet_chars=0` returns rows with no snippet line; `snippet_chars=40` returns snippets of at most 40 characters ending with `…` when cut. - [ ] A snippet holding `see https://example.test/x and **bold** [link](u)` renders without the URL, the asterisks and the link syntax, and a snippet holding a JSON-LD block renders without it. - [ ] A message with 45 cc addresses prints 5 and `(+40 more)` by default and all 45 with `max_addresses=45`. - [ ] The panel tests pass, and `make check` passes. **Out of scope:** - Cleaning snippets at ingest or changing the stored snippet. - Date form or paging (the UTC sub-issue). - New fields on mail_evidence. - Reading several ids in one call (#133). - Tool annotations: they shipped with #116 (`server.py` `TOOL_HINTS`). ## Blocked by - #108 (both change `_row_cells` in `server.py`) Filed under: operator word "accept" sha256:c125d0397b60
Author
Member

This was generated by AI during triage.

Scope correction 2026-11-02: tool annotations are owned by #116, filed the same morning with the same values and a wording change. Drop the annotations bullet and its acceptance criterion from this brief; #116 lands them. Everything else here stands. Do not dispatch #109 in the same batch as #116: both edit every tool docstring in server.py.

> *This was generated by AI during triage.* Scope correction 2026-11-02: tool annotations are owned by #116, filed the same morning with the same values and a wording change. Drop the annotations bullet and its acceptance criterion from this brief; #116 lands them. Everything else here stands. Do not dispatch #109 in the same batch as #116: both edit every tool docstring in server.py.
svc-agent-writer changed title from Compact rows and mail_read: escaped cells, cleaned snippets, capped address lists, batch reads, tool annotations to Compact rows and mail_read: escaped cells, cleaned snippets, capped address lists 2026-11-02 06:34:15 +00:00
Collaborator

⏸ SVD architect gate: dev/mail-mind-mcp#109 compact-rows-and-mail-read-escaped-cells-cleaned-snippets-ca

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: 20261102T115216Z-7eac3f03

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

Open risks:

  1. Should max_addresses also cap the mail_changes envelope cells? The brief says 'the same cap applies to every tool that prints an address list', but ADR 0008 §3 (docs/adr/0008-evidence-scope.md:39) fixes each envelope cell 'bounded as the stored to_addrs and cc_addrs columns are', and a test asserts the exact cells for peoplemind's correspondence graph. The lean leaves the envelope uncapped (escape only). Approve that, or require mail_changes max_addresses defaulting to no cap, or an ADR 0008 §3 amendment (out of this phase)? [decision]
  2. With snippet_chars=0, a row with copies>1 keeps an indented line holding only 'copies=N' (the copy count, not snippet text); single-copy rows have no indented line, which meets the AC. Keep copies=N, or drop the whole indented line at snippet_chars=0 and lose the copy count? [decision]
  3. No test baseline could be measured: this sandbox denied .venv/bin/python. Before the first edit on pristine base e55db5373a, run make check on the host and record the failure set. After the change, assert the set is unchanged apart from tests/test_compact_rows.py passing. [verification]

Change: Replace the bare slices in _row_cells (server.py:146-149) with one _cell(text, cap) helper: | -> ¦, and a cut keeps cap-1 chars + …. Add a pure _clean_snippet, applied in order: JSON-LD script/brace blocks (an unclosed block is removed to the end), Markdown links/images -> text, bare and URLs, emphasis markers, then collapse whitespace. Extend _row_line keyword-only with snippet_chars and fields, keeping the snippet: keyword for tests/test_assess.py:309-314 and tests/test_copies.py:289. Fields are filtered in fixed ROW_FIELDS order after today's marks/class trim. mail_search gets fields: list[RowField] | None (an empty list is invalid_argument) and snippet_chars 0..400 (default 160), mirroring the max_chars Annotated/Field pattern at :466. Route the mailboxes (:240), changes envelope (:572, escape only, no cap per ADR 0008 §3), wakes (:625), people (:653), evidence subjects (:735) and actions mailbox (:1084,1087) cells through _cell; never the id cell. mail_read gets max_addresses 1..200 (default 5) via _address_entries (split on ', ', a piece without @ joins the next) and _address_line (+M more). README tool rows updated; panel.html untouched.

Files: src/mail_mind_mcp/server.py · README.md · tests/test_compact_rows.py

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-02-compact-rows-and-mail-read-escaped-cells-cleaned-snippets-ca.md — next: codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-02-compact-rows-and-mail-read-escaped-cells-cleaned-snippets-ca.md

### ⏸ SVD architect gate: dev/mail-mind-mcp#109 compact-rows-and-mail-read-escaped-cells-cleaned-snippets-ca **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:** `20261102T115216Z-7eac3f03` **Held because:** CLEAN but 3 open risk(s) (1 verification · 2 decision) — HOLD-ALL parks everything. The risks, verbatim: **Open risks:** 1. Should max_addresses also cap the mail_changes envelope cells? The brief says 'the same cap applies to every tool that prints an address list', but ADR 0008 §3 (docs/adr/0008-evidence-scope.md:39) fixes each envelope cell 'bounded as the stored to_addrs and cc_addrs columns are', and a test asserts the exact cells for peoplemind's correspondence graph. The lean leaves the envelope uncapped (escape only). Approve that, or require mail_changes max_addresses defaulting to no cap, or an ADR 0008 §3 amendment (out of this phase)? [decision] 2. With snippet_chars=0, a row with copies>1 keeps an indented line holding only 'copies=N' (the copy count, not snippet text); single-copy rows have no indented line, which meets the AC. Keep copies=N, or drop the whole indented line at snippet_chars=0 and lose the copy count? [decision] 3. No test baseline could be measured: this sandbox denied .venv/bin/python. Before the first edit on pristine base e55db5373a7e, run `make check` on the host and record the failure set. After the change, assert the set is unchanged apart from tests/test_compact_rows.py passing. [verification] **Change:** Replace the bare slices in _row_cells (server.py:146-149) with one `_cell(text, cap)` helper: `|` -> `¦`, and a cut keeps cap-1 chars + `…`. Add a pure `_clean_snippet`, applied in order: JSON-LD script/brace blocks (an unclosed block is removed to the end), Markdown links/images -> text, bare and <url> URLs, emphasis markers, then collapse whitespace. Extend `_row_line` keyword-only with snippet_chars and fields, keeping the `snippet:` keyword for tests/test_assess.py:309-314 and tests/test_copies.py:289. Fields are filtered in fixed ROW_FIELDS order after today's marks/class trim. mail_search gets `fields: list[RowField] | None` (an empty list is invalid_argument) and `snippet_chars` 0..400 (default 160), mirroring the max_chars Annotated/Field pattern at :466. Route the mailboxes (:240), changes envelope (:572, escape only, no cap per ADR 0008 §3), wakes (:625), people (:653), evidence subjects (:735) and actions mailbox (:1084,1087) cells through `_cell`; never the id cell. mail_read gets max_addresses 1..200 (default 5) via `_address_entries` (split on ', ', a piece without @ joins the next) and `_address_line` (+M more). README tool rows updated; panel.html untouched. **Files:** `src/mail_mind_mcp/server.py` · `README.md` · `tests/test_compact_rows.py` **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-02-compact-rows-and-mail-read-escaped-cells-cleaned-snippets-ca.md` — next: `codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-02-compact-rows-and-mail-read-escaped-cells-cleaned-snippets-ca.md`</sub>
Collaborator

spec-verify-dispatch Half B for dev/mail-mind-mcp#109 compact-rows-and-mail-read-escaped-cells-cleaned-snippets-ca completed integration verify.

  • PR: #144
  • Branch: feat/svd-dev-mail-mind-mcp-109-compact-rows-and-mail-read-esc-dd0e8af0
  • Commit: 99788e1061
  • Build: none
  • Test: red
  • Reader audit clean: True
  • Spec fidelity: True
  • Ready for merge: False
  • Check forgejo commit statuses on PR head 99788e1: absent
  • Checks: Remote checks: none reported on PR #144 head 99788e1 (absent). Local: 888 passed, 8 skipped, ruff and mypy clean. Blocked on one missing spec-named test.
  • Blocker: Scenario '45 cc' maps to test_mail_read_caps_each_address_list in tests/test_compact_rows.py, which does not exist. The PR names it test_mail_read_caps_addresses_in_each_list.
  • Blocker cause: work for Scenario '45 cc' maps to test_mail_read_caps_each_address_list in tests/test_compact_rows.py, which does not exist. The PR names it test_mail_read_caps_addresses_in_each_list.; no denial signature; evidence: pytest --collect-only lists tests/test_compact_rows.py::test_mail_read_caps_addresses_in_each_list; no node id contains test_mail_read_caps_each_address_list.
  • Warning: self-review: expanded search docstring exceeds the existing description limit -> not fixed. This is resolved: commit de73d95 shortened the description, and tests/test_server.py now passes (888 passed, 8 skipped).
  • Warning: The subagent did not run final full checks. This lens ran the full unit suite, ruff and mypy --strict, and all passed. The audit step was not re-run here.
  • Warning: No Forgejo commit statuses exist for the PR head. No remote CI evidence is available.
  • Warning: no CI for forgejo commit statuses on PR head 99788e1: The Forgejo statuses endpoint for 99788e1 returned an empty list. The repo has no CI files by convention (.woodpecker is added by the architect). No tracking pointer exists. — reported as absent, not blocking (gh#633)
  • Rework: 2 round(s), outcome exhausted
  • Escalation: reached the 2-round rework cap without converging.
  • Decision: resolve the blockers above and rerun integrate, or park this PR for a human?
spec-verify-dispatch Half B for dev/mail-mind-mcp#109 compact-rows-and-mail-read-escaped-cells-cleaned-snippets-ca completed integration verify. - PR: https://git.groupthink.asia/dev/mail-mind-mcp/pulls/144 - Branch: feat/svd-dev-mail-mind-mcp-109-compact-rows-and-mail-read-esc-dd0e8af0 - Commit: 99788e1061ff8589d5c763762dfed1ba500a371d - Build: none - Test: red - Reader audit clean: True - Spec fidelity: True - Ready for merge: False - Check forgejo commit statuses on PR head 99788e1: absent - Checks: Remote checks: none reported on PR #144 head 99788e1 (absent). Local: 888 passed, 8 skipped, ruff and mypy clean. Blocked on one missing spec-named test. - Blocker: Scenario '45 cc' maps to test_mail_read_caps_each_address_list in tests/test_compact_rows.py, which does not exist. The PR names it test_mail_read_caps_addresses_in_each_list. - Blocker cause: work for Scenario '45 cc' maps to test_mail_read_caps_each_address_list in tests/test_compact_rows.py, which does not exist. The PR names it test_mail_read_caps_addresses_in_each_list.; no denial signature; evidence: pytest --collect-only lists tests/test_compact_rows.py::test_mail_read_caps_addresses_in_each_list; no node id contains test_mail_read_caps_each_address_list. - Warning: self-review: expanded search docstring exceeds the existing description limit -> not fixed. This is resolved: commit de73d95 shortened the description, and tests/test_server.py now passes (888 passed, 8 skipped). - Warning: The subagent did not run final full checks. This lens ran the full unit suite, ruff and mypy --strict, and all passed. The audit step was not re-run here. - Warning: No Forgejo commit statuses exist for the PR head. No remote CI evidence is available. - Warning: no CI for forgejo commit statuses on PR head 99788e1: The Forgejo statuses endpoint for 99788e1 returned an empty list. The repo has no CI files by convention (.woodpecker is added by the architect). No tracking pointer exists. — reported as absent, not blocking (gh#633) - Rework: 2 round(s), outcome exhausted - Escalation: reached the 2-round rework cap without converging. - Decision: resolve the blockers above and rerun integrate, or park this PR for a human?
Collaborator

spec-verify-dispatch Half B for dev/mail-mind-mcp#109 compact-rows-and-mail-read-escaped-cells-cleaned-snippets-ca completed integration verify.

  • PR: #144
  • Branch: feat/svd-dev-mail-mind-mcp-109-compact-rows-and-mail-read-esc-dd0e8af0
  • Commit: 99788e1061
  • Build: none
  • Test: green
  • Reader audit clean: True
  • Spec fidelity: True
  • Ready for merge: True
  • Check commit statuses on PR head 99788e1: absent
  • Checks: PR #144 head 99788e1 matches the local HEAD. It is open and its body has Closes #109. No Forgejo commit statuses exist (absent), and there are no CI files in the repo. Local: 888 passed, 8 skipped, 18 deselected. Ruff and mypy --strict are clean.
  • Warning: The SUBAGENT DEVIATIONS text is stale. It describes a stop at 192 passed, 1 failed on the mail_search description length. Later commits de73d95 and 99788e1 shortened the description to fit the existing limit. The full unit suite now passes.
  • Warning: self-review: expanded search docstring exceeds the existing description limit -> not fixed. This is resolved at head: tests/test_server.py passes, and test_fields_and_snippet_chars_description_stays_compact was added.
  • Warning: The shortened mail_search description dropped the sentence 'Unknown mailbox: warning and empty footer.' from the tool docstring. The README keeps it, and behaviour is unchanged.
  • Warning: No remote CI exists for this repo, so there is no remote check to read.
  • Warning: I ran the unit suite plus ruff and mypy --strict directly. I did not run make audit.
  • Warning: no CI for commit statuses on PR head 99788e1: The Forgejo statuses endpoint returned [] for the PR head. The repo has no CI directories (.forgejo, .github, .woodpecker); CI files are added by the architect. — reported as absent, not blocking (gh#633)
  • Decision: review the PR and merge? (codex-svd ship --run-id 20261102T120317Z-dd0e8af0 --confirm-merge)
spec-verify-dispatch Half B for dev/mail-mind-mcp#109 compact-rows-and-mail-read-escaped-cells-cleaned-snippets-ca completed integration verify. - PR: https://git.groupthink.asia/dev/mail-mind-mcp/pulls/144 - Branch: feat/svd-dev-mail-mind-mcp-109-compact-rows-and-mail-read-esc-dd0e8af0 - Commit: 99788e1061ff8589d5c763762dfed1ba500a371d - Build: none - Test: green - Reader audit clean: True - Spec fidelity: True - Ready for merge: True - Check commit statuses on PR head 99788e1: absent - Checks: PR #144 head 99788e1 matches the local HEAD. It is open and its body has Closes #109. No Forgejo commit statuses exist (absent), and there are no CI files in the repo. Local: 888 passed, 8 skipped, 18 deselected. Ruff and mypy --strict are clean. - Warning: The SUBAGENT DEVIATIONS text is stale. It describes a stop at 192 passed, 1 failed on the mail_search description length. Later commits de73d95 and 99788e1 shortened the description to fit the existing limit. The full unit suite now passes. - Warning: self-review: expanded search docstring exceeds the existing description limit -> not fixed. This is resolved at head: tests/test_server.py passes, and test_fields_and_snippet_chars_description_stays_compact was added. - Warning: The shortened mail_search description dropped the sentence 'Unknown mailbox: warning and empty footer.' from the tool docstring. The README keeps it, and behaviour is unchanged. - Warning: No remote CI exists for this repo, so there is no remote check to read. - Warning: I ran the unit suite plus ruff and mypy --strict directly. I did not run `make audit`. - Warning: no CI for commit statuses on PR head 99788e1: The Forgejo statuses endpoint returned [] for the PR head. The repo has no CI directories (.forgejo, .github, .woodpecker); CI files are added by the architect. — reported as absent, not blocking (gh#633) - Decision: review the PR and merge? (`codex-svd ship --run-id 20261102T120317Z-dd0e8af0 --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#109
No description provided.