fix(forward-log): distinguish histograms from missing-report (v1.5.3)
On machines running histogram-mode units (extensions ending in H,
e.g. H907L1R7.PG0H), every forwarded event was logging "no report"
even though histograms never get auto-exported ASCII reports from
Blastware — making the log look like every forward was misconfigured
when in fact things were working correctly.
Three log states now:
- Waveform + paired TXT
→ "+ <txt> attached"
- Waveform without TXT (likely BW config issue)
→ "no report ⚠"
- Histogram (any flavour)
→ "(histogram, no report expected)"
New is_histogram_event() helper classifies by BW filename extension:
4-char ext ending in H = histogram; old-firmware 3-char extensions
default to non-histogram (safe default — we'd rather flag a missing
report than silently suppress the warning on a real waveform event).
Forwarding logic itself is unchanged — this is purely log clarity.
This commit is contained in:
+37
-5
@@ -101,6 +101,23 @@ def report_path_for(binary_path: str) -> str:
|
||||
return binary_path + ".TXT"
|
||||
|
||||
|
||||
def is_histogram_event(filename: str) -> bool:
|
||||
"""True if the filename's extension marks the file as a Full Histogram
|
||||
event (BW filename scheme: 4-char extensions of the form ``AB0T`` where
|
||||
``T = H``). Old-firmware events use 3-char extensions where waveform-vs-
|
||||
histogram is not encoded in the name; we can't tell those apart and
|
||||
return False (the conservative answer — we don't want to suppress
|
||||
"no report" warnings on potentially-waveform old-firmware events).
|
||||
|
||||
Used purely for log clarity — histograms don't get auto-exported BW
|
||||
ASCII reports, so "no report" on a histogram is not a problem to
|
||||
flag. Forwarding logic itself doesn't depend on this check.
|
||||
"""
|
||||
name = os.path.basename(filename)
|
||||
ext = os.path.splitext(name)[1].lstrip(".").upper()
|
||||
return len(ext) == 4 and ext.endswith("H")
|
||||
|
||||
|
||||
# ── State file ────────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
@@ -513,12 +530,27 @@ def forward_pending(
|
||||
counts["forwarded"] += 1
|
||||
if txt_path:
|
||||
counts["with_report"] += 1
|
||||
|
||||
# Differentiate three cases in the log so "no report" is only
|
||||
# noisy when something's actually unexpected:
|
||||
# - waveform + TXT → "+ <txt> attached"
|
||||
# - waveform without TXT → "no report ⚠" (BW maybe didn't auto-export)
|
||||
# - histogram (any flavour) → "(histogram, no report expected)"
|
||||
if txt_path:
|
||||
report_token = "+ {} attached".format(os.path.basename(txt_path))
|
||||
elif is_histogram_event(binary_path):
|
||||
report_token = "(histogram, no report expected)"
|
||||
else:
|
||||
report_token = "no report ⚠"
|
||||
|
||||
_log(
|
||||
f"[forward] OK {os.path.basename(binary_path)} "
|
||||
f"({result.get('filesize', 0)}B, "
|
||||
f"{'with' if txt_path else 'no'} report, "
|
||||
f"inserted={result.get('inserted', 0)}, "
|
||||
f"skipped={result.get('skipped', 0)})"
|
||||
"[forward] OK {} ({}B, {}, inserted={}, skipped={})".format(
|
||||
os.path.basename(binary_path),
|
||||
result.get("filesize", 0),
|
||||
report_token,
|
||||
result.get("inserted", 0),
|
||||
result.get("skipped", 0),
|
||||
)
|
||||
)
|
||||
else:
|
||||
counts["errors"] += 1
|
||||
|
||||
Reference in New Issue
Block a user