Expand description
Q39 slice B — background encrypt-on-rewrite migration.
Existing plaintext stores seal record-by-record in bounded LMDB batches
(one write transaction per batch), tracked by the migration:v1 ledger
row in the keyring DBI. The contract is deliberately simple and
crash-safe:
- Only 16-byte keys (UUID records) in record galaxies are candidates; non-record DBIs (karma, dharma, associations, embeddings) are never touched, and raw non-record rows are skipped.
- Values that already carry the sealed-record magic are counted and skipped — re-running is idempotent.
- Plaintext values are decoded with the legacy codec and re-sealed
through [
crate::codec::seal_record], so a record that cannot be decoded is counted and skipped, never rewritten blind. - The ledger is written after each committed batch. A crash between the batch commit and the ledger write re-scans a bounded prefix; sealing is idempotent, so the repeat is harmless.
- A keyring-absent store (mode
off) has nothing to migrate and this module is a provable no-op (no ledger, no writes).
Design: docs/Q39_CRYPTO_ERASURE_DESIGN.md §7 (slice B);
plan: planning/private/Q10_SLICE_B_PLAN_2026-09-19.md.
Structs§
- AtRest
Migration Report - Aggregate report for one
migrate_at_rest_recordsinvocation. - Galaxy
AtRest Counts - Per-galaxy at-rest record inventory for the doctor (read-only; magic check only — values are never decrypted).
- Galaxy
Migration Report - What happened to one galaxy in one migration pass.
Constants§
- DEFAULT_
MIGRATION_ BATCH - Default records per write transaction.
- RECORD_
GALAXIES - Galaxies whose entries are
Memoryrecords.
Functions§
- at_
rest_ record_ counts - Count sealed vs plaintext records across the record galaxies.
- migrate_
at_ rest_ records - Migrate plaintext records to sealed records in bounded batches.
- migration_
ledger - Read the current migration ledger without migrating (doctor disclosure).