Keep delimited signatures for mail_evidence: a sign_off column and a backlog #85

Closed
opened 2026-11-01 03:26:30 +00:00 by svc-agent-writer · 10 comments

Follows #84 (#78, ADR 0008 §2 as amended there). Blocks richer cards in dev/peoplemind-mcp#6.

Filed under: operator word "go" sha256:4cd0e21a9a07

Problem

mail_evidence cannot return a delimited signature. Ingest stores body_text after the blade's trim_quoted, which cuts everything from a -- or -- line onward, together with the quoted text (imap_blade_mcp/mime.py, trim_quoted). For this mail:

See attached.

Thanks,
Alice
-- 
Alice Example | CFO
ACME Pty Ltd
+61 2 5550 1234

the evidence is Thanks, / Alice. The title, the company and the phone are not in the mirror.

Proposal

  • Schema v8: a sign_off column. At ingest, the source still has the untrimmed text. It stores the block below the last -- delimiter that comes before any quoted text. The block is at most 8 lines and 600 characters, sanitised, and cut at 8 lines: a declared signature holds no body text. body_text, mail_read, FTS and embeddings do not change.
  • mail_evidence reads sign_off first and falls back to the rule of ADR 0008 §2 as amended in #84. The address redaction applies to both.
  • A backlog for mail mirrored before v8. Newest first, within a window (default 365 days), per_pass messages a pass. It uses the attachment backlog's byte path: the held raw message, then the bucket (blob_key), then the server. Without the backlog, only new mail gets the column.
  • A hit-rate report, counts only. mailmind evidence-stats --days 30 counts recent messages by how their sign-off was found: delimited, closing, name, none. The rule can then be tuned on a live instance without anyone reading mail.

Open questions

  1. Backlog window and default: 365 days, all, or none.
  2. Whether the IMAP source's BODYSTRUCTURE pass fetches the text part again for the backlog, or only messages with a held or bucket copy get the column.

Acceptance

  • A mail with a -- signature gives its delimited block in mail_evidence, on IMAP (GreenMail) and JMAP (Stalwart).
  • body_text and mail_read output do not change.
  • The schema v7 to v8 move adds the column; nothing else is rebuilt.
  • The backlog never fetches a message twice, and it stops at the window.
  • evidence-stats prints counts only: no address, name, subject or text.
  • An ADR 0008 amendment records the column and the delimited rule, accepted before the build.

Human act (done 2026-11-04)

ruling: the operator accepts the ADR 0008 amendment that stores a delimited sign-off block in the mirror (ADR-0008)

Done: PR #175 merged as 2c81e44 (ADR 0008 §2 amended, §11 added). The build is agent work; see the brief addendum.

Follows #84 (#78, ADR 0008 §2 as amended there). Blocks richer cards in dev/peoplemind-mcp#6. Filed under: operator word "go" sha256:4cd0e21a9a07 ## Problem `mail_evidence` cannot return a delimited signature. Ingest stores `body_text` after the blade's `trim_quoted`, which cuts everything from a `-- ` or `--` line onward, together with the quoted text (`imap_blade_mcp/mime.py`, `trim_quoted`). For this mail: ```text See attached. Thanks, Alice -- Alice Example | CFO ACME Pty Ltd +61 2 5550 1234 ``` the evidence is `Thanks, / Alice`. The title, the company and the phone are not in the mirror. ## Proposal - **Schema v8: a `sign_off` column.** At ingest, the source still has the untrimmed text. It stores the block below the last `-- ` delimiter that comes before any quoted text. The block is at most 8 lines and 600 characters, sanitised, and cut at 8 lines: a declared signature holds no body text. `body_text`, `mail_read`, FTS and embeddings do not change. - **`mail_evidence` reads `sign_off` first** and falls back to the rule of ADR 0008 §2 as amended in #84. The address redaction applies to both. - **A backlog for mail mirrored before v8.** Newest first, within a window (default 365 days), `per_pass` messages a pass. It uses the attachment backlog's byte path: the held raw message, then the bucket (`blob_key`), then the server. Without the backlog, only new mail gets the column. - **A hit-rate report, counts only.** `mailmind evidence-stats --days 30` counts recent messages by how their sign-off was found: `delimited`, `closing`, `name`, `none`. The rule can then be tuned on a live instance without anyone reading mail. ## Open questions 1. Backlog window and default: 365 days, all, or none. 2. Whether the IMAP source's BODYSTRUCTURE pass fetches the text part again for the backlog, or only messages with a held or bucket copy get the column. ## Acceptance - A mail with a `-- ` signature gives its delimited block in `mail_evidence`, on IMAP (GreenMail) and JMAP (Stalwart). - `body_text` and `mail_read` output do not change. - The schema v7 to v8 move adds the column; nothing else is rebuilt. - The backlog never fetches a message twice, and it stops at the window. - `evidence-stats` prints counts only: no address, name, subject or text. - An ADR 0008 amendment records the column and the delimited rule, accepted before the build. ## Human act (done 2026-11-04) ruling: the operator accepts the ADR 0008 amendment that stores a delimited sign-off block in the mirror (ADR-0008) Done: PR #175 merged as 2c81e44 (ADR 0008 §2 amended, §11 added). The build is agent work; see the brief addendum.
Author
Member

This was generated by AI during triage.

Brief (ready-for-human)

Category: enhancement
Summary: Store a delimited sign-off block per message at ingest, and backfill it for the last 365 days, so mail_evidence can return a -- signature.

Why a human holds this. It stores more third-party personal data in the mirror, and it changes the schema and the closed field contract of ADR 0008. The operator agreed the terms below on 2026-11-01. The remaining human act is the ruling on the written ADR 0008 amendment, which must carry these terms. Once that amendment merges, this issue can move to ready-for-agent with this brief as its contract.

Operator rulings (2026-11-01). Where this brief differs from the issue body, the brief holds.

  1. Backlog window: 365 days by default. backlog_days = 0 turns the backlog off. Newest first, at most per_pass messages a pass, and it stops at the window.
  2. Backlog bytes: the held raw message, then the bucket copy, then the server. From the server, fetch only the first text part, capped at 64 KB, never the whole raw message. On IMAP, use a partial BODY.PEEK of that section. On JMAP, use Email/get with fetchTextBodyValues and maxBodyValueBytes.
  3. Received mail only. The backlog and the ingest rule skip rows in Sent and Drafts. The owner's own sign-off is "no evidence" in mail_evidence anyway.
  4. The amendment terms.
    • The block is at most 8 lines and 600 characters. It stops at a disclaimer or list-footer line, as the ADR 0008 §2 rule does.
    • Addresses are redacted to [address] when the column is written, not when it is read. The column never holds an address.
    • NULL means the row is not scanned yet. An empty string means the row was scanned and has no block. The backlog selects NULL rows only, so it never fetches a message twice.
    • A bottom-posted reply, with quoted text above the signature, gets an empty block. That is an accepted miss.

Already decided:

  • Sign-offs hold phone numbers and titles. ADR 0008 §7 accepts this, and consent is the consumer's.
  • The byte path follows the attachment backlog (ADR 0007). Only the sync worker talks to a mail server (ADR 0006 §3).
  • evidence-stats and every log carry counts only.

Current behavior:

  • Both sources store body_text after the blade's trim_quoted, which cuts at the first -- or -- line. Text below a delimiter is never mirrored.
  • mail_evidence finds a sign-off only above a delimiter, by the ADR 0008 §2 rule.

Desired behavior:

  • At ingest, both sources keep the block below the last -- delimiter that comes before any quoted text, within the bounds above, in a new sign_off column.
  • mail_evidence reads sign_off first and falls back to the §2 rule.
  • body_text, mail_read, FTS and embeddings do not change.
  • mailmind evidence-stats --days 30 counts recent received messages by how their sign-off was found: delimited, closing, name, none.

Acceptance criteria:

  • The ADR 0008 amendment that records the column and the terms above is accepted before the build.
  • A mail with a -- signature gives its delimited block in mail_evidence, on IMAP (GreenMail) and on JMAP (Stalwart).
  • A block with an address stores [address] in the column.
  • A block stops before a disclaimer line, and at 8 lines or 600 characters.
  • body_text and mail_read output do not change.
  • The schema move adds the column and nothing else is rebuilt. It takes the next free version: v8 if #59 has not bumped the version first.
  • The backlog never fetches a message twice, skips Sent and Drafts, and stops at the window. backlog_days = 0 fetches nothing.
  • A server fetch reads at most 64 KB of the text part.
  • evidence-stats prints counts only: no address, name, subject or text.

Out of scope:

  • Any change to trim_quoted or to body_text.
  • Signatures in Sent and Drafts.
  • Any new mail_evidence field beyond the signature it already returns.
> *This was generated by AI during triage.* ## Brief (ready-for-human) **Category:** enhancement **Summary:** Store a delimited sign-off block per message at ingest, and backfill it for the last 365 days, so `mail_evidence` can return a `-- ` signature. **Why a human holds this.** It stores more third-party personal data in the mirror, and it changes the schema and the closed field contract of ADR 0008. The operator agreed the terms below on 2026-11-01. The remaining human act is the ruling on the written ADR 0008 amendment, which must carry these terms. Once that amendment merges, this issue can move to `ready-for-agent` with this brief as its contract. **Operator rulings (2026-11-01).** Where this brief differs from the issue body, the brief holds. 1. **Backlog window: 365 days by default.** `backlog_days = 0` turns the backlog off. Newest first, at most `per_pass` messages a pass, and it stops at the window. 2. **Backlog bytes: the held raw message, then the bucket copy, then the server.** From the server, fetch only the first text part, capped at 64 KB, never the whole raw message. On IMAP, use a partial `BODY.PEEK` of that section. On JMAP, use `Email/get` with `fetchTextBodyValues` and `maxBodyValueBytes`. 3. **Received mail only.** The backlog and the ingest rule skip rows in Sent and Drafts. The owner's own sign-off is "no evidence" in `mail_evidence` anyway. 4. **The amendment terms.** - The block is at most 8 lines and 600 characters. It stops at a disclaimer or list-footer line, as the ADR 0008 §2 rule does. - Addresses are redacted to `[address]` when the column is written, not when it is read. The column never holds an address. - NULL means the row is not scanned yet. An empty string means the row was scanned and has no block. The backlog selects NULL rows only, so it never fetches a message twice. - A bottom-posted reply, with quoted text above the signature, gets an empty block. That is an accepted miss. **Already decided:** - Sign-offs hold phone numbers and titles. ADR 0008 §7 accepts this, and consent is the consumer's. - The byte path follows the attachment backlog (ADR 0007). Only the sync worker talks to a mail server (ADR 0006 §3). - `evidence-stats` and every log carry counts only. **Current behavior:** - Both sources store `body_text` after the blade's `trim_quoted`, which cuts at the first `--` or `-- ` line. Text below a delimiter is never mirrored. - `mail_evidence` finds a sign-off only above a delimiter, by the ADR 0008 §2 rule. **Desired behavior:** - At ingest, both sources keep the block below the last `-- ` delimiter that comes before any quoted text, within the bounds above, in a new `sign_off` column. - `mail_evidence` reads `sign_off` first and falls back to the §2 rule. - `body_text`, `mail_read`, FTS and embeddings do not change. - `mailmind evidence-stats --days 30` counts recent received messages by how their sign-off was found: delimited, closing, name, none. **Acceptance criteria:** - [ ] The ADR 0008 amendment that records the column and the terms above is accepted before the build. - [ ] A mail with a `-- ` signature gives its delimited block in `mail_evidence`, on IMAP (GreenMail) and on JMAP (Stalwart). - [ ] A block with an address stores `[address]` in the column. - [ ] A block stops before a disclaimer line, and at 8 lines or 600 characters. - [ ] `body_text` and `mail_read` output do not change. - [ ] The schema move adds the column and nothing else is rebuilt. It takes the next free version: v8 if #59 has not bumped the version first. - [ ] The backlog never fetches a message twice, skips Sent and Drafts, and stops at the window. `backlog_days = 0` fetches nothing. - [ ] A server fetch reads at most 64 KB of the text part. - [ ] `evidence-stats` prints counts only: no address, name, subject or text. **Out of scope:** - Any change to `trim_quoted` or to `body_text`. - Signatures in Sent and Drafts. - Any new `mail_evidence` field beyond the signature it already returns.
Author
Member

This was generated by AI during triage.

Brief addendum (2026-11-04)

The ruling has landed: PR #175 merged as 2c81e44. ADR 0008 §11 is the contract for this build. Where §11 and the 2026-11-01 brief above differ, §11 holds. The operator chose to keep this as one unit, not three sub-issues.

Changes to the brief:

  1. Schema: the column takes v17 (the store is at v16, store.py:38), not v8. ALTER TABLE … ADD COLUMN with a NULL default; nothing else is rebuilt.
  2. Delimiter: a line that reads -- once trailing white space is removed, the test trim_quoted uses at pin v0.1.2 (imap_blade_mcp/mime.py:175, :186). Not -- only.
  3. Which delimiter: the first one, provided it comes before any quoted line, quote header or forward marker. Not the last one.
  4. Forwards: a delimiter below a forward marker gives an empty string.
  5. No 72-character stop inside the delimited block. The 8-line and 600-character caps and the disclaimer stop apply.
  6. Configuration: a [sign_off] section with backlog_days = 365 and per_pass = 100.
  7. Readers: mail_evidence and mail_peer_evidence_v1 both read the column, through the signature field only. The field list does not change.
  8. Not a mail change: writing the column adds no changes row and no peer event (ADR 0012). The FTS update trigger (store.py:70-71) does not fire for it.

Expected files. This is about 10 primary files, at the CONV-40 rule 2 limit:

  • src/mail_mind_mcp/: store.py (schema, column, backlog select, both evidence reads), ingest.py and jmap.py (capture at ingest, partial server fetch), source.py (backlog after each pass), evidence.py (the block extractor), config.py and cli.py (evidence-stats).
  • config.example.toml, README.md and SECURITY.md (its Evidence row describes the sign-off rule).
  • The tests named by the acceptance criteria above, including GreenMail and Stalwart.

Known runner constraints (from the SVD shortcomings register):

  • config.example.toml makes the PR T4 (dev/stables#1844). The operator hand-merges it, pinned to the gated head.
  • A unit of about ten files can hit the 2,700 s dispatch watchdog (dev/stables#1349). Fire dispatch with CODEX_SVD_STAGE_TIMEOUT_SECONDS=9000.

Added acceptance criteria:

  • A forwarded message with a delimiter below its forward marker stores an empty string.
  • A bare -- delimiter gives the same block as -- .
  • A mailing-list footer after the sender's signature does not replace the signature.
  • mail_peer_evidence_v1 returns the delimited block in signature, and its closed field test is unchanged.
  • Writing the column adds no changes row and no peer_events row.
  • The SECURITY.md Evidence row describes the delimited block.

Filed under: operator word "one unit, go" sha256:cb982d9fd784

> *This was generated by AI during triage.* ## Brief addendum (2026-11-04) The ruling has landed: PR #175 merged as `2c81e44`. **ADR 0008 §11 is the contract for this build.** Where §11 and the 2026-11-01 brief above differ, §11 holds. The operator chose to keep this as one unit, not three sub-issues. **Changes to the brief:** 1. **Schema:** the column takes v17 (the store is at v16, `store.py:38`), not v8. `ALTER TABLE … ADD COLUMN` with a NULL default; nothing else is rebuilt. 2. **Delimiter:** a line that reads `--` once trailing white space is removed, the test `trim_quoted` uses at pin v0.1.2 (`imap_blade_mcp/mime.py:175`, `:186`). Not `-- ` only. 3. **Which delimiter:** the first one, provided it comes before any quoted line, quote header or forward marker. Not the last one. 4. **Forwards:** a delimiter below a forward marker gives an empty string. 5. **No 72-character stop** inside the delimited block. The 8-line and 600-character caps and the disclaimer stop apply. 6. **Configuration:** a `[sign_off]` section with `backlog_days = 365` and `per_pass = 100`. 7. **Readers:** `mail_evidence` and `mail_peer_evidence_v1` both read the column, through the `signature` field only. The field list does not change. 8. **Not a mail change:** writing the column adds no `changes` row and no peer event (ADR 0012). The FTS update trigger (`store.py:70-71`) does not fire for it. **Expected files.** This is about 10 primary files, at the CONV-40 rule 2 limit: - `src/mail_mind_mcp/`: `store.py` (schema, column, backlog select, both evidence reads), `ingest.py` and `jmap.py` (capture at ingest, partial server fetch), `source.py` (backlog after each pass), `evidence.py` (the block extractor), `config.py` and `cli.py` (`evidence-stats`). - `config.example.toml`, `README.md` and `SECURITY.md` (its Evidence row describes the sign-off rule). - The tests named by the acceptance criteria above, including GreenMail and Stalwart. **Known runner constraints** (from the SVD shortcomings register): - `config.example.toml` makes the PR T4 (dev/stables#1844). The operator hand-merges it, pinned to the gated head. - A unit of about ten files can hit the 2,700 s dispatch watchdog (dev/stables#1349). Fire dispatch with `CODEX_SVD_STAGE_TIMEOUT_SECONDS=9000`. **Added acceptance criteria:** - [ ] A forwarded message with a delimiter below its forward marker stores an empty string. - [ ] A bare `--` delimiter gives the same block as `-- `. - [ ] A mailing-list footer after the sender's signature does not replace the signature. - [ ] `mail_peer_evidence_v1` returns the delimited block in `signature`, and its closed field test is unchanged. - [ ] Writing the column adds no `changes` row and no `peer_events` row. - [ ] The `SECURITY.md` Evidence row describes the delimited block. Filed under: operator word "one unit, go" sha256:cb982d9fd784
Collaborator

⏸ SVD architect gate: dev/mail-mind-mcp#85 keep-delimited-signatures-for-mail-evidence-a-sign-off-colum

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 substrate · dispatch effort high

Run: 20261103T234804Z-7a3eb939

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

Open risks:

  1. The operator ruled #85 'one unit, not three sub-issues', but the measured written set is about 26 files against the 16-file dispatch ceiling (11 test files hard-code schema v16 in 25 lines). This spec delivers slice 1 of 3 sequential specs and PRs under #85, with no new issues. Question: accept this slicing, with slices 2 (ingest capture plus readers plus SECURITY.md plus GreenMail/Stalwart tests) and 3 (backlog plus [sign_off] config plus evidence-stats plus config.example.toml) re-specced from #85 after merge? Or raise CODEX_SVD_SCOPE_MAX_FILES for this unit instead? [decision]
  2. The lean also ends the delimited block before a forward-marker line. That stop is not in ADR 0008 §11's literal stop list, but follows its 'belongs to the forwarded message's author' rationale. Question: keep this conservative stop (lean: yes; it only shortens a block), or drop it and store a 'Begin forwarded message:' line as a signature line? [decision]
  3. evidence.delimited_block imports the pinned blade's private _FORWARD_MARKER_RE and _QUOTE_HEADER_RE, so the sets are exactly 'those trim_quoted recognises' (§11). Question: is a private-name import from imap-blade-mcp v0.1.2 acceptable? Lean: yes; a blade rename fails loudly at import. The fallback is a verbatim copy from mime.py:154-165, keeping test_the_block_starts_where_trim_quoted_cuts. [decision]
  4. Schema-version freshness at dispatch: before the first edit, run grep -n '^SCHEMA_VERSION' src/mail_mind_mcp/store.py on the dispatch base. It must print SCHEMA_VERSION: Final = 16 (measured at 2c81e44 this session). If it prints 17 or more, another PR took v17; halt and re-spec to the next free version. [verification]
  5. Recorded for slice 3: ADR 0008 §11 orders the backlog's bytes as held raw, then bucket, then server. Today only AttachmentBacklog holds raws (source.py:230-235), only for messages with attachments, and it clears them after its run. Every row ingested in a pass gets its column at ingest (slice 2), so a held raw never belongs to a NULL row. Question for the slice 3 spec: may the sign-off backlog treat the held-raw step as vacuous and read bucket then server, without a second hold buffer? This does not affect slice 1. [decision]

Change: Slice 1 of 3 under #85. The full unit is about 26 files against the 16-file ceiling: 11 test files hard-code schema v16 in 25 lines. Schema v17: bump SCHEMA_VERSION (store.py:38), add sign_off TEXT to the messages DDL after date_utc (:126) and to _ADDED_COLUMNS (:3413), so _add_columns runs ALTER TABLE ADD COLUMN; nothing else is rebuilt. Add a defaulted sign_off: str | None = None to MessageRecord and MessageRow and map it in _message_row (:3349-3381). In upsert_messages (:1206-1290), insert it and use sign_off = COALESCE(excluded.sign_off, messages.sign_off), mirroring blob_key at :1231. Add Store.set_sign_offs as a copy of set_attachment_flags (:1657-1664) with a WHERE id = ? AND sign_off IS NULL guard: no changes row, no _emit, and messages_au (:71) does not name the column. Add a pure evidence.delimited_block(text) -> str implementing ADR 0008 §11 with the blade's own _FORWARD_MARKER_RE/_QUOTE_HEADER_RE (mime.py:154-165): first -- line (rstrip) before any quote, quote header (index>0) or forward marker; a forward marker or quote first gives ''. The block stops at the next delimiter, quote, quote header, forward marker or _BOILERPLATE line. Each line goes through _redact(sanitize_line(line)) as in evidence.py:84. Drop blank edges, cap at 8 lines, then at 600 characters at a line boundary; no 72-character stop. Bump the 25 test literals 16→17 at the listed lines (literal, because of the monkeypatch at test_store.py:428-432). Extend README.md:115 and :296 with the v17 first-start note. Slice 2 (ingest capture plus both readers plus SECURITY.md plus integration tests) and slice 3 (backlog, [sign_off] config, evidence-stats, config.example.toml) are planned in the note.

Files: src/mail_mind_mcp/store.py · src/mail_mind_mcp/evidence.py · tests/test_sign_off.py · tests/test_store.py · tests/test_mailbox_search.py · tests/test_peer_changes.py · tests/test_peer_snapshot.py · tests/test_embed_scans.py · tests/test_copy_collapse.py · tests/test_recipients.py · tests/test_evidence.py · tests/test_attachment_vectors.py · tests/test_utc_dates.py · tests/test_attachments.py · README.md

Decision: accept the 5 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-03-keep-delimited-signatures-for-mail-evidence-a-sign-off-colum.md — next: codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-03-keep-delimited-signatures-for-mail-evidence-a-sign-off-colum.md

### ⏸ SVD architect gate: dev/mail-mind-mcp#85 keep-delimited-signatures-for-mail-evidence-a-sign-off-colum **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 `substrate` · dispatch effort `high` **Run:** `20261103T234804Z-7a3eb939` **Held because:** CLEAN but 5 open risk(s) (1 verification · 4 decision) — HOLD-ALL parks everything. The risks, verbatim: **Open risks:** 1. The operator ruled #85 'one unit, not three sub-issues', but the measured written set is about 26 files against the 16-file dispatch ceiling (11 test files hard-code schema v16 in 25 lines). This spec delivers slice 1 of 3 sequential specs and PRs under #85, with no new issues. Question: accept this slicing, with slices 2 (ingest capture plus readers plus SECURITY.md plus GreenMail/Stalwart tests) and 3 (backlog plus [sign_off] config plus evidence-stats plus config.example.toml) re-specced from #85 after merge? Or raise CODEX_SVD_SCOPE_MAX_FILES for this unit instead? [decision] 2. The lean also ends the delimited block before a forward-marker line. That stop is not in ADR 0008 §11's literal stop list, but follows its 'belongs to the forwarded message's author' rationale. Question: keep this conservative stop (lean: yes; it only shortens a block), or drop it and store a 'Begin forwarded message:' line as a signature line? [decision] 3. evidence.delimited_block imports the pinned blade's private _FORWARD_MARKER_RE and _QUOTE_HEADER_RE, so the sets are exactly 'those trim_quoted recognises' (§11). Question: is a private-name import from imap-blade-mcp v0.1.2 acceptable? Lean: yes; a blade rename fails loudly at import. The fallback is a verbatim copy from mime.py:154-165, keeping test_the_block_starts_where_trim_quoted_cuts. [decision] 4. Schema-version freshness at dispatch: before the first edit, run `grep -n '^SCHEMA_VERSION' src/mail_mind_mcp/store.py` on the dispatch base. It must print `SCHEMA_VERSION: Final = 16` (measured at 2c81e44 this session). If it prints 17 or more, another PR took v17; halt and re-spec to the next free version. [verification] 5. Recorded for slice 3: ADR 0008 §11 orders the backlog's bytes as held raw, then bucket, then server. Today only AttachmentBacklog holds raws (source.py:230-235), only for messages with attachments, and it clears them after its run. Every row ingested in a pass gets its column at ingest (slice 2), so a held raw never belongs to a NULL row. Question for the slice 3 spec: may the sign-off backlog treat the held-raw step as vacuous and read bucket then server, without a second hold buffer? This does not affect slice 1. [decision] **Change:** Slice 1 of 3 under #85. The full unit is about 26 files against the 16-file ceiling: 11 test files hard-code schema v16 in 25 lines. Schema v17: bump SCHEMA_VERSION (store.py:38), add `sign_off TEXT` to the messages DDL after date_utc (:126) and to _ADDED_COLUMNS (:3413), so _add_columns runs ALTER TABLE ADD COLUMN; nothing else is rebuilt. Add a defaulted `sign_off: str | None = None` to MessageRecord and MessageRow and map it in _message_row (:3349-3381). In upsert_messages (:1206-1290), insert it and use `sign_off = COALESCE(excluded.sign_off, messages.sign_off)`, mirroring blob_key at :1231. Add Store.set_sign_offs as a copy of set_attachment_flags (:1657-1664) with a `WHERE id = ? AND sign_off IS NULL` guard: no changes row, no _emit, and messages_au (:71) does not name the column. Add a pure evidence.delimited_block(text) -> str implementing ADR 0008 §11 with the blade's own _FORWARD_MARKER_RE/_QUOTE_HEADER_RE (mime.py:154-165): first `--` line (rstrip) before any quote, quote header (index>0) or forward marker; a forward marker or quote first gives ''. The block stops at the next delimiter, quote, quote header, forward marker or _BOILERPLATE line. Each line goes through _redact(sanitize_line(line)) as in evidence.py:84. Drop blank edges, cap at 8 lines, then at 600 characters at a line boundary; no 72-character stop. Bump the 25 test literals 16→17 at the listed lines (literal, because of the monkeypatch at test_store.py:428-432). Extend README.md:115 and :296 with the v17 first-start note. Slice 2 (ingest capture plus both readers plus SECURITY.md plus integration tests) and slice 3 (backlog, [sign_off] config, evidence-stats, config.example.toml) are planned in the note. **Files:** `src/mail_mind_mcp/store.py` · `src/mail_mind_mcp/evidence.py` · `tests/test_sign_off.py` · `tests/test_store.py` · `tests/test_mailbox_search.py` · `tests/test_peer_changes.py` · `tests/test_peer_snapshot.py` · `tests/test_embed_scans.py` · `tests/test_copy_collapse.py` · `tests/test_recipients.py` · `tests/test_evidence.py` · `tests/test_attachment_vectors.py` · `tests/test_utc_dates.py` · `tests/test_attachments.py` · `README.md` **Decision:** accept the 5 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-03-keep-delimited-signatures-for-mail-evidence-a-sign-off-colum.md` — next: `codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-03-keep-delimited-signatures-for-mail-evidence-a-sign-off-colum.md`</sub>
Collaborator

spec-verify-dispatch Half B for dev/mail-mind-mcp#85 keep-delimited-signatures-for-mail-evidence-a-sign-off-colum completed integration verify.

  • PR: #176
  • Branch: feat/svd-dev-mail-mind-mcp-85-keep-delimited-signatures-for-m-9304eb4a
  • Commit: 7984f19555
  • 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/44/1
  • Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll
  • Warning: Woodpecker validation on the PR head is still pending; readyForMerge stays false until it is green.
  • Warning: The spec has no scenario table, so no scenario tracing applied. All 16 planned tests in tests/test_sign_off.py exist and collect and pass.
  • Warning: Observed teardown noise (logging ValueError: I/O operation on closed file) in the targeted pytest run. All tests passed.
  • CI wait: ci/woodpecker/pr/validation -> pass
  • Decision: review the PR and merge? (codex-svd ship --run-id 20261104T003713Z-9304eb4a --confirm-merge)
spec-verify-dispatch Half B for dev/mail-mind-mcp#85 keep-delimited-signatures-for-mail-evidence-a-sign-off-colum completed integration verify. - PR: https://git.groupthink.asia/dev/mail-mind-mcp/pulls/176 - Branch: feat/svd-dev-mail-mind-mcp-85-keep-delimited-signatures-for-m-9304eb4a - Commit: 7984f19555f95882c0c79a9116f21143d486a6ab - 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/44/1 - Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll - Warning: Woodpecker validation on the PR head is still pending; readyForMerge stays false until it is green. - Warning: The spec has no scenario table, so no scenario tracing applied. All 16 planned tests in tests/test_sign_off.py exist and collect and pass. - Warning: Observed teardown noise (logging ValueError: I/O operation on closed file) in the targeted pytest run. All tests passed. - CI wait: ci/woodpecker/pr/validation -> pass - Decision: review the PR and merge? (`codex-svd ship --run-id 20261104T003713Z-9304eb4a --confirm-merge`)
piers referenced this issue from a commit 2026-11-04 01:23:25 +00:00
Collaborator

⏸ SVD architect gate: dev/mail-mind-mcp#85 keep-delimited-signatures-for-mail-evidence-a-sign-off-colum

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 substrate · dispatch effort high

Run: 20261104T021253Z-9b5b6385

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

Open risks:

  1. This is new in slice 2; slice 1 touched no reader. The pinned mail-people/1.0 schema caps each signature line at 1-72 characters (contracts/mind-v1/schema.json:202-214, peer.py:99-108). §11 keeps lines over 72 characters and interior blank lines in the stored block, and slice-1 tests pin both (tests/test_sign_off.py:93-94, :127). Question: may mail_peer_evidence_v1 show a stored block with each line over 72 characters cut to 71 plus '…' and blank lines dropped, while mail_evidence keeps full lines (blank lines also dropped)? Lean: yes. It mirrors the subject cut at peer.py:638-639 and leaves the contract and field list unchanged. Alternatives: (a) fall back to the §2 rule for the peer tool when the block does not fit, or (b) raise maxLength in a mind-v1 contract minor, which is out of this slice and ADR. [decision]
  2. The GreenMail and Stalwart tests are host-only (.woodpecker/validation.yaml:20-21), and the dispatch worktree may have no container engine. Check after dispatch, on the host with make greenmail-up stalwart-up: run MAILMIND_GREENMAIL=1 MAILMIND_STALWART=1 IMAP_BLADE_DIR=../imap-blade-mcp uv run python3 -m pytest -q -m integration -k delimited_signature tests/integration/test_greenmail.py tests/integration/test_stalwart.py; both new tests must pass. Then run make test-integration to confirm no existing integration test regressed. [verification]

Change: Slice 2 of 3 under #85. ADR 0008 §11 is the contract; base is fad5553.
(1) evidence.py: add UNSCANNED_ROLES={'sent','drafts'}. Add ingest_block(role, text): None for Sent/Drafts, '' when no text was read, else delimited_block(text), which stays unchanged. Add stored_lines(stored, line_chars=None): None for NULL or '', drops blank lines, and with line_chars cuts a longer line to 71 characters plus '…'. Change signatures and signatures_bounded (evidence.py:204, :228) to take (text, name, stored) 3-tuples, using stored_lines(...) or sign_off(...). The peer path passes line_chars=72 and refuses a stored value over 4,096 bytes.
(2) store.py: append 'sign_off' to PEER_SAMPLE_TEXT (:564-576), which brings it under the existing SQL byte guard, and add PeerSample.sign_off (:579-590). Nothing else changes; no schema move.
(3) ingest.py: _record (:352-411) sets scanned=text after the HTML conversion and before trim_quoted, then sign_off=ingest_block(mailbox.role, scanned). _message_text (:597-626) also returns the untrimmed text, and _raw_record (:280-323) uses it when whole.
(4) jmap.py: _body_text (:1072-1087) returns (trimmed, untrimmed-or-None), with None when isTruncated or there is no text part. _record (:919) takes a role parameter. _add (:608-625) passes the role of names[0] from a path→role map.
(5) server.py:994 and peer.py:632 pass row.sign_off as the third element.
(6) SECURITY.md:11 Evidence row describes the delimited rule.
(7) Mechanical 3-tuple updates in tests/test_evidence.py:364-372 (closed field test untouched), tests/test_peer_evidence.py:302-305 and :436 (plus ('sign_off', 4097) in the oversize parametrisation at :310), and tests/test_peer_contract.py:204.
Mirror the subject cut at peer.py:638-639 and the GreenMail Papers create/append/delete pattern at test_greenmail.py:135-193.

Files: src/mail_mind_mcp/evidence.py · src/mail_mind_mcp/ingest.py · src/mail_mind_mcp/jmap.py · src/mail_mind_mcp/server.py · src/mail_mind_mcp/peer.py · src/mail_mind_mcp/store.py · SECURITY.md · tests/test_sign_off.py · tests/test_evidence.py · tests/test_peer_evidence.py · tests/test_peer_contract.py · tests/integration/test_greenmail.py · tests/integration/test_stalwart.py

Decision: 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):

  • 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-04-keep-delimited-signatures-for-mail-evidence-a-sign-off-colum.md — next: codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-04-keep-delimited-signatures-for-mail-evidence-a-sign-off-colum.md

### ⏸ SVD architect gate: dev/mail-mind-mcp#85 keep-delimited-signatures-for-mail-evidence-a-sign-off-colum **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 `substrate` · dispatch effort `high` **Run:** `20261104T021253Z-9b5b6385` **Held because:** CLEAN but 2 open risk(s) (1 verification · 1 decision) — HOLD-ALL parks everything. The risks, verbatim: **Open risks:** 1. This is new in slice 2; slice 1 touched no reader. The pinned mail-people/1.0 schema caps each signature line at 1-72 characters (contracts/mind-v1/schema.json:202-214, peer.py:99-108). §11 keeps lines over 72 characters and interior blank lines in the stored block, and slice-1 tests pin both (tests/test_sign_off.py:93-94, :127). Question: may mail_peer_evidence_v1 show a stored block with each line over 72 characters cut to 71 plus '…' and blank lines dropped, while mail_evidence keeps full lines (blank lines also dropped)? Lean: yes. It mirrors the subject cut at peer.py:638-639 and leaves the contract and field list unchanged. Alternatives: (a) fall back to the §2 rule for the peer tool when the block does not fit, or (b) raise maxLength in a mind-v1 contract minor, which is out of this slice and ADR. [decision] 2. The GreenMail and Stalwart tests are host-only (.woodpecker/validation.yaml:20-21), and the dispatch worktree may have no container engine. Check after dispatch, on the host with `make greenmail-up stalwart-up`: run `MAILMIND_GREENMAIL=1 MAILMIND_STALWART=1 IMAP_BLADE_DIR=../imap-blade-mcp uv run python3 -m pytest -q -m integration -k delimited_signature tests/integration/test_greenmail.py tests/integration/test_stalwart.py`; both new tests must pass. Then run `make test-integration` to confirm no existing integration test regressed. [verification] **Change:** Slice 2 of 3 under #85. ADR 0008 §11 is the contract; base is fad5553. (1) evidence.py: add UNSCANNED_ROLES={'sent','drafts'}. Add ingest_block(role, text): None for Sent/Drafts, '' when no text was read, else delimited_block(text), which stays unchanged. Add stored_lines(stored, line_chars=None): None for NULL or '', drops blank lines, and with line_chars cuts a longer line to 71 characters plus '…'. Change signatures and signatures_bounded (evidence.py:204, :228) to take (text, name, stored) 3-tuples, using stored_lines(...) or sign_off(...). The peer path passes line_chars=72 and refuses a stored value over 4,096 bytes. (2) store.py: append 'sign_off' to PEER_SAMPLE_TEXT (:564-576), which brings it under the existing SQL byte guard, and add PeerSample.sign_off (:579-590). Nothing else changes; no schema move. (3) ingest.py: _record (:352-411) sets scanned=text after the HTML conversion and before trim_quoted, then sign_off=ingest_block(mailbox.role, scanned). _message_text (:597-626) also returns the untrimmed text, and _raw_record (:280-323) uses it when whole. (4) jmap.py: _body_text (:1072-1087) returns (trimmed, untrimmed-or-None), with None when isTruncated or there is no text part. _record (:919) takes a role parameter. _add (:608-625) passes the role of names[0] from a path→role map. (5) server.py:994 and peer.py:632 pass row.sign_off as the third element. (6) SECURITY.md:11 Evidence row describes the delimited rule. (7) Mechanical 3-tuple updates in tests/test_evidence.py:364-372 (closed field test untouched), tests/test_peer_evidence.py:302-305 and :436 (plus ('sign_off', 4097) in the oversize parametrisation at :310), and tests/test_peer_contract.py:204. Mirror the subject cut at peer.py:638-639 and the GreenMail Papers create/append/delete pattern at test_greenmail.py:135-193. **Files:** `src/mail_mind_mcp/evidence.py` · `src/mail_mind_mcp/ingest.py` · `src/mail_mind_mcp/jmap.py` · `src/mail_mind_mcp/server.py` · `src/mail_mind_mcp/peer.py` · `src/mail_mind_mcp/store.py` · `SECURITY.md` · `tests/test_sign_off.py` · `tests/test_evidence.py` · `tests/test_peer_evidence.py` · `tests/test_peer_contract.py` · `tests/integration/test_greenmail.py` · `tests/integration/test_stalwart.py` **Decision:** 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`): - 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-04-keep-delimited-signatures-for-mail-evidence-a-sign-off-colum.md` — next: `codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-04-keep-delimited-signatures-for-mail-evidence-a-sign-off-colum.md`</sub>
Collaborator

spec-verify-dispatch Half B for dev/mail-mind-mcp#85 keep-delimited-signatures-for-mail-evidence-a-sign-off-colum completed integration verify.

  • PR: #182
  • Branch: feat/svd-dev-mail-mind-mcp-85-keep-delimited-signatures-for-m-c80b2494
  • Commit: 77e62c029b
  • 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/56/1
  • Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll
  • Warning: GreenMail and Stalwart integration tests (test_a_delimited_signature_reaches_mail_evidence, test_a_delimited_signature_reaches_mail_evidence_over_jmap) exist but were not run; host-only operator follow-up accepted at the architect gate.
  • Warning: self-review: Stalwart Sent copy makes Carol an owner address -> fixed by including self in both integration reader calls; unverified until the host run.
  • CI wait: ci/woodpecker/pr/validation -> pass
  • Decision: review the PR and merge? (codex-svd ship --run-id 20261104T023247Z-c80b2494 --confirm-merge)
spec-verify-dispatch Half B for dev/mail-mind-mcp#85 keep-delimited-signatures-for-mail-evidence-a-sign-off-colum completed integration verify. - PR: https://git.groupthink.asia/dev/mail-mind-mcp/pulls/182 - Branch: feat/svd-dev-mail-mind-mcp-85-keep-delimited-signatures-for-m-c80b2494 - Commit: 77e62c029b13a90cc13a1622b4dd07c27b95dbff - 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/56/1 - Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll - Warning: GreenMail and Stalwart integration tests (test_a_delimited_signature_reaches_mail_evidence, test_a_delimited_signature_reaches_mail_evidence_over_jmap) exist but were not run; host-only operator follow-up accepted at the architect gate. - Warning: self-review: Stalwart Sent copy makes Carol an owner address -> fixed by including self in both integration reader calls; unverified until the host run. - CI wait: ci/woodpecker/pr/validation -> pass - Decision: review the PR and merge? (`codex-svd ship --run-id 20261104T023247Z-c80b2494 --confirm-merge`)
Collaborator

spec-verify-dispatch Half B for dev/mail-mind-mcp#85 keep-delimited-signatures-for-mail-evidence-a-sign-off-colum completed integration verify.

  • PR: #182
  • Branch: feat/svd-dev-mail-mind-mcp-85-keep-delimited-signatures-for-m-c80b2494
  • Commit: (unknown)
  • Build: deferred
  • Test: deferred
  • Reader audit clean: False
  • Spec fidelity: False
  • Ready for merge: False
  • Checks: head-mismatch: recorded worktree /Users/piers/.codex/workflow-runs/spec-verify-dispatch/20261104T023247Z-c80b2494/worktree is missing; integrate does not recreate it
  • Forbidden-mutation check: unmeasured (no diff base recorded)
  • Blocker: head-mismatch: recorded worktree /Users/piers/.codex/workflow-runs/spec-verify-dispatch/20261104T023247Z-c80b2494/worktree is missing; integrate does not recreate it
  • Blocker cause: infra for head-mismatch: recorded worktree /Users/piers/.codex/workflow-runs/spec-verify-dispatch/20261104T023247Z-c80b2494/worktree is missing; integrate does not recreate it; no denial signature; evidence: raised by the runner before any test ran
  • Rework: 0 round(s), outcome head-mismatch
  • Escalation: head-mismatch: recorded worktree /Users/piers/.codex/workflow-runs/spec-verify-dispatch/20261104T023247Z-c80b2494/worktree is missing; integrate does not recreate it
  • 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#85 keep-delimited-signatures-for-mail-evidence-a-sign-off-colum completed integration verify. - PR: https://git.groupthink.asia/dev/mail-mind-mcp/pulls/182 - Branch: feat/svd-dev-mail-mind-mcp-85-keep-delimited-signatures-for-m-c80b2494 - Commit: (unknown) - Build: deferred - Test: deferred - Reader audit clean: False - Spec fidelity: False - Ready for merge: False - Checks: head-mismatch: recorded worktree /Users/piers/.codex/workflow-runs/spec-verify-dispatch/20261104T023247Z-c80b2494/worktree is missing; integrate does not recreate it - Forbidden-mutation check: unmeasured (no diff base recorded) - Blocker: head-mismatch: recorded worktree /Users/piers/.codex/workflow-runs/spec-verify-dispatch/20261104T023247Z-c80b2494/worktree is missing; integrate does not recreate it - Blocker cause: infra for head-mismatch: recorded worktree /Users/piers/.codex/workflow-runs/spec-verify-dispatch/20261104T023247Z-c80b2494/worktree is missing; integrate does not recreate it; no denial signature; evidence: raised by the runner before any test ran - Rework: 0 round(s), outcome head-mismatch - Escalation: head-mismatch: recorded worktree /Users/piers/.codex/workflow-runs/spec-verify-dispatch/20261104T023247Z-c80b2494/worktree is missing; integrate does not recreate it - 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#85 keep-delimited-signatures-for-mail-evidence-a-sign-off-colum completed integration verify.

  • PR: #182
  • Branch: feat/svd-dev-mail-mind-mcp-85-keep-delimited-signatures-for-m-c80b2494
  • Commit: ec5c1812bb
  • 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/57/1
  • Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll
  • Warning: mypy is not installed in the uv venv (uv run mypy src and uv run --all-groups mypy src fail with 'Failed to spawn: mypy'), so make check stopped at the type step. ruff check and ruff format --check passed. The type check and the audit step are covered only by remote CI.
  • Warning: Host-only GreenMail and Stalwart integration tests (test_a_delimited_signature_reaches_mail_evidence and its Stalwart twin) were not run here. The architect gate accepted this as an operator follow-up.
  • Warning: Spec has no scenario table, so no scenario trace applied. All planned test names in Test Strategy exist and collect from tests/test_sign_off.py.
  • Warning: Acceptance CHECK counts: grep of sign_off/delimited_block/ingest_block in ingest/jmap/server/peer gives 7 (needs at least 6). The PEER_SAMPLE_TEXT sign_off count is 1 (needs 1).
  • Warning: self-review: Stalwart Sent copy makes Carol an owner address -> fixed by including self in both integration reader calls (advisory only).
  • CI wait: ci/woodpecker/pr/validation -> pass
  • Decision: review the PR and merge? (codex-svd ship --run-id 20261104T023247Z-c80b2494 --confirm-merge)
spec-verify-dispatch Half B for dev/mail-mind-mcp#85 keep-delimited-signatures-for-mail-evidence-a-sign-off-colum completed integration verify. - PR: https://git.groupthink.asia/dev/mail-mind-mcp/pulls/182 - Branch: feat/svd-dev-mail-mind-mcp-85-keep-delimited-signatures-for-m-c80b2494 - Commit: ec5c1812bb0019b64fd0eb807cefcdc517846a8d - 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/57/1 - Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll - Warning: mypy is not installed in the uv venv (`uv run mypy src` and `uv run --all-groups mypy src` fail with 'Failed to spawn: mypy'), so `make check` stopped at the type step. ruff check and ruff format --check passed. The type check and the audit step are covered only by remote CI. - Warning: Host-only GreenMail and Stalwart integration tests (test_a_delimited_signature_reaches_mail_evidence and its Stalwart twin) were not run here. The architect gate accepted this as an operator follow-up. - Warning: Spec has no scenario table, so no scenario trace applied. All planned test names in Test Strategy exist and collect from tests/test_sign_off.py. - Warning: Acceptance CHECK counts: grep of sign_off/delimited_block/ingest_block in ingest/jmap/server/peer gives 7 (needs at least 6). The PEER_SAMPLE_TEXT sign_off count is 1 (needs 1). - Warning: self-review: Stalwart Sent copy makes Carol an owner address -> fixed by including self in both integration reader calls (advisory only). - CI wait: ci/woodpecker/pr/validation -> pass - Decision: review the PR and merge? (`codex-svd ship --run-id 20261104T023247Z-c80b2494 --confirm-merge`)
Collaborator

⏸ SVD architect gate: dev/mail-mind-mcp#85 keep-delimited-signatures-for-mail-evidence-a-sign-off-colum

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 substrate · dispatch effort high

Run: 20261104T034632Z-cfdefc74

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

Open risks:

  1. Slice-1 Open Risk 5 (the held-raw step), resolved on evidence. What changed: slice 2 is merged, so the premise is now measured, not assumed. The only three hold( call sites sit inside record builders that set sign_off=ingest_block(...): ingest.py:300->:325, :348->:415 and jmap.py:1006->:961. ingest_block is NULL only for Sent and Drafts, which the backlog never selects, and AttachmentBacklog clears its held raws in finally (source.py:281-283). Question: accept that §11's 'raw message the worker holds' step is vacuous, so the sign-off backlog reads bucket then server with no hold buffer? A unit test pins the premise (test_a_pass_runs_the_backlog_and_leaves_no_unscanned_received_row). Lean: yes. [decision]
  2. New in slice 3: the pending latch. SignOffBacklog stops querying once a run returns fewer than per_pass rows without a retryable stall, and a sync restart re-arms it. The reason is cost: sign_off sits after body_text in the row (store.py:121 vs :132), so the NULL filter reads overflow pages for every row in the window, and a partial index would be a schema change that §11 forbids. Consequence: a JMAP in-place move of a Sent or Drafts row into a received mailbox, or a row whose date falls into the window later, stays NULL until the next restart and falls back to the §2 rule. Question: accept the latch (lean: yes), or query every pass at the overflow-read cost? [decision]
  3. The new GreenMail and Stalwart backlog tests are host-only (.woodpecker/validation.yaml:20-21). What changed since slice 2: the slice-2 delimited_signature tests are also still unverified on the host, so this check covers both. Check, on the host after dispatch: make greenmail-up stalwart-up, then MAILMIND_GREENMAIL=1 MAILMIND_STALWART=1 IMAP_BLADE_DIR=../imap-blade-mcp uv run python3 -m pytest -q -m integration -k "pre_v17_row or delimited_signature" tests/integration/test_greenmail.py tests/integration/test_stalwart.py. All four tests must pass. Then run make test-integration to confirm no existing integration test regressed. [verification]

Change: Slice 3 of 3 under #85 (base bb5d252; the contract is ADR 0008 §11).
(1) config.py: add SignOffConfig(backlog_days=365 ge0 le36500, per_pass=100 ge1 le500), shaped like AttachmentsConfig at :242-260. MailmindConfig.sign_off uses default_factory, so it is on by default.
(2) store.py: add a frozen UnscannedRow(id, account, mailbox, uidvalidity, uid, blob_key, source_id). Add Store.unscanned(account, since, limit), shaped like unextracted at :1643-1656: NULL sign_off, date_utc >= since, not in the sent/drafts roles, ordered date_utc DESC, id DESC. Add Store.sign_off_kinds(since), which groups like assessments at :1765-1780 and counts by evidence.sign_off_kind with fetchmany.
(3) evidence.py: add SIGN_OFF_KINDS and sign_off_kind(text, name, stored). It returns delimited when stored_lines is set, else closing or name from _CLOSING.match(block[0]) of the §2 block, else none.
(4) source.py: add SignOffBacklog, mirroring AttachmentBacklog at :205-377 (from_config is None when backlog_days=0; run never raises; bucket by blob_key, then server via FetchText). Add SIGN_OFF_FETCH_BYTES = 64 KB. No hold buffer. A pending latch clears when a run comes back short. Add _raw_text, copied from ingest._message_text at :604-622.
(5) ingest.py: wire the backlog after the attachment hook at :157-158. Add _fetch_text, mirroring _fetch_parts at :460-476: examine_for, BODYSTRUCTURE, choose_body_part, fetch_section(section, 0, 65536), part_to_text(partial).
(6) jmap.py: wire the backlog after :445-446. Split _body_text at :1077-1093 into _first_text without changing its result. Add _fetch_text: Email/get of textBody and bodyValues with fetchTextBodyValues and maxBodyValueBytes=65536. It scans truncated text and never downloads the raw message.
(7) cli.py: add an evidence-stats --days 1..365 (default 30) command, shaped like cmd_replay at :151-178. It prints counts only.
(8) Docs: config.example.toml [sign_off]; a README config row, CLI line and note; one sentence in the SECURITY.md:11 Evidence row.

Files: src/mail_mind_mcp/config.py · src/mail_mind_mcp/store.py · src/mail_mind_mcp/evidence.py · src/mail_mind_mcp/source.py · src/mail_mind_mcp/ingest.py · src/mail_mind_mcp/jmap.py · src/mail_mind_mcp/cli.py · config.example.toml · README.md · SECURITY.md · tests/test_sign_off_backlog.py · tests/integration/test_greenmail.py · tests/integration/test_stalwart.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-04-keep-delimited-signatures-for-mail-evidence-a-sign-off-colum-slice-3.md — next: codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-04-keep-delimited-signatures-for-mail-evidence-a-sign-off-colum-slice-3.md

### ⏸ SVD architect gate: dev/mail-mind-mcp#85 keep-delimited-signatures-for-mail-evidence-a-sign-off-colum **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 `substrate` · dispatch effort `high` **Run:** `20261104T034632Z-cfdefc74` **Held because:** CLEAN but 3 open risk(s) (1 verification · 2 decision) — HOLD-ALL parks everything. The risks, verbatim: **Open risks:** 1. Slice-1 Open Risk 5 (the held-raw step), resolved on evidence. What changed: slice 2 is merged, so the premise is now measured, not assumed. The only three hold( call sites sit inside record builders that set sign_off=ingest_block(...): ingest.py:300->:325, :348->:415 and jmap.py:1006->:961. ingest_block is NULL only for Sent and Drafts, which the backlog never selects, and AttachmentBacklog clears its held raws in finally (source.py:281-283). Question: accept that §11's 'raw message the worker holds' step is vacuous, so the sign-off backlog reads bucket then server with no hold buffer? A unit test pins the premise (test_a_pass_runs_the_backlog_and_leaves_no_unscanned_received_row). Lean: yes. [decision] 2. New in slice 3: the pending latch. SignOffBacklog stops querying once a run returns fewer than per_pass rows without a retryable stall, and a sync restart re-arms it. The reason is cost: sign_off sits after body_text in the row (store.py:121 vs :132), so the NULL filter reads overflow pages for every row in the window, and a partial index would be a schema change that §11 forbids. Consequence: a JMAP in-place move of a Sent or Drafts row into a received mailbox, or a row whose date falls into the window later, stays NULL until the next restart and falls back to the §2 rule. Question: accept the latch (lean: yes), or query every pass at the overflow-read cost? [decision] 3. The new GreenMail and Stalwart backlog tests are host-only (.woodpecker/validation.yaml:20-21). What changed since slice 2: the slice-2 delimited_signature tests are also still unverified on the host, so this check covers both. Check, on the host after dispatch: make greenmail-up stalwart-up, then MAILMIND_GREENMAIL=1 MAILMIND_STALWART=1 IMAP_BLADE_DIR=../imap-blade-mcp uv run python3 -m pytest -q -m integration -k "pre_v17_row or delimited_signature" tests/integration/test_greenmail.py tests/integration/test_stalwart.py. All four tests must pass. Then run make test-integration to confirm no existing integration test regressed. [verification] **Change:** Slice 3 of 3 under #85 (base bb5d252; the contract is ADR 0008 §11). (1) config.py: add SignOffConfig(backlog_days=365 ge0 le36500, per_pass=100 ge1 le500), shaped like AttachmentsConfig at :242-260. MailmindConfig.sign_off uses default_factory, so it is on by default. (2) store.py: add a frozen UnscannedRow(id, account, mailbox, uidvalidity, uid, blob_key, source_id). Add Store.unscanned(account, since, limit), shaped like unextracted at :1643-1656: NULL sign_off, date_utc >= since, not in the sent/drafts roles, ordered date_utc DESC, id DESC. Add Store.sign_off_kinds(since), which groups like assessments at :1765-1780 and counts by evidence.sign_off_kind with fetchmany. (3) evidence.py: add SIGN_OFF_KINDS and sign_off_kind(text, name, stored). It returns delimited when stored_lines is set, else closing or name from _CLOSING.match(block[0]) of the §2 block, else none. (4) source.py: add SignOffBacklog, mirroring AttachmentBacklog at :205-377 (from_config is None when backlog_days=0; run never raises; bucket by blob_key, then server via FetchText). Add SIGN_OFF_FETCH_BYTES = 64 KB. No hold buffer. A pending latch clears when a run comes back short. Add _raw_text, copied from ingest._message_text at :604-622. (5) ingest.py: wire the backlog after the attachment hook at :157-158. Add _fetch_text, mirroring _fetch_parts at :460-476: examine_for, BODYSTRUCTURE, choose_body_part, fetch_section(section, 0, 65536), part_to_text(partial). (6) jmap.py: wire the backlog after :445-446. Split _body_text at :1077-1093 into _first_text without changing its result. Add _fetch_text: Email/get of textBody and bodyValues with fetchTextBodyValues and maxBodyValueBytes=65536. It scans truncated text and never downloads the raw message. (7) cli.py: add an evidence-stats --days 1..365 (default 30) command, shaped like cmd_replay at :151-178. It prints counts only. (8) Docs: config.example.toml [sign_off]; a README config row, CLI line and note; one sentence in the SECURITY.md:11 Evidence row. **Files:** `src/mail_mind_mcp/config.py` · `src/mail_mind_mcp/store.py` · `src/mail_mind_mcp/evidence.py` · `src/mail_mind_mcp/source.py` · `src/mail_mind_mcp/ingest.py` · `src/mail_mind_mcp/jmap.py` · `src/mail_mind_mcp/cli.py` · `config.example.toml` · `README.md` · `SECURITY.md` · `tests/test_sign_off_backlog.py` · `tests/integration/test_greenmail.py` · `tests/integration/test_stalwart.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-04-keep-delimited-signatures-for-mail-evidence-a-sign-off-colum-slice-3.md` — next: `codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-04-keep-delimited-signatures-for-mail-evidence-a-sign-off-colum-slice-3.md`</sub>
Collaborator

spec-verify-dispatch Half B for dev/mail-mind-mcp#85 keep-delimited-signatures-for-mail-evidence-a-sign-off-colum completed integration verify.

  • PR: #183
  • Branch: feat/svd-dev-mail-mind-mcp-85-keep-delimited-signatures-for-m-fc122044
  • Commit: ff87fb1c14
  • 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/59/1
  • Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll
  • Warning: Integration tests (GreenMail/Stalwart, host-only) were not run here; they exist and are collected by name only.
  • Warning: Spec has no scenario table; every spec-named unit test exists and collects (35 tests in tests/test_sign_off_backlog.py).
  • CI wait: ci/woodpecker/pr/validation -> pass
  • Decision: review the PR and merge? (codex-svd ship --run-id 20261104T041012Z-fc122044 --confirm-merge)
spec-verify-dispatch Half B for dev/mail-mind-mcp#85 keep-delimited-signatures-for-mail-evidence-a-sign-off-colum completed integration verify. - PR: https://git.groupthink.asia/dev/mail-mind-mcp/pulls/183 - Branch: feat/svd-dev-mail-mind-mcp-85-keep-delimited-signatures-for-m-fc122044 - Commit: ff87fb1c1401b2111aa6be9069fabf726c4cf95d - 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/59/1 - Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll - Warning: Integration tests (GreenMail/Stalwart, host-only) were not run here; they exist and are collected by name only. - Warning: Spec has no scenario table; every spec-named unit test exists and collects (35 tests in tests/test_sign_off_backlog.py). - CI wait: ci/woodpecker/pr/validation -> pass - Decision: review the PR and merge? (`codex-svd ship --run-id 20261104T041012Z-fc122044 --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#85
No description provided.