pub fn record_compaction_alarm(data_dir: &Path)Expand description
Append one line to <data_dir>/compaction_alarm.log, recording that a
cadence: Some(_) threshold-compaction fire just happened (issue #3868).
Why: a durable, cross-session, cheap-to-query answer to “has threshold
compaction ever fired under cadence” needs a signal that survives past
the tracing::error! at the call site and the in-memory Transcript
counter, both of which reset on session end. Append-only (one line per
fire, never read-modify-write) so concurrent fires from different
sessions can never race each other into a lost increment — the count is
always “number of lines”, never a stored integer that can be
clobbered by two writers reading the same stale value.
What: best-effort, matching write_compression_event’s failure
posture. cadence: None runs must NEVER call this — see
agent_loop::AgentLoop::maybe_compact_transcript’s call site, which only
reaches this function inside its self.config.cadence.is_some() branch.
Test: tests::record_compaction_alarm_appends_one_line_per_call,
tests::record_compaction_alarm_unwritable_dir_does_not_panic.