Decision 0003 · Accepted · 2026-11-22

Interfaces at the edges (LLM, store) for testability

Context

The two external dependencies, the LLM API and PostgreSQL, are slow, costly or stateful. Tests that need them are flaky and cannot run in CI without secrets.

Decision

Define small interfaces (llm.Client, the store used by the server) at the consuming side and inject them in main. Tests supply fakes and exercise the real HTTP handlers, limits, SSE framing and refusal paths.

Consequences

← 0002 Two-stage LLM pipeline: cheap guard, then answer0004 Embedded migrations applied under an advisory lock →