Repository navigation
feat(storage): add byte-duplicate supersession classifier + actuator - #3624
Conversation
|
Warning Review limit reached
Next review available in: 17 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 Plus Run ID: 📒 Files selected for processing (10)
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 |
Problem: of 7,200 unindexed logical-source heads in the live archive, 4,305 (17.6 of 22.9 GiB, 77% of the bytes) sit at revision_authority='quarantined' with logical_source_key IS NULL -- invisible to every existing reconciliation path (classify_raw_revision_cohort, the membership pipeline, the append-chain backfill all key off logical_source_key). These rows turn out to be byte-identical re-acquisitions/re-syncs of content the archive already indexed under a different raw_id, not missing content. What changed: polylogue/storage/raw_byte_duplicate_supersession.py is a read-only classifier that, for each quarantined/logical-key-less raw, checks whether its blob_hash matches some OTHER raw_sessions row that already has a materialized session in index.db. index.db is opened strictly read-only; nothing here writes to it or touches the indexed twin's own row. polylogue/maintenance/raw_byte_duplicate_supersession_apply.py is the "act" half, following the identical dry-run-by-default / verified-backup-required / immutable-receipt pattern established by raw_live_source_reconciliation_apply, raw_membership_writeback_apply, and raw_append_chain_backfill_apply. Promotes matched rows to revision_authority='byte_proven' -- reusing the closed vocabulary rather than inventing a new one -- and leaves revision_authority_evidence NULL (widening its closed CHECK requires a full raw_sessions table rebuild, per migration 021's own precedent) in favor of a dedicated raw_byte_duplicate_supersession_receipts table (migration 022, source schema v21->v22) recording which indexed raw_id/session_id each duplicate matches. Wired as `devtools workspace raw-byte-duplicate-supersession-apply`. The genuinely novel remainder (no indexed byte-identical twin) is left untouched -- that population belongs to polylogue-lkrc/polylogue-hjpx's reconciler, explicitly out of scope here. Verification: - devtools test tests/unit/storage/test_raw_byte_duplicate_supersession.py tests/unit/maintenance/test_raw_byte_duplicate_supersession_apply.py -- 6 passed. Fixture proves a genuine byte-duplicate pair (one indexed, one quarantined-no-lsk with matching blob_hash) resolves, a genuine non-duplicate quarantined-no-lsk raw does not, dry-run makes zero mutations to source.db or index.db, and apply refuses without a verified backup manifest. - devtools test tests/unit/storage/test_durable_migrations.py -- 43 passed (updated hardcoded v21 schema-chain assertions to v22). - devtools test -k raw_authority -- 108 passed, 6 failed; confirmed via git stash (reverting this change) that the same 6 failures (test_raw_authority_scale_proof.py x5, test_raw_authority_daemon_health_proof.py x1) reproduce identically without this change -- pre-existing/unrelated. - devtools verify --quick -- exit 0 (format, lint, mypy --strict, render all --check, layering, schema-versioning and raw-authority-frontier- executability lab policies all pass). Not run against the live archive this session -- the required dry-run sanity check against /realm/db/polylogue before any --apply is a separate, explicitly operator-supervised step. Ref polylogue-6753s Co-Authored-By: Claude <[email protected]>
3cfa026 to
9a7e580
Compare
6753s (byte-dup supersession, PR #3624), c831 (message_type restamp, PR #3629, live backfill verified 0 remaining), qhk8z (duplicate-chain baseline tie-break, PR #3616), ct3r2 + t6iga (merge-gate enforcement, PR #3607, duplicate beads for the same fix). Co-Authored-By: Claude <[email protected]>
Summary
Adds a read-only classifier plus a dry-run-by-default actuator that resolves quarantined, logical-key-less raws that are byte-identical to content the archive already indexed under a different raw_id.
Problem
Of 7,200 unindexed logical-source heads in the live archive, 4,305 (17.6 of 22.9 GiB, 77% of the bytes) sit at
revision_authority='quarantined'withlogical_source_key IS NULL-- invisible to every existing reconciliation path (classify_raw_revision_cohort, the membership pipeline, the append-chain backfill all key offlogical_source_key). These rows turn out to be byte-identical re-acquisitions/re-syncs of content the archive already indexed under a different raw_id, not missing content -- they inflate every "archive is X% unconverged" measurement while carrying nothing the archive doesn't already have.Solution
polylogue/storage/raw_byte_duplicate_supersession.pyis a strictly read-only classifier: for each quarantined, logical-key-less raw, it checks whether the raw'sblob_hashmatches some OTHERraw_sessionsrow that already has a materialized session inindex.db.index.dbis opened read-only; nothing here writes to it or touches the indexed twin's own row.polylogue/maintenance/raw_byte_duplicate_supersession_apply.pyis the "act" half, following the identical dry-run-by-default / verified-backup-required / immutable-receipt pattern already established byraw_live_source_reconciliation_apply,raw_membership_writeback_apply, andraw_append_chain_backfill_apply. It promotes matched rows torevision_authority='byte_proven'-- reusing the existing closed vocabulary rather than inventing a new disposition -- and deliberately leavesrevision_authority_evidenceNULL(widening its closed CHECK constraint requires a fullraw_sessionstable rebuild, per migration 021's own precedent for why that's expensive) in favor of a dedicatedraw_byte_duplicate_supersession_receiptstable (migration 022, source schema v21->v22) that records which indexed raw_id/session_id each duplicate matches, so the evidence is durable and inspectable, not silent.Wired as
devtools workspace raw-byte-duplicate-supersession-apply.The genuinely novel remainder (~2,895 rows / ~5.3 GiB, no indexed byte-identical twin) is left untouched -- that population is polylogue-lkrc/polylogue-hjpx's reconciler scope, explicitly out of scope here.
Verification
devtools test tests/unit/storage/test_raw_byte_duplicate_supersession.py tests/unit/maintenance/test_raw_byte_duplicate_supersession_apply.py-- 6 passed. Fixture proves a genuine byte-duplicate pair (one indexed, one quarantined-no-lsk raw with matching blob_hash) resolves, a genuine non-duplicate quarantined-no-lsk raw does not, dry-run makes zero mutations to source.db or index.db, and apply refuses without a verified backup manifest.devtools test tests/unit/storage/test_durable_migrations.py-- 43 passed (updated hardcoded v21 schema-chain assertions to v22).devtools test -k raw_authority-- 108 passed, 6 failed; confirmed viagit stash(reverting this change) that the same 6 failures (test_raw_authority_scale_proof.pyx5,test_raw_authority_daemon_health_proof.pyx1) reproduce identically without this change -- pre-existing/unrelated.devtools verify --quick-- exit 0 (format, lint, mypy --strict, render all --check, layering, schema-versioning and raw-authority-frontier-executability lab policies all pass).Not run against the live archive as part of this PR -- the dry-run sanity check against
/realm/db/polylogue(and any subsequent--apply) is a separate, explicitly operator-supervised step, tracked in the referenced bead.Ref polylogue-6753s