feat(reports): reference-baseline mode (typed limits / prior averages)

Baseline can now come from fixed values typed per location, not just captured
data — for a spec limit ("L10 = 85") or a prior report's averages when the raw
data isn't available.

- SoundReportConfig.baseline_mode ("captured" | "reference").
- report_pipeline: _location_reference_baseline() reads per-location values from
  location_metadata; build_*_night_report honor baseline_mode (reference cells
  use the typed value; unset metrics compare against nothing).
- reports router: GET/PUT /reports/baseline (mode on config + per-location values
  in location_metadata); config carries baseline_mode; manual view/run fall back
  to the saved config's baseline when no explicit dates are given.
- orchestrator + scheduler tick thread baseline_mode through.

Verified end-to-end: PUT/GET /baseline, reference deltas (L10 66.6 vs 85 -> -18.4),
unset metrics compare against nothing, captured-mode regression intact.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-11 20:26:23 +00:00
parent 7fb4ba0343
commit c1b5efae56
5 changed files with 184 additions and 16 deletions
+1
View File
@@ -828,6 +828,7 @@ class SchedulerService:
result = run_nightly_report(
db, cfg.project_id, night_date,
metric_keys=metric_keys,
baseline_mode=cfg.baseline_mode,
baseline_start=cfg.baseline_start,
baseline_end=cfg.baseline_end,
recipients=recipients,