Headless email communication and evidence service.
Find a file
tegwick e9609b4024
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 2s
EMAIL-WP-0005-T04: end-to-end send-and-scan tests, and two fixes they found
Adds tests/test_integration_send_scan.py: 7 harness-gated cases covering
delivery and Message-ID correlation, scanner ingestion without a delivery
claim, idempotency, resend, suppression, rejected requests never reaching the
provider, and verification mail carrying no authorization.

Fixes the reply heuristic, which matched against headers as well as body. The
Received: trace that every MTA-handled message carries matched its "received"
keyword, so ordinary mail was classified human_reply with a
success.reply_received assessment at medium confidence -- the exact overclaim
this repo exists to prevent. Hand-written fixtures have no Received headers,
so only real scanned mail exposed it. The heuristic now takes the body alone;
DSN detection still sees headers, which it needs. Regression test is offline.

Fixes the provider reference: SMTPProvider set no Message-ID, so send() fell
back to abs(hash((recipient, subject))) -- randomized per process and colliding
for equal recipient/subject. Outgoing mail now carries a proper RFC 5322
Message-ID, returned as the reference, which is what makes send-to-scan
correlation testable.

Suite: 72 passed with the harness up, 62 passed + 10 skipped with it down.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-14 01:54:56 +02:00
.claude/rules docs: workplan-first agent guidance prose (CUST-WP-0055 T04 batch 5) 2026-07-08 19:51:18 +02:00
.forgejo/workflows Add Forgejo CI smoke workflow (enablement template) 2026-07-08 12:30:51 +02:00
config EMAIL-WP-0005-T02: add GreenMail test harness 2026-08-14 01:41:38 +02:00
deploy/k8s/railiance Complete EMAIL-WP-0004 transactional invitation mail delivery. 2026-08-12 13:32:11 +02:00
docs EMAIL-WP-0005-T01: add Maildir mailbox source 2026-08-14 01:31:58 +02:00
registry Draft capability entry (reuse-surface REUSE-WP-0017-T04, cohort 1) 2026-07-06 19:03:42 +02:00
reports feat: start mailbox evidence scanner 2026-06-02 01:19:09 +02:00
spec Seeded repo with intent and PRD 2026-06-01 23:56:07 +02:00
src/email_connect EMAIL-WP-0005-T04: end-to-end send-and-scan tests, and two fixes they found 2026-08-14 01:54:56 +02:00
tests EMAIL-WP-0005-T04: end-to-end send-and-scan tests, and two fixes they found 2026-08-14 01:54:56 +02:00
workplans EMAIL-WP-0005-T04: end-to-end send-and-scan tests, and two fixes they found 2026-08-14 01:54:56 +02:00
.custodian-brief.md chore(consistency): sync task status from DB [auto] 2026-08-12 13:24:38 +02:00
.gitignore feat: start mailbox evidence scanner 2026-06-02 01:19:09 +02:00
.repo-classification.yaml Mark .repo-classification.yaml human-reviewed (CUST-WP-0050 T02) 2026-06-22 11:40:44 +02:00
AGENTS.md Regenerate agent instructions from state-hub templates (CUST-WP-0055 T01) 2026-07-08 14:50:20 +02:00
CLAUDE.md Normalize agent instructions and workplan frontmatter (STATE-WP-0067) 2026-06-22 23:16:24 +02:00
Containerfile Implement transactional invitation mail service 2026-08-09 21:28:41 +02:00
DECISIONS.md EMAIL-WP-0005-T02: add GreenMail test harness 2026-08-14 01:41:38 +02:00
INTENT.md Seeded repo with intent and PRD 2026-06-01 23:56:07 +02:00
LICENSE Adopt Target Revenue Source License V1C1 (org-wide preliminary rollout) 2026-07-30 00:05:52 +02:00
pyproject.toml Implement transactional invitation mail service 2026-08-09 21:28:41 +02:00
README.md feat: add expected recipient reporting 2026-06-02 03:07:13 +02:00
SCOPE.md chore: register with state hub 2026-06-02 00:36:01 +02:00
WORK-RECORDS.md EMAIL-WP-0005-T04: end-to-end send-and-scan tests, and two fixes they found 2026-08-14 01:54:56 +02:00

email-connect

Headless, provider-neutral email communication and evidence service.

The first implementation slice is the Mailbox Evidence Scanner MVP: scan a return mailbox or fixture directory, classify inbound email-channel evidence, store scan state locally, and generate timestamped CSV reports without overclaiming delivery, awareness, or coordination success.

Quickstart

PYTHONPATH=src python3 -m unittest discover -s tests
PYTHONPATH=src python3 -m email_connect.cli adapter-descriptor
PYTHONPATH=src python3 -m email_connect.cli scan-mailbox --config config/mailbox.example.yml --out reports/
PYTHONPATH=src python3 -m email_connect.cli scan-mailbox --config config/mailbox.example.yml --expected-recipients tests/fixtures/expected_recipients.txt --out reports/

The example config uses tests/fixtures/mailbox as a mailbox source. Runtime state is written to .email-connect/state.sqlite; generated CSV reports are written to reports/.

Expected recipients are optional. When provided as a text file or CSV, reports include a known_recipient column, place known recipients first, and add undef.no_signal diagnostics for expected recipients with no mailbox evidence. See Mailbox Report Tutorial.

For a live mailbox, set mailbox.protocol: imap, configure host, port, folder, and credential environment variable names, then export the credentials before running scan-mailbox. IMAP scans select the configured folder read-only and fetch message bodies with BODY.PEEK[]; mailbox write-back actions such as marking messages seen are intentionally unsupported in this MVP.

Current Scope

  • Coordination-engine spec review and references.
  • Initial adapter descriptor, capability profile, evidence ceiling, and limitations.
  • Fixture and read-only IMAP mailbox sources.
  • Conservative mailbox message parser and evidence mapper.
  • SQLite state store with scan cursor, message/evidence deduplication, and endpoint quality hints.
  • CSV report generation, including --report-only-new.
  • Optional expected-recipient text/CSV input, known_recipient report filtering, no-evidence diagnostics, and datetime range filtering.
  • Golden fixture tests for hard bounce, soft bounce, delayed delivery, final failure, complaint, unsubscribe, challenge-response, unknown return, parse-failure, out-of-office, and human reply signals.

Provider webhooks, outbound sending, suppression workflows, OAuth mailbox login, and a UI remain outside this first mailbox-scanner slice.