ADR-0002: Run Snapshots & Determinism
Status: Accepted
Date: 2025-12-29
Context
- Assessment runs must be reproducible for audit purposes
- External dependencies (LLM responses, embeddings) change over time
- Need to reconstruct exact assessment state for regulatory review
Decision
-
Snapshot pinning at run creation - 6 version IDs frozen (
shared/schema.ts:353-359):snapshotCriteriaVersionIdsnapshotCorpusActivationIdsnapshotRetrievalVersionIdsnapshotPromptVersionIdsnapshotChunkingVersionIdsnapshotAgentVersionId
-
SnapshotStatus enum at
shared/schema.ts:306-313:PENDING: Run in progressCAPTURED: Snapshot successfully storedFAILED: Snapshot capture failedLEGACY: Pre-Step 9 run, no snapshot exists
-
Immutable replay snapshots stored in
run_replay_snapshotstable (shared/schema.ts:382-396) -
Pack immutability enforced by
server/lib/packSafetyService.ts:- Once ACTIVE, pack bindings cannot be modified in-place
- HTTP 409
PACK_ACTIVE_IMMUTABLEreturned on mutation attempts
-
Replay guard at
server/lib/replayGuard.tsprevents non-deterministic operations during replay
Alternatives Considered
- Store full LLM responses - Rejected: storage cost, privacy concerns
- No versioning, accept non-reproducibility - Rejected: regulatory requirement
Consequences
- All binding changes require new pack or version
- FAILED runs cannot be replayed from live tables
- Operators must handle LEGACY runs with warning