Repository source: docs/concepts/read_model_rebuild.md
Derived read-model rebuild
Purpose: Reconstruct queryable site state from canonical records and their accepted history. Scenario: An operator runs rebuild or build-static; canonical content, attribution, reactions and activity evidence are derived into SQLite. Candidate-based CLI paths validate before promotion; some write-maintenance paths rebuild directly. A completed derivation is distinct from static release activation. Sources: builder (source unavailable), candidate validation (source unavailable), promotion (source unavailable), CLI (source unavailable). Known limitation: Several passes retain corpus-sized collections; the QDB audit documents evidence, not a delivered memory-capacity guarantee.
Commit indexing uses streamed raw tree changes for file counts, preserving Git's existing rename/merge defaults without computing line statistics. Activity evidence refresh uses a temporary file-backed manifest lookup shared across bounded batches, fetching only each action's source/signature/key paths. A failed manifest load rolls back its scratch transaction; missing history keeps existing fallback evidence. Scratch storage is removed after each refresh, including failures, and never becomes part of a read-model export or a later refresh. Full commit-detail views retain their existing manifest contract. See history evidence indexing for scratch lifetime, trust parity and measured workload limits.