[object Object]

← back to Terminal Status

backfill: write a bounded liveness heartbeat after the paint

9a4cc5863ad47d422fdd887e9e665c034c0ba870 · 2026-09-16 17:49:14 -0700 · Steve Abrams

Heartbeat data/backfill-latest.json (verdict PASS + counts) written AFTER the
side effect so its mtime proves the sole producer actually fired, not just that
launchd reports it running. Lets the job run --quiet (bounded disk) while
staying observable. TK-11870.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012hTBDZLzS7vZzHrjZwVfVd

Files touched

Diff

commit 9a4cc5863ad47d422fdd887e9e665c034c0ba870
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Wed Sep 16 17:49:14 2026 -0700

    backfill: write a bounded liveness heartbeat after the paint
    
    Heartbeat data/backfill-latest.json (verdict PASS + counts) written AFTER the
    side effect so its mtime proves the sole producer actually fired, not just that
    launchd reports it running. Lets the job run --quiet (bounded disk) while
    staying observable. TK-11870.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_012hTBDZLzS7vZzHrjZwVfVd
---
 terminal_status.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/terminal_status.py b/terminal_status.py
index f7f0346..ee87193 100644
--- a/terminal_status.py
+++ b/terminal_status.py
@@ -1176,6 +1176,22 @@ def main(argv=None):
         # (no CLAUDE_CODE_CHILD_SESSION), so the child-session paint rail never trips.
         rows = processes(fresh=True)
         painted, floored, skipped = store.backfill(rows)
+        # Liveness heartbeat, written AFTER the side effect (memory
+        # liveness-artifact-must-follow-the-side-effect): its mtime proves the sole
+        # producer actually FIRED (not just that launchd reports it "running"), and
+        # its counts show what it did. Bounded (overwritten each run). Never breaks
+        # the paint if the write fails.
+        try:
+            hb = store.user_root / "Projects/terminal-status/data/backfill-latest.json"
+            hb.parent.mkdir(parents=True, exist_ok=True)
+            atomic_write(hb, json.dumps({
+                "ts": dt.datetime.now(dt.timezone.utc).isoformat(),
+                "verdict": "PASS", "status": "PASS",
+                "painted": painted, "floored": floored, "skipped": skipped,
+                "live_owners": len(owners(rows)),
+            }, indent=2) + "\n")
+        except OSError:
+            pass
         if not getattr(args, "quiet", False):
             print("backfill: repainted %d, floored %d, skipped %d"
                   % (painted, floored, skipped))

← 3790923 backfill: always-on dot self-heal (repaint dropped dots + gr  ·  back to Terminal Status  ·  auto-data-snapshot: 2026-09-16T17:53:57 (1 data files) — dat 2d1ea55 →