Add a Stalwart integration target for the IMAP and JMAP sources #63
Labels
No labels
bug
enhancement
epic
needs-info
needs-triage
ready-for-agent
ready-for-human
svd:go
svd:hold
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dev/mail-mind-mcp#63
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent: #51 (Phase 6). Decision: ADR 0006, Consequences (one server with both IMAP and JMAP). Split from #55 at triage.
#55 tests the JMAP source against a fake JMAP server in the test process. This issue adds a real server: Stalwart, which serves IMAP and JMAP for the same account from one container.
Known constraints (checked 2026-11-01 against the Stalwart Docker docs)
stalwartlabs/stalwart(alsoghcr.io/stalwartlabs/stalwart). Pin it by digest, like the GreenMail and base images.config.jsonapplied with the CLI in recovery mode.STALWART_RECOVERY_ADMIN=admin:<password>sets a known admin credential.server.hostname, or the session'sapiUrlnames the container's internal host.Acceptance
../imap-blade-mcp/scripts/greenmail.sh:upstarts a configured Stalwart with one test account and a known CA or plain HTTP on localhost,downremoves it.make test-integrationruns it too, or the README says why not.Blocked by
Filed under: operator word "advice/leans accepted" sha256:70868845a7df
Agent Brief
Category: enhancement
Summary: Add a Stalwart container as a second integration target, and run the JMAP source tests against it as well as against the fake server.
Correction to the issue body: the line "the docs show no scripted way to create an account" is out of date. Stalwart 0.16 removed the
/api/principalREST API. Management now runs through JMAP objects with anx:prefix (capabilityurn:stalwart:jmap), andstalwart-cli create <Object> --field key=valuecreates them. An account is probably anx:Accountobject; confirm the name in the Stalwart object reference before you use it.Current behavior:
FakeJmap, an in-process fake server.scripts/greenmail.shand driven bymake test-integrationwithMAILMIND_GREENMAIL=1.Desired behavior:
greenmail.sh, withupanddown.upmust:Authorization: Bearer <token>..token.downremoves the container and the files it wrote.localhost.pem,localhost.key) and is verified with the blade'sca.pem.127.0.0.1. The session URL check accepts that, as long as Stalwart'sapiUrlanddownloadUrlalso usehttp://127.0.0.1:<port>. Set the server hostname so that they do.make test-integrationruns them too, or the README says why it does not.integrationand gated on an env var (likeMAILMIND_GREENMAIL) drive a realJmapSourceagainst Stalwart.Email/importandEmail/setfrom the test's own client, or IMAP APPEND, STORE and MOVE. They never go through mailmind's outbox. JMAP writes are #57.Key interfaces:
JmapSource(account, store, config):run_pass(),check().JmapAccountConfigtakessource = "jmap",session_urlandcredential_file.MirrorAccountConfig: an IMAP account on the same Stalwart user. It is needed for the switch test.Store:get_by_source,get_state(account, "email_state")andhas_imap_rows;copy_assessmentsandcopy_embeddings, already called by the switch.ids.encode_source(account, source_id): the stable id, which must be the same before and after a move.Acceptance criteria:
upthendownleaves no container and no secret file behind.uprun twice in a row succeeds.mailbox,mailboxes, flags and Message-ID.add,flagsanddelchange.move.has_imap_rowsis false.JmapSource.check()returns anOK jmap host=127.0.0.1line.FakeJmap.make checkstill passes, and the existing GreenMail integration tests still pass.Stop and report, do not work around:
JmapClient. It would change the credential surface ADR 0006 §11 decides, and that needs the operator's ruling. The sources disagree here: the current API-key page says keys work as bearer tokens on JMAP, but other material says keys cannot reach mail protocols. The OAuth password grant is not supported, so a script cannot get an access token without a person.stalwart-cli, also stop and report. One example is a web-only step. One report against 0.16 also disputes the format ofSTALWART_RECOVERY_ADMIN.Out of scope:
JmapClientauth or to ADR 0006..woodpecker/*): the architect adds these.