Skip to content

E2E automated test suite for email agent #16

@FrederikHandberg

Description

@FrederikHandberg

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:

  1. New email → job submission: Mock a new message ID → verify POST to /jobs
  2. Seen email → skipped: Same message ID again → verify no duplicate POST
  3. Capacity full (429) → queue: Mock 429 response → verify email re-queued + capacity ack sent
  4. 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

  • 4 test cases automated in bash/python
  • Tests run without a live email account (mock responses)
  • Tests can be run via bash scripts/test-email-agent.sh
  • CI: tests run on every PR that touches apps/email-agent/
  • SEEN_FILE dedup tested with >100 IDs

Context

From Jensen limitation audit (2026-03-22). Workstream: WS-001.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions