Files
suaveplan/openspec/archive/2026-05-24-email-processing/tasks.md
2026-05-27 23:29:53 +01:00

3.4 KiB

Tasks — email-processing

§0 Pre-flight (worktree isolation)

  • git worktree list confirms the agent is inside .claude/worktrees/agent-<id>/ and not the main checkout at /home/paul/web/genesis/.
  • §0a Sync confirms HEAD is at or ahead of 9225d658502add3fb62ef0a8f9ac35563de985ff (post health-check archive).
  • git status is clean at start; every write lands under the worktree path.

§1 Package shell

  • packages/communication/emails/email-processing/package.json at 0.1.0, sideEffects: false, every subpath export listed.
  • tsconfig.lib.json extending the root base.
  • vite.config.ts with explicit entry map covering every feature folder.
  • vitest.config.ts with Istanbul 100/100/100/100 thresholds.
  • tests/setup/polyfills.ts installing a real InMemoryMetricExporter-backed MeterProvider.

§2 Feature folders (15)

  • error-codes/ — EMAIL_PROCESSING_CODES + EmailProcessingError with public ctor + test + doc.
  • telemetry/ — shared meter + 11 instruments + test + doc.
  • types/ — flat shared MIME / address / header types.
  • hooks/ — local Hooks<TMap> pipeline + singleton + test + doc.
  • parser/ — parseEmail, parseEmailAddress, decodeEmailWords
    • Zod option boundary + test + doc.
  • mime-utils/ — eleven libmime wrappers + local libmime.d.ts ambient declaration + test + doc.
  • attachment-processor/ — processAttachment(s) + SHA-256 hash + size / MIME allowlist + duration histogram + test + doc.
  • cid-resolver/ — resolve/extract/isReferencedInline + test + doc.
  • calendar-parser/ — VEVENT extraction + test + doc.
  • data-extractor/ — tracking + receipt + extractData + test + doc.
  • dkim-canonicalize/ — relaxed + simple canon + signed-block builder + test + doc.
  • dkim-verifier/ — parseDkim + verifyDkim with real Web-Crypto round-trip in tests + test + doc.
  • dmarc-checker/ — record parser + alignment evaluator + test + doc.
  • spf-checker/ — record parser + ipv4/ipv6 matchers + recursive checkSpf with bounded depth + test + doc.
  • spam-scorer/ — 12 default rules + custom-rule merge + test + doc.
  • thread-grouper/ — In-Reply-To + References + subject grouping, tree builder + test + doc.

§3 OpenSpec spec delta

  • openspec/changes/email-processing/specs/email-processing/spec.md captures the ADDED Requirements for parse, attachment processing, hook pipeline, DKIM/SPF/DMARC, spam scoring, threading, and OTel instruments.

§4 Quality gates (run before commit)

  • bunx turbo lint typecheck test --filter=@suaveplan/email-processing green.
  • bunx turbo test:coverage --filter=@suaveplan/email-processing at 100/100/100/100.
  • bunx turbo build --filter=@suaveplan/email-processing green.
  • grep -rnE "from ['\"](vitest|bun:test)['\"]" packages/communication/emails/email-processing/src/ → empty.
  • grep -rn "biome-ignore\|TODO\|FIXME\|XXX" packages/communication/emails/email-processing/src/ → empty.
  • bun scripts/lint/check-feature-layout.ts | grep email-processing → empty.
  • bun scripts/folder-reorg/generate-manifest.ts regenerates MANIFEST.md cleanly.

§5 Ship

  • Commit on a feat/email-processing branch.
  • Surface SHA + coverage + file count in the agent's final report.