Hmbown/CodeWhale · error

Compaction coverage floor: checkpoint receipt was dropped…

Error message

Compaction coverage floor: checkpoint receipt was dropped; history was not replaced.

What it means

The survival contract requires exactly one compaction checkpoint receipt message in the replacement history. Zero receipts means the compaction marker/receipt was dropped; more than one means prior summaries were duplicated. Either way history is not replaced. (This entry covers the zero-receipt case.)

Solutions

  1. Append the compaction checkpoint receipt message to the replacement history before validation.
  2. Ensure `is_compaction_checkpoint_message` still matches the receipt structure after any schema change.
  3. Check `build_replacement_history` emits exactly one receipt (fix the >1 duplicate branch separately).
  4. Run `survival_contract_rejects_dropped_anchors_and_receipts` and the fixture matrix to reproduce.

Example fix

// before: receipt lost in rewrite
let replacement = summarized_history;
// after
let replacement = [summarized_history, vec![checkpoint_receipt_message]].concat();
Defensive patterns

Strategy: validation

Validate before calling

fn has_single_receipt(replacement: &[Message]) -> bool {
    replacement.iter().filter(|m| is_compaction_checkpoint_message(m)).count() == 1
}

Try / catch

match compaction::apply_replacement(&replacement) {
    Err(e) if e.to_string().contains("checkpoint receipt") => keep_original_history(),
    other => other,
}

Prevention

When it happens

Trigger: `validate_survival_contract` (called by `build_replacement_history` and tests) counts messages passing `is_compaction_checkpoint_message` in the replacement and finds zero.

Common situations: A rewrite builds the replacement from raw summarized content and forgets to append the checkpoint receipt message; refactor renames/restructures the receipt so `is_compaction_checkpoint_message` no longer matches it.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/f201405cff1730e7. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/compaction/last_round.rs:455

    });
    if !kept {
        anyhow::bail!("Compaction coverage floor: {label} was dropped; history was not replaced.");
    }
    Ok(())
}

pub(crate) fn validate_survival_contract(
    original: &[Message],
    replacement: &[Message],
    anchors: Option<&str>,
) -> Result<()> {
    validate_last_round_coverage(original, replacement)?;
    let checkpoints = replacement
        .iter()
        .filter(|message| is_compaction_checkpoint_message(message))
        .count();
    if checkpoints == 0 {
        anyhow::bail!(
            "Compaction coverage floor: checkpoint receipt was dropped; history was not replaced."
        );
    }
    if checkpoints > 1 {
        anyhow::bail!(
            "Compaction coverage floor: prior summaries were duplicated; history was not replaced."
        );
    }
    if let Some(anchors) = anchors {
        require_text_survives(replacement, anchors, "pinned /anchor text")?;
    }
    Ok(())
}

pub(super) fn measure_coverage(
    original: &[Message],
    replacement: &[Message],
    path: CompactionPath,

View on GitHub (pinned to 73e0f67d83)