{
  "schema_version": "1.3.0",
  "slug": "what-invariants-must-survive-when-a-session-is-rebuilt-from-an-event-sourced-log-with-gaps",
  "title": "What invariants must survive when a session is rebuilt from an event-sourced log with gaps?",
  "date_of_record": "2026 October 20",
  "scope": "* **Applies when:** The session reconstructs state by replaying event logs, and the logs can have gaps (intentional or not). * **Does not apply when:** The log is strictly complete (no gaps possible), or the session reconstructs from atomic",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-invariants-must-survive-when-a-session-is-rebuilt-from-an-event-sourced-log-with-gaps.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-invariants-must-survive-when-a-session-is-rebuilt-from-an-event-sourced-log-with-gaps.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-invariants-must-survive-when-a-session-is-rebuilt-from-an-event-sourced-log-with-gaps.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1032,
    "python_slice_tokens": 264,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The separation between **event replay success** (the log was replayed without parse errors) and **event replay completeness** (the log contained all events needed to reconstruct the correct state). Relying on success creates the **Silent Gap Reconstruction**: replay succeeds, the reconstructed state looks syntactically valid, but the gaps mean the state is m...",
    "what_was_observed": "In event-sourced agent architectures, failing to detect log gaps produces three primary failure modes: 1. **Missing Business Events:** A payment event is missing from the log, the reconstructed state shows an unpaid order, and the agent re-executes the payment, double-charging the customer. 2. **Broken Causality:** A \"Shipment Dispatched\" event exists but the \"Order Placed\" event that it depends on is missing. Replay...",
    "condition_of_validity": "* **Applies when:** The session reconstructs state by replaying event logs, and the logs can have gaps (intentional or not). * **Does not apply when:** The log is strictly complete (no gaps possible), or the session reconstructs from atomic snapshots rather than event replay.",
    "decision_boundary": "1. **Is the log being replayed?** If no, standard state reconstruction applies. If yes, proceed. 2. **Does the `event_offset_continuity_receipt` show gaps?** If yes, the replay must distinguish intentional gaps (declared) from corruption (undeclared). 3. **Are all gaps covered by `gap_declaration_signature`?** If yes, the reconstruction can proceed with `PAR...",
    "operational_effect": "1. **Silent Corruption Prevention:** Distinguishes declared gaps from undeclared corruption, preventing reconstruction from silent state errors. 2. **Causal Correctness:** Verifies that all causal dependencies were satisfied, avoiding replay into phantom states. 3. **Divergence Detection:** Compares post-replay state against expected state, catching subtle d..."
  },
  "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": "42f1bf847c38e75688bdda5b80051f3fe104eb58bf0034d43d9a917034669b68",
    "verified_classes": [
      "GapVerdict",
      "LogGap",
      "EventLogState",
      "LogPolicy",
      "GapManifest",
      "EventLogGapGuard"
    ],
    "verified_functions": [
      "_hash",
      "evaluate_replay"
    ],
    "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
  }
}
