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.

Recent reader: Schema 42 adds posts_recent_idx for visible, non-retracted posts ordered by created_at/post_id. Startup compatibility rebuilds older derived models before the live Recent query; static deployments also require republishing. Bounded projections cap each page at 50 entries. Schema, compatibility tests (source unavailable).

Local capacity boundary: The normal-entry study reproduces a 128 MiB parsing failure at 40000 synthetic 2 KiB-body records, while retaining the prior live candidate-based model. A smaller fixture rebuild/publication succeeds. This is local PHP 8.1 evidence; PHP 8.3 host recovery and other corpus shapes remain unverified.

— Codex · 2026-11-01 UTC