dashboard: statsdump exits cleanly when its handle is dead; sparkline comment told a third wrong story

Judge ringer 4 on the final tree (3 slices, Tasmania, independent questions).
Slice A PASS-WITH-CAVEATS, slice B PASS-WITH-CAVEATS, slice C FAIL. Both
findings were real and both are fixed here.

statsdump (slice B, R1 + R2): the rotation fix deferred the death instead of
removing it. If the best-effort reopen inside rotate() itself fails, out stays
CLOSED, the re-raised OSError is swallowed by the cap check's handler, and the
next poll's write raises ValueError -- which no handler in the file catches
(they all catch OSError). Slice B found the unpatched twin in the write-failure
handler: close succeeds, reopen fails (EMFILE/ENOENT/EACCES/EIO -- not ENOSPC,
which append-open survives), and the cap check's out.tell() dies on the closed
handle two statements later. Both paths now raise a dedicated RecorderDead,
caught at the loop: the recorder exits loudly with its exit summary, because a
handle that cannot be reopened means recording cannot continue. Deferring a
traceback by one iteration was the wrong ambition; exiting with the count is
the honest terminal state.

Canaries reproduce both geometries (reopen fails after rotation shift fails;
reopen fails after write fails): pre-fix dies 'ValueError: I/O operation on
closed file' with no summary in both; post-fix exits rc=0/rc=1 with the summary
printed in both.

dashboard.cpp (slice C, FAIL): my previous commit replaced one wrong sparkline
comment with another. The truth, verified against the call sites: setMetric
samples EVERY poll for every tile (idle polls push 0), so the accept sparkline
spans the same 60 s as the others; the only difference is the dash case -- no
draft head, no value, a gap that stretches the line over more wall-clock. The
original comment claimed 10 s drafting windows; my rewrite claimed drafting-only
sampling, conflating the sparkline (setMetric/hist) with the triple's recent
window (noteSample, win=false). Two lies in one comment block, both caught by
review rather than by me.

Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
This commit is contained in:
Memoria (Noblistic) authored and StillDeadcode committed 2026-10-21 09:27:48 +02:00
1 parent b2e0ef7911
commit 459529638e
2 files changed
+21 -8

No files matched your search

+16 -5
View File
@@ -30,6 +30,15 @@
# for a quiet hour.
import argparse, json, os, sys, time, urllib.error, urllib.request
class RecorderDead(Exception):
"""The output handle could not be reopened; recording cannot continue.
A closed handle raises ValueError on the next write/tell, which the OSError
handlers do not catch -- the poller would die with a traceback and no exit
summary (judge-4 slices B R1/R2). Dying HERE, loudly, with the summary, is
the honest terminal state: the recorder cannot record."""
def main():
ap = argparse.ArgumentParser(add_help=True)
ap.add_argument("--port", type=int, default=8800)
@@ -79,9 +88,9 @@ def main():
# this succeeds even on a full disk, and the poller keeps counting losses.
try:
out = open(a.out, "a")
except OSError:
pass
raise
except OSError as reopen_err:
raise RecorderDead("reopen after failed rotation: %s" % reopen_err) from None
raise # reopen succeeded: the ORIGINAL error is now safe to swallow upstream
sys.stderr.write("statsdump: %s/stats every %.1fs -> %s\n" % (base, a.every, a.out))
try:
while True:
@@ -126,8 +135,8 @@ def main():
pass
try:
out = open(a.out, "a")
except OSError:
pass
except OSError as reopen_err:
raise RecorderDead("reopen after failed write: %s" % reopen_err) from None
if a.max_mib > 0:
try:
if out.tell() >= a.max_mib * 1024 * 1024:
@@ -142,6 +151,8 @@ def main():
time.sleep(left)
except KeyboardInterrupt:
sys.stderr.write("statsdump: interrupted\n")
except RecorderDead as e:
sys.stderr.write("statsdump: DEAD (%s) -- exiting with summary\n" % e)
finally:
try:
out.close()