fix(report_pdf): add missing histogram_interval_size_s field

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) <noreply@anthropic.com>
This commit is contained in:
2026-05-28 18:07:41 +00:00
parent 86325b9bab
commit ad2702d4bf
+2
View File
@@ -129,6 +129,7 @@ class ReportData:
histogram_stop_str: Optional[str] = None histogram_stop_str: Optional[str] = None
histogram_n_intervals: Optional[float] = None # 4.00 histogram_n_intervals: Optional[float] = None # 4.00
histogram_interval_size: Optional[str] = None # "1 minute" 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 histogram_interval_times: list[str] = field(default_factory=list) # per-interval timestamps for x-axis
# Peak Vector Sum metadata (histograms show absolute date+time) # 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_stop_str = hist_block.get("stop")
rd.histogram_n_intervals = hist_block.get("n_intervals") rd.histogram_n_intervals = hist_block.get("n_intervals")
rd.histogram_interval_size = hist_block.get("interval_size") 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 [] rd.histogram_interval_times = hist_block.get("interval_times") or []
# ── Waveform samples — from the .h5 via the existing helper ── # ── Waveform samples — from the .h5 via the existing helper ──