04 · Ship

Testing and maintainability

shippedprinciple → decision → workflow → artifact

Principle

AI increases throughput of code; tests and types increase trust in revision. Maintainability is the ability to change the product next month without fear — especially when you did not write every line yourself.

The goal is not maximum coverage. The goal is confidence at the boundaries that hurt users: money, auth, data loss, and the core workflow you validated in Discover.

The decision

DEC_013

        ┌─────────────┐
│  E2E (few)  │  critical user paths
├─────────────┤
│ Integration │  API + DB, webhooks
├─────────────┤
│  Unit (many)│  pure logic, parsers
└─────────────┘
Test pyramid for small teams — wide base of fast tests, few slow paths.

What to test first

PriorityExamplesWhy
P0Sign up, pay, delete account, core workflowUser trust
P1Permissions, idempotency on webhooksSecurity + money
P2Edge cases from support ticketsRegression fuel
P3Snapshot everythingFalse confidence

Ask agents to write tests with the feature, not in a later “test sprint” that never ships.

Maintainability habits

  1. CI on every PR — build + lint + test; agents do not merge around it.
  2. Types or schemas — inputs validated at boundaries; models hallucinate shapes.
  3. Small modules — files you can delete without archaeology.
  4. Fix flukes immediately — flaky tests train you to ignore red.
  5. Delete dead code — agents add; humans prune.

Working with AI on tests

Workflow

  1. Acceptance criteria in ticket → map 1:1 to test descriptions.
  2. Implement feature + tests in same PR.
  3. CI green before review; human reads test names for intent.
  4. On bug: regression test first, then fix.
  5. Quarterly: delete tests that no longer encode a decision.

Tooling

Vitest, Jest, pytest — pick what your stack uses. Playwright or Cypress for thin E2E. TypeScript, Zod, or DB constraints for shape. GitHub Actions or similar for CI.

Common mistakes

Artifacts

Further reading