{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-treat-compaction-aware-context-delta-reconstruction-as-unsound-and-how-is-the-boundary-detected-before-a-trace",
  "title": "Under what conditions must an instance treat compaction-aware context-delta reconstruction as unsound, and how is the boundary detected before a trace is trusted?",
  "date_of_record": "2026 November 15",
  "scope": "Applies to distributed tracing and observability systems that reconstruct request context by replaying append-only delta logs across compaction boundaries (LSM-tree segments, WAL rotations, snapshot-and-truncate pipelines). It does not apply to systems that retain full-fidelity event logs with no physical reclamation, nor to compaction that preserves a monotonic global sequence number visible to readers.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-compaction-aware-context-delta-reconstruction-as-unsound-and-how-is-the-boundary-detected-before-a-trace.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-compaction-aware-context-delta-reconstruction-as-unsound-and-how-is-the-boundary-detected-before-a-trace.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-compaction-aware-context-delta-reconstruction-as-unsound-and-how-is-the-boundary-detected-before-a-trace.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1603,
    "python_slice_tokens": 399,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between *logical* continuity and *physical* continuity of a delta chain. A context-delta trace is a chain of `(parent_span_id, delta_payload, seq)` records where each record asserts \"the context at seq N equals context at seq N-1 plus this delta.\" Compaction preserves logical continuity — the surviving key set is semantically ...",
    "what_was_observed": "In a production trace store using size-tiered compaction with a 3-segment merge window, a delta chain of 41 records was compacted into 9 surviving records. The merge collapsed intermediate `context.set` operations into a single net-delta per key. The reconstruction layer, which assumed seq monotonicity and did not verify contiguity, read the 9 records as a complete chain. The resulting trace reported a request contex...",
    "condition_of_validity": "Reconstruction from compacted deltas is sound only when all of the following hold simultaneously: 1. **Seq contiguity is verifiable.** The chain carries an explicit, compaction-stable sequence identifier and the reconstruction asserts `seq[i+1] == seq[i] + 1` for every adjacent pair, with the chain's declared start and end seq matching the query bounds. 2. *...",
    "decision_boundary": "The boundary is crossed at the moment the reconstructor encounters a seq discontinuity or a watermark that exceeds its start bound. The correct behavior is to *refuse to emit a continuous trace* and instead emit a trace with explicit `GapSegment` markers, or to fall back to the raw-event archive if one exists within retention. The incorrect behavior — and th...",
    "operational_effect": "Enforcing the boundary converts a silent correctness failure into a visible, bounded degradation. Traces spanning compacted windows are annotated with gaps; downstream consumers that require continuity must opt in to gap-tolerant analysis or query the archive. Cost: reconstruction latency rises slightly (contiguity checks) and some traces become explicitly p..."
  },
  "matched_failure_symptoms": [
    "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": "308c7391420f429904024d2e5384a2397ae2bbe08ad1961d5d69e334d908c84d",
    "verified_classes": [
      "UnsoundReconstructionError",
      "DeltaRecord",
      "CompactionWatermark"
    ],
    "verified_functions": [
      "reconstruct_context"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "UnsoundReconstructionError"
    ],
    "sample_fail_closed_invariants": [
      "empty delta chain; cannot reconstruct"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
