Repository navigation
docs(design): design prefix-blob reclamation for byte-proven revisions - #3164
Conversation
Problem: raw_sessions stores every observed file snapshot as an independent full blob; when a live-captured file only grows (Codex rollouts, Claude Code transcripts), every capture before the last is a byte-proven strict prefix of a later one (#3146's classify_historical_full_revision_streams already proves this), so the old bytes are redundant by construction but blob GC correctly refuses to collect them since raw_sessions/blob_refs still point at them. What changed: added docs/design/prefix-blob-reclamation.md covering: (1) an evidence pack measured read-only against the live archive that decomposes the bead's "45.2GB (46%)" naive estimate into a verified 17.65GB (18.12%) strict byte-proof reclaimable total across three buckets (already-classified, freshly-proven-typed, freshly-proven-untyped), with top cohorts and an origin distribution (86% codex-session); (2) a new additive blob_prefix_references table (own hash, byte_length, successor hash) as the reference-blob representation, chained rather than always-flattened-to-leaf resolution, and why blob_refs is the wrong home for it; (3) a read-path audit finding 15+ non-publisher BlobStore callers beyond the "publisher" surface the bead named, and a decision to push reference-resolution into the shared BlobStore base class rather than only ArchiveBlobPublisher; (4) reuse of blob_gc.py's existing hardened deletion path via one added exclusion clause in _reference_surfaces, with a crash-window analysis per step; (5) a consent-gate design reusing the existing verified-backup-manifest tooling; (6) a two-mode (sampled/full) byte-identity + read-path-parity verification plan; (7) a grounded forward-fix sketch for the acquisition-side sibling (append-delta capture only activates 2.3% of the time because its cursor continuity is anchored to the disposable ops.db tier, not source.db). Anti-goals stated: no heuristic similarity reclamation (byte-proof only, and the evidence pack shows why heuristics would be wrong most of the time here), no reclamation of a quarantined/ambiguous chain, retired-generation cleanup is out of scope. This is a design-only change (no code, no schema migration applied) per the bead's ask; implementation is deferred to follow-up work. Ref polylogue-vzn6 Co-Authored-By: Claude <[email protected]>
render docs-surface flagged the new doc as unindexed documentation; add its entry to devtools/docs_surface.py's design tier and regenerate docs/README.md. Ref polylogue-vzn6 Co-Authored-By: Claude <[email protected]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
Next review available in: 51 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Ref polylogue-vzn6 Co-Authored-By: Claude <[email protected]>
Append-notes on polylogue-vzn6 (evidence pack + design summary, PR #3164) and the new follow-up bead polylogue-aex0 (append-ingest cursor continuity root cause). Co-Authored-By: Claude <[email protected]>
Summary
Design-only lane for polylogue-vzn6: a reference-blob representation that
lets byte-proven strict-prefix superseded raw-payload blobs be reclaimed
without breaking any consumer that reads them by hash. No code/schema
changes are applied in this PR — implementation is deferred to follow-up
work.
Problem
raw_sessionsstores every observed file snapshot as an independent fullblob. When a live-captured file only grows (Codex rollouts, Claude Code
transcripts), every capture before the last is a byte-proven strict prefix
of a later one — #3146's
classify_historical_full_revision_streamsalreadyproves this with zero heuristics — so the old bytes are redundant by
construction, but blob GC correctly refuses to collect them since
raw_sessions/blob_refsstill point at them.The bead (and #3146's own problem statement) cited 45.2GB of 97.4GB (46%)
as the reclaimable scale. That number assumes every non-newest member of a
same-identity growth cohort is a clean append chain, without actually running
the byte-proof. Running the real proof against the live archive shows this
assumption is mostly wrong: the verified, strict byte-proof reclaimable
total is 17.65GB (18.12% of the archive) — most same-identity cohorts
(96%+ of those checked) are non-monotonic (edits, resegmentation,
coincidental identity reuse) and are correctly quarantined by the existing
classifier, not silently reclaimable.
Solution
docs/design/prefix-blob-reclamation.mdcovers:archive (already-classified byte_proven chains: 10.48GB/992 rows; typed
cohorts needing a fresh streamed proof: 7.17GB/318 rows from 50 of 3,432
cohorts checked; untyped/legacy cohorts: 0.0006GB/11 rows from 4 of 3,240
checked). Top cohorts and an origin distribution (86.4% codex-session,
13.6% claude-code-session) are included. Reproduction scripts are
preserved for audit.
blob_prefix_referencestable (own hash / byte_length / successor hash), not
blob_refs(adifferent axis: referrer identity vs. content-reconstruction recipe).
Chained rather than always-flattened-to-leaf resolution, justified by
BlobStore's write-once immutability removing the TOCTOU class entirely.BlobStore/get_blob_store()callers beyond the "publisher" surface the bead named (backup, validation,
revision backfill, retention, artifact inspection, sampling/validation
corpora, blob integrity, source parsing, live batch, repair, reconciler,
ingest worker). Decision: push reference-resolution into the shared
BlobStorebase class (not justArchiveBlobPublisher), so all 15+callers become reference-aware through one change. Flags
blob_path()'spermanent-path contract as the single riskiest open item — some callers
assume a stable, reusable CAS file, and a reference-backed hash can only
offer a bounded ephemeral spill file.
blob_gc.py's existing hardened deletionpath via one added exclusion clause in
_reference_surfaces, rather thana parallel deletion mechanism. Crash-window analysis at every step (write
reference row → verify → mark collectible → existing GC collects →
confirmation sweep), including the one new race the added clause could
introduce (resolved by SQLite's existing WAL snapshot isolation).
(
daemon/backup.py) ahead of the first real physical reclamation pass;the schema addition itself is ordinary additive DDL needing no special
gate.
modes.
only activates ~2.3% of the time:
_append_plan's cursor continuity isanchored to
ops.db(the disposable tier), so everyops.dbreset forcesevery currently-growing file back onto a full capture. Sketches a fix
(durable-tier cursor reconstruction fallback) and records the decision to
file it as a follow-up rather than implement it in this design-only lane.
quarantined/ambiguous chain, retired-generation cleanup out of scope.
Verification
python -m devtools render all --check— clean (the new doc needed adevtools/docs_surface.pyentry; added and regenerateddocs/README.md).python -m devtools verify --quick(format + lint + mypy + render-all-check)— passed via the pre-push hook,
exit_code: 0.(
evidence_pack.py,prove_mixed.py,prove_unknown.py,final_evidence.py)run against the live archive's
source.db(mode=ro) and blob store,importing the project's own
classify_historical_full_revision_streamsrather than reimplementing the proof. No writes were made to the live
archive.
Ref polylogue-vzn6