Problem
The email agent (apps/email-agent/) test plan has 4 documented tests but none are automated. email-seen-ids.txt and the SEEN_FILE dedup logic is the most fragile part of the whole system and has had zero automated testing since it was written.
Currently: manual testing only. No regression safety net. Changes to the email agent could silently break deduplication, subject parsing, or capacity handling.
Fix
Create scripts/test-email-agent.sh that mocks the listen server and exercises:
- New email → job submission: Mock a new message ID → verify POST to /jobs
- Seen email → skipped: Same message ID again → verify no duplicate POST
- Capacity full (429) → queue: Mock 429 response → verify email re-queued + capacity ack sent
- Parse edge cases: Long subjects, HTML bodies, thread replies
Implementation:
- Use
nc or a simple Python HTTP server to mock http://localhost:7600
- Run email agent against mock server
- Assert on mock server received requests
Acceptance Criteria
Context
From Jensen limitation audit (2026-03-22). Workstream: WS-001.
Problem
The email agent (apps/email-agent/) test plan has 4 documented tests but none are automated. email-seen-ids.txt and the SEEN_FILE dedup logic is the most fragile part of the whole system and has had zero automated testing since it was written.
Currently: manual testing only. No regression safety net. Changes to the email agent could silently break deduplication, subject parsing, or capacity handling.
Fix
Create
scripts/test-email-agent.shthat mocks the listen server and exercises:Implementation:
ncor a simple Python HTTP server to mockhttp://localhost:7600Acceptance Criteria
bash scripts/test-email-agent.shapps/email-agent/Context
From Jensen limitation audit (2026-03-22). Workstream: WS-001.