From b8c0734c5adbff35319292e803867c7e23bb5c91 Mon Sep 17 00:00:00 2001 From: jaxperro Date: Sun, 19 Jul 2026 16:00:20 -0400 Subject: [PATCH] =?UTF-8?q?recorder:=20never=20delete=20un-ingested=20tape?= =?UTF-8?q?=20=E2=80=94=20warn=20from=2080%,=20single-oldest=20drop=20only?= =?UTF-8?q?=20at=2095%=20as=20loud=20last=20resort=20(user=20directive);?= =?UTF-8?q?=20volume=2010=E2=86=9225GB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- recorder/recorder.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/recorder/recorder.py b/recorder/recorder.py index ea0a6740..0fecd41f 100644 --- a/recorder/recorder.py +++ b/recorder/recorder.py @@ -63,16 +63,25 @@ class Tape: os.remove(plain) log(f"rotated {fam}_{cur[0]} ({cur[2]} rows)") self.files[fam] = [hour, open(os.path.join(DIR, f"{fam}_{hour}.jsonl"), "a"), 0] - # disk guard: drop oldest closed segments past 85% usage + # disk policy (user directive 2026-07-19): NEVER delete tape the Mac + # hasn't downloaded — only the nightly ingest deletes, post-verified + # insert. The 25GB volume holds ~5 weeks un-pulled. Warn from 80%; + # only at >=95% (weeks of no ingest, disk about to kill the CURRENT + # tape too) drop the single oldest segment per rotation, loudly — + # losing the oldest hour beats the recorder crashing on a full disk + # and losing everything forward. try: st = os.statvfs(DIR) - while st.f_bavail / st.f_blocks < 0.15: + free = st.f_bavail / st.f_blocks + if free < 0.20: + log(f"⚠ tape volume {100*(1-free):.0f}% full — ingest has not " + "run in a long while; check the Mac / daily pipeline") + if free < 0.05: old = sorted(f for f in os.listdir(DIR) if f.endswith(".gz")) - if not old: - break - os.remove(os.path.join(DIR, old[0])) - log(f"disk guard dropped {old[0]}") - st = os.statvfs(DIR) + if old: + os.remove(os.path.join(DIR, old[0])) + log(f"⚠⚠ TAPE LOSS: disk full — dropped oldest segment " + f"{old[0]} (last resort; fix the ingest!)") except Exception: pass