prop/lib/microwaveprop/pskr
Graham McIntire fe2ad2df15
fix(pskr): self-healing follow-up sampler runs for hours with missing HRRR
The producer-only path left older hours stuck at 0% HRRR coverage
forever once their fetch tasks drained: the rolling-window cron only
re-passes the prior hour, so manual lookback runs (or any
out-of-window hour) wrote NULL samples + enqueued tasks, then never
re-ran to UPSERT the now-landed HRRR data.

Fix: split the responsibility cleanly.

* CalibrationSampler.build_for_hour/1 now returns
  %{upserted: int, missing_hrrr_cells: int} so callers know whether
  the producer enqueued anything (i.e. whether a follow-up makes
  sense). Spec-tightened with a new @type result.
* PskrCalibrationWorker, after each hour's sampler pass, schedules a
  follow-up of itself for that exact hour 10 min later when missing
  > 0. The follow-up carries args %{"hour_utc" => ..., "_follow_up"
  => true}; the sentinel prevents follow-ups from chaining further
  follow-ups (rolling-window cron is the safety net).

Tests:
* Updated 4 existing sampler tests to the new map return shape.
* Moved the follow-up assertions from the sampler suite into the
  worker suite where they belong (sampler is now scheduling-free).
* Added 3 worker tests: schedules-when-missing, no-schedule-when-
  covered, follow-up-doesn't-chain.

3313 tests + 228 properties, 0 failures.
2026-05-05 18:00:10 -05:00
..
aggregator.ex feat(pskr): ingest PSK Reporter MQTT firehose for weather correlation 2026-05-04 09:24:20 -05:00
calibration_sample.ex feat(pskr): hourly calibration sampler joining spots × HRRR × Kp 2026-05-04 16:12:47 -05:00
calibration_sampler.ex fix(pskr): self-healing follow-up sampler runs for hours with missing HRRR 2026-05-05 18:00:10 -05:00
client.ex fix(pskr): require both ends in CONUS for MQTT subscriptions 2026-05-04 13:07:45 -05:00
feature_bin.ex feat(pskr): weekly recalibration analysis on the calibration corpus 2026-05-04 16:18:17 -05:00
mqtt.ex refactor(pskr): drop emqtt, talk MQTT 3.1.1 over :gen_tcp directly 2026-05-04 09:52:34 -05:00
recalibration_run.ex feat(pskr): weekly recalibration analysis on the calibration corpus 2026-05-04 16:18:17 -05:00
recalibrator.ex feat(pskr): weekly recalibration analysis on the calibration corpus 2026-05-04 16:18:17 -05:00
spot_hourly.ex feat(pskr): preserve full locator precision from MQTT spots 2026-05-04 12:42:46 -05:00