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

80 lines
3.4 KiB
Markdown

# Tasks — email-processing
## §0 Pre-flight (worktree isolation)
- [x] `git worktree list` confirms the agent is inside
`.claude/worktrees/agent-<id>/` and not the main checkout at
`/home/paul/web/genesis/`.
- [x] §0a Sync confirms HEAD is at or ahead of
`9225d658502add3fb62ef0a8f9ac35563de985ff` (post health-check
archive).
- [x] `git status` is clean at start; every write lands under the
worktree path.
## §1 Package shell
- [x] `packages/communication/emails/email-processing/package.json`
at `0.1.0`, sideEffects: false, every subpath export listed.
- [x] `tsconfig.lib.json` extending the root base.
- [x] `vite.config.ts` with explicit entry map covering every feature
folder.
- [x] `vitest.config.ts` with Istanbul 100/100/100/100 thresholds.
- [x] `tests/setup/polyfills.ts` installing a real
`InMemoryMetricExporter`-backed `MeterProvider`.
## §2 Feature folders (15)
- [x] `error-codes/` — `EMAIL_PROCESSING_CODES` + `EmailProcessingError`
with public ctor + test + doc.
- [x] `telemetry/` — shared meter + 11 instruments + test + doc.
- [x] `types/` — flat shared MIME / address / header types.
- [x] `hooks/` — local `Hooks<TMap>` pipeline + singleton + test + doc.
- [x] `parser/` — `parseEmail`, `parseEmailAddress`, `decodeEmailWords`
+ Zod option boundary + test + doc.
- [x] `mime-utils/` — eleven libmime wrappers + local `libmime.d.ts`
ambient declaration + test + doc.
- [x] `attachment-processor/` — `processAttachment(s)` + SHA-256 hash +
size / MIME allowlist + duration histogram + test + doc.
- [x] `cid-resolver/` — resolve/extract/isReferencedInline + test +
doc.
- [x] `calendar-parser/` — VEVENT extraction + test + doc.
- [x] `data-extractor/` — tracking + receipt + extractData + test +
doc.
- [x] `dkim-canonicalize/` — relaxed + simple canon + signed-block
builder + test + doc.
- [x] `dkim-verifier/` — parseDkim + verifyDkim with real Web-Crypto
round-trip in tests + test + doc.
- [x] `dmarc-checker/` — record parser + alignment evaluator + test +
doc.
- [x] `spf-checker/` — record parser + ipv4/ipv6 matchers + recursive
checkSpf with bounded depth + test + doc.
- [x] `spam-scorer/` — 12 default rules + custom-rule merge + test +
doc.
- [x] `thread-grouper/` — In-Reply-To + References + subject
grouping, tree builder + test + doc.
## §3 OpenSpec spec delta
- [x] `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.