{
  "schema_version": "1.3.0",
  "slug": "what-memory-integrity-checksums-must-survive-a-partial-database-compaction",
  "title": "What memory integrity checksums must survive a partial database compaction?",
  "date_of_record": "2026 October 20",
  "scope": "* **Applies when:** The storage engine performs background compaction, compaction can be interrupted, and the instance must detect mixed-generation or partial-compaction state. * **Does not apply when:** Compaction is strictly atomic (singl",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-memory-integrity-checksums-must-survive-a-partial-database-compaction.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-memory-integrity-checksums-must-survive-a-partial-database-compaction.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-memory-integrity-checksums-must-survive-a-partial-database-compaction.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 940,
    "python_slice_tokens": 253,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The separation between **pre-compaction state hash** (the checksum of the state before compaction) and **post-compaction state hash** (the checksum of the state after successful compaction). Relying solely on pre-compaction hashes creates the **Partial Compaction Blindness**: the compaction is interrupted, half the records are in new format, half in old, and...",
    "what_was_observed": "In storage-backed agent architectures, failing to detect partial compaction produces three primary failure modes: 1. **Mixed-Format Reads:** Half the records are in the new compressed format, half in the old. The reading layer silently returns garbage for the new-format records because it lacks the decoder. 2. **Corrupted Record Boundaries:** The compaction was interrupted mid-record. The reading layer sees a truncat...",
    "condition_of_validity": "* **Applies when:** The storage engine performs background compaction, compaction can be interrupted, and the instance must detect mixed-generation or partial-compaction state. * **Does not apply when:** Compaction is strictly atomic (single transaction, all-or-nothing), or the engine guarantees readers see consistent pre- or post-compaction state.",
    "decision_boundary": "1. **Did a compaction operation run since the last checkpoint?** If no, standard read-back verification applies. If yes, proceed. 2. **Is the `compaction_completion_epoch` after the current epoch?** If no, compaction completed successfully. Verify the `pre_compaction_state_hash` matches read-back. If yes, compaction is in progress or was interrupted. 3. **Ar...",
    "operational_effect": "1. **Mixed-Format Detection:** Prevents silent reads of records in the wrong generation format. 2. **Corruption Prevention:** Detects truncated records from interrupted compaction before they propagate. 3. **Snapshot Awareness:** Enables the successor to know whether it is reading pre- or post-compaction state."
  },
  "matched_failure_symptoms": [
    "SQLITE_BUSY_OR_DEADLOCK",
    "OOM_KILL_OR_MEMORY_EXHAUSTION",
    "CONTEXT_DRIFT_OR_ATTENTION_DILUTION"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "0e4b11833dc2267ba318b33bf59f1b839151e048200a13dba6b2070cdd4fd818",
    "verified_classes": [
      "CompactionVerdict",
      "CompactionState",
      "CompactionPolicy",
      "CompactionManifest",
      "CompactionGuard"
    ],
    "verified_functions": [
      "_hash",
      "evaluate_state"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 0,
    "raised_exceptions": [],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "hashlib",
      "json"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
