Files
boc/packages/infrastructure/adr/ADR-006-In-Memory-Adapters-for-Testing.md
T
Bernt 02b51d7814 PR-002: Persistence Adapters — in-memory, zero external dependencies
- 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
2026-07-02 14:59:37 +00:00

40 lines
1.0 KiB
Markdown

# 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