Add the JMAP source: session, backfill and deltas #55

Closed
opened 2026-10-31 14:05:09 +00:00 by svc-agent-writer · 1 comment

Parent: #51 (Phase 6). Decision: ADR 0006. §8, §11, §12.

The read path of a JMAP account.

  • Session discovery from session_url; account id and capabilities from it.
  • Backfill: Email/query pages, then Email/get with fetchTextBodyValues and maxBodyValueBytes from store.max_text_bytes.
  • Deltas: Mailbox/changes and Email/changes from stored state strings; cannotCalculateChanges starts a full id reconcile.
  • A move updates the row in place and writes move.
  • [blobs]: the raw message from the download URL.
  • The credential file is a bearer token, registered with the scrubber. mailmind check prints the capabilities and warns when the session grants submission.
  • A switch of an existing account from imap to jmap (ADR 0006 §1): backfill beside the old rows, copy the class and the vector by Message-ID, then delete the old rows.
  • httpx becomes a direct dependency.
  • wait sleeps interval_seconds in this issue; push is a separate issue.
  • Tests: a fake JMAP server in the test process (like FakeJev in tests/test_assess.py) covers backfill, deltas, cannotCalculateChanges, a move and the source switch. A real server is #63.
  • State: the JMAP state strings (Email and Mailbox, per account) live in a new table source_state(account, key, value), schema v6, additive. The PR adds this to ADR 0006 §8.
  • README and config.example.toml: a Fastmail JMAP account example. The token file ends in .secret, never .token.

Acceptance

  • One mail_search returns rows from an IMAP and a JMAP account (fake server).
  • A message moved on the server keeps its id.
  • After a switch from imap, mail_status shows the same assessed and embedded counts with no Jev call and no model run for copied rows.
  • Logs carry counts and codes only; the token never appears in captured logs.

Blocked by

Ruling (triage, 2026-11-01)

  • The JMAP state strings live in a new source_state table (schema v6), not on mailboxes.
  • #55 tests against a fake JMAP server; Stalwart and its make target are #63.

Human act

ruling: the operator decided where the JMAP state lives and how the integration server is set up (CONV-40)

Parent: #51 (Phase 6). Decision: ADR 0006. §8, §11, §12. The read path of a JMAP account. - Session discovery from `session_url`; account id and capabilities from it. - Backfill: `Email/query` pages, then `Email/get` with `fetchTextBodyValues` and `maxBodyValueBytes` from `store.max_text_bytes`. - Deltas: `Mailbox/changes` and `Email/changes` from stored state strings; `cannotCalculateChanges` starts a full id reconcile. - A move updates the row in place and writes `move`. - `[blobs]`: the raw message from the download URL. - The credential file is a bearer token, registered with the scrubber. `mailmind check` prints the capabilities and warns when the session grants submission. - A switch of an existing account from `imap` to `jmap` (ADR 0006 §1): backfill beside the old rows, copy the class and the vector by Message-ID, then delete the old rows. - `httpx` becomes a direct dependency. - `wait` sleeps `interval_seconds` in this issue; push is a separate issue. - Tests: a fake JMAP server in the test process (like `FakeJev` in `tests/test_assess.py`) covers backfill, deltas, `cannotCalculateChanges`, a move and the source switch. A real server is #63. - State: the JMAP state strings (Email and Mailbox, per account) live in a new table `source_state(account, key, value)`, schema v6, additive. The PR adds this to ADR 0006 §8. - README and `config.example.toml`: a Fastmail JMAP account example. The token file ends in `.secret`, never `.token`. ## Acceptance - One `mail_search` returns rows from an IMAP and a JMAP account (fake server). - A message moved on the server keeps its id. - After a switch from `imap`, `mail_status` shows the same `assessed` and `embedded` counts with no Jev call and no model run for copied rows. - Logs carry counts and codes only; the token never appears in captured logs. ## Blocked by - #53 - #54 ## Ruling (triage, 2026-11-01) - The JMAP state strings live in a new `source_state` table (schema v6), not on `mailboxes`. - #55 tests against a fake JMAP server; Stalwart and its make target are #63. ## Human act ruling: the operator decided where the JMAP state lives and how the integration server is set up (CONV-40)
Author
Member

This was generated by AI during triage.

Triage: enhancement, ready-for-human (CONV-40 rule 3: a new credential and a new outbound connection from sync).

  • Already decided: ADR 0006 §1, §7, §8, §11 and §12; the store, ids and seam from #53 and #54.
  • Premises checked: the Fastmail session URL https://api.fastmail.com/jmap/session, read-only API tokens, the separate submission scope, and httpx already in the tree. Stalwart serves both protocols in one container, but a test run needs a scripted bootstrap; that moved to #63.
  • Ruling: the state strings go in a new source_state table (schema v6); tests use a fake JMAP server. The body now records both.
> *This was generated by AI during triage.* Triage: enhancement, `ready-for-human` (CONV-40 rule 3: a new credential and a new outbound connection from `sync`). - Already decided: ADR 0006 §1, §7, §8, §11 and §12; the store, ids and seam from #53 and #54. - Premises checked: the Fastmail session URL `https://api.fastmail.com/jmap/session`, read-only API tokens, the separate submission scope, and `httpx` already in the tree. Stalwart serves both protocols in one container, but a test run needs a scripted bootstrap; that moved to #63. - Ruling: the state strings go in a new `source_state` table (schema v6); tests use a fake JMAP server. The body now records both.
piers referenced this issue from a commit 2026-10-31 22:36:34 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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#55
No description provided.