{
  "schema_version": "1.3.0",
  "slug": "what-write-ahead-log-invariants-must-survive-when-the-log-is-truncated-by-an-operator",
  "title": "What write-ahead log invariants must survive when the log is truncated by an operator?",
  "date_of_record": "2026 October 20",
  "scope": "* **Applies when:** The system uses a WAL, truncation is possible (operator or automated), and recovery from a truncated WAL could lose committed state. * **Does not apply when:** The WAL is immutable (no truncation), or the primary store i",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-write-ahead-log-invariants-must-survive-when-the-log-is-truncated-by-an-operator.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-write-ahead-log-invariants-must-survive-when-the-log-is-truncated-by-an-operator.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-write-ahead-log-invariants-must-survive-when-the-log-is-truncated-by-an-operator.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 923,
    "python_slice_tokens": 244,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The separation between **WAL entry presence** (the log file exists) and **WAL entry durability commitment** (the log has been synced to durable storage and the corresponding state has been applied to the primary store). Relying on presence creates the **Truncation Recovery Gap**: the operator truncates the WAL, but the primary store has not yet applied those...",
    "what_was_observed": "In WAL-based agent architectures, failing to preserve truncation invariants produces three primary failure modes: 1. **Recovery Rollback:** The operator truncates the WAL to reclaim disk, but the primary store was lagging. Recovery replays from the truncated WAL, missing the last 10 minutes of writes. 2. **Split Commit:** Half of a transaction's entries are in the WAL, half already applied to primary. Truncation disc...",
    "condition_of_validity": "* **Applies when:** The system uses a WAL, truncation is possible (operator or automated), and recovery from a truncated WAL could lose committed state. * **Does not apply when:** The WAL is immutable (no truncation), or the primary store is strictly synchronous with the WAL (no lag possible).",
    "decision_boundary": "1. **Is a truncation request being processed?** If no, standard WAL operation applies. If yes, proceed. 2. **Does the truncation offset exceed `wal_durable_commit_offset`?** If yes, truncation would discard durable-committed entries. Reject or defer truncation. 3. **Does `primary_store_catchup_receipt` confirm the primary store has caught up to the truncatio...",
    "operational_effect": "1. **Recovery Integrity:** Prevents truncation from losing durable-committed state. 2. **Audit Preservation:** Blocks truncation of audit-relevant entries. 3. **Operator Safety:** Provides checks for automated or manual truncation, preventing human error."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "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": "e2caafffd2f8ad26f7edd6be9047670a4542341564523738cd523c7b515d8533",
    "verified_classes": [
      "TruncationVerdict",
      "WALState",
      "TruncationPolicy",
      "TruncationManifest",
      "WALTruncationGuard"
    ],
    "verified_functions": [
      "_hash",
      "evaluate_truncation"
    ],
    "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
  }
}
