From ad2702d4bf73f9f9a7dd1d21623a63782297e415 Mon Sep 17 00:00:00 2001 From: serversdown Date: Thu, 28 May 2026 18:07:41 +0000 Subject: [PATCH] fix(report_pdf): add missing histogram_interval_size_s field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The histogram-interval-times derivation block at line 314 references rd.histogram_interval_size_s, but the field wasn't declared on the ReportData dataclass — only the string form histogram_interval_size was. Result: every PDF render of a histogram event raised AttributeError → 500 from /db/events/{id}/report.pdf. Cause: when the histogram aggregation block was inlined into gather_report_data, the seconds-numeric counterpart that the projection already carries (bw_report.histogram.interval_size_s) was never wired into the dataclass. Waveform PDFs weren't affected because the offending line is gated on is_histogram. Fix: add the field, read it from the projection alongside the other histogram keys. No-op for waveform events (the field stays None and the gate skips it). Co-Authored-By: Claude Opus 4.7 (1M context) --- sfm/report_pdf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sfm/report_pdf.py b/sfm/report_pdf.py index 2f57f63..2a30939 100644 --- a/sfm/report_pdf.py +++ b/sfm/report_pdf.py @@ -129,6 +129,7 @@ class ReportData: histogram_stop_str: Optional[str] = None histogram_n_intervals: Optional[float] = None # 4.00 histogram_interval_size: Optional[str] = None # "1 minute" + histogram_interval_size_s: Optional[float] = None # 60.0 — numeric seconds, used to derive interval_times histogram_interval_times: list[str] = field(default_factory=list) # per-interval timestamps for x-axis # Peak Vector Sum metadata (histograms show absolute date+time) @@ -265,6 +266,7 @@ def gather_report_data( rd.histogram_stop_str = hist_block.get("stop") rd.histogram_n_intervals = hist_block.get("n_intervals") rd.histogram_interval_size = hist_block.get("interval_size") + rd.histogram_interval_size_s = hist_block.get("interval_size_s") rd.histogram_interval_times = hist_block.get("interval_times") or [] # ── Waveform samples — from the .h5 via the existing helper ──