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
This commit is contained in:
Bernt
2026-07-02 14:59:37 +00:00
parent fa0dbf5127
commit 02b51d7814
22 changed files with 963 additions and 17 deletions
@@ -0,0 +1,39 @@
# 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