02b51d7814
- Repository interfaces defined by domain (@landvex/domain) - 6 in-memory adapters: Session, Mission, DecisionCase, Artifact, EventStore, UnitOfWork - 9 tests verifying adapter contracts - Domain unchanged — infrastructure depends on domain, never reverse - ADR-006: In-Memory Adapters for Testing Definition of Done met: - All adapters compile against domain interfaces - Unit tests pass (9/9) - No PostgreSQL, S3, Express, AI in this PR - Ready for PR-003: PostgreSQL adapters
1.0 KiB
1.0 KiB
ADR-006: In-Memory Adapters for Testing
Status
Accepted
Context
The domain model needs to be tested without external dependencies (PostgreSQL, S3, etc.). We need fast, isolated tests that verify domain behavior.
Decision
Implement in-memory adapters for all repository interfaces:
- InMemoryFieldSessionRepository
- InMemoryMissionRepository
- InMemoryDecisionCaseRepository
- InMemoryArtifactRegistry
- InMemoryEventStore
- InMemoryUnitOfWork
These adapters:
- Implement the same interfaces as production adapters
- Store data in memory (Map, Array)
- Can be reset between tests
- Are never used in production
Consequences
Positive
- Tests run in milliseconds
- No database setup required
- Parallel test execution safe
- Documents how repositories are used
Negative
- Not production-realistic (no transactions, no persistence)
- Need separate integration tests for production adapters
Related
- ADR-001: Domain knows nothing about AI
- ADR-002: Artifact is common base contract
- ADR-003: Event Sourcing for traceability