prop/lib/microwaveprop/weather
Graham McIntire 3f2d97735e
fix: three more Rust/Elixir contract drift bugs on /map and /weather
Found by auditing the ProfilesFile, hrrr_profiles, and weather-layer
contracts against what the Rust writers actually emit.

Bug 1 (HIGH) — Rust `hrrr_points` worker upserted hrrr_profiles rows
  with NULL `surface_refractivity`, `min_refractivity_gradient`, and
  `ducting_detected`. The Elixir HrrrClient path always wrote them
  via SoundingParams.derive. Per-QSO pages that rely on these
  scalars ("N:", "dN/dh:", duct badge) showed "—" for any contact
  enriched through Stream C. Fixed by porting
  `surface_refractivity` + `ducting_detected` into Rust's
  `sounding_params.rs` and deriving at upsert time.

Bug 2 (HIGH) — Rust f01..f18 `cell_to_profile_entry` never emitted
  wind_u / wind_v / cloud_cover_pct / precip_mm into ProfilesFile
  cells. `Propagation.factors_for` recomputes factor scores from the
  profile cell on /map click, and these four fields are read
  (wind_speed_kts, sky_cover_pct, precip_to_rate_mmhr). Result: every
  f01..f18 point-detail popup showed 0 for wind/sky/rain factors.
  Fixed by extracting the grib values at cell_to_profile_entry time
  and whitelisting the keys for atomization in
  profiles_file.ex `@mp_atom_keys`.

Bug 4 (MEDIUM) — `WeatherLayers.duct_field/2` only knew the
  `SoundingParams.detect_ducts` shape (`d["base"]` / `d["strength"]`).
  The Rust/HrrrNativeClient shape uses `:base_m` / `:thickness_m`
  atom keys (post-ProfilesFile.read atomization). On /weather, the
  Duct Base / Duct Strength layers returned nil for every Rust-origin
  cell. Tolerant lookup now reads either shape; uses `thickness_m`
  as the "strength" proxy for the native shape (thicker duct traps
  a wider band).

Skipped (verified but lower impact):
- Rust ProfilesFile aggregates ducts as scalars, not per-layer — the
  `ducts` array in the popup is always empty. Requires larger
  DuctMetrics refactor in Rust; deferred.
- `complete_hrrr_task` emits no NOTIFY (vs `complete` which does).
  Elixir has no matching listener yet, so adding NOTIFY alone is a
  no-op; the existing cron reconciler catches it.
- `:best_duct_band_ghz` fallback in propagation.ex is dead code;
  cleanup, not a bug.

133 Rust tests + 2842 Elixir tests + credo green.
2026-04-24 14:04:02 -05:00
..
grib2 fix(dialyzer): clear 125+ warnings under strict flags 2026-04-21 10:30:06 -05:00
frontal_analysis.ex fix(dialyzer): clear 125+ warnings under strict flags 2026-04-21 10:30:06 -05:00
gefs_client.ex perf(concurrency): partition Task.Supervisor to remove bottleneck on heavy async_stream paths 2026-04-21 14:20:29 -05:00
gefs_profile.ex feat(gefs): scaffold extended-horizon forecast ingestion 2026-04-18 14:28:44 -05:00
grid_cache.ex feat(observability): emit telemetry for NotifyListener warm + GridCache hit/miss 2026-04-21 13:30:26 -05:00
hrrr_client.ex perf(concurrency): partition Task.Supervisor to remove bottleneck on heavy async_stream paths 2026-04-21 14:20:29 -05:00
hrrr_climatology.ex fix(logging): suppress /metrics logs and harden scorer hot path 2026-04-21 10:44:25 -05:00
hrrr_native_client.ex Fix credo warnings: struct specs, length/1, and test patterns 2026-04-12 10:26:53 -05:00
hrrr_native_profile.ex Extend skew-T plot to cover the full troposphere 2026-04-14 17:25:58 -05:00
hrrr_point_enqueuer.ex feat: harden /map analysis breakdown + move Plausible to root layout 2026-04-21 15:56:30 -05:00
hrrr_profile.ex Add dialyzer specs and types across the codebase 2026-04-12 08:55:04 -05:00
iem_client.ex perf(weather): adaptive IemRateLimiter + rebatch mix task 2026-04-24 12:57:25 -05:00
iem_rate_limiter.ex perf(weather): adaptive IemRateLimiter + rebatch mix task 2026-04-24 12:57:25 -05:00
iemre_observation.ex Add dialyzer specs and types across the codebase 2026-04-12 08:55:04 -05:00
metar_5min_observation.ex Add dialyzer specs and types across the codebase 2026-04-12 08:55:04 -05:00
narr_client.ex fix(dialyzer): actually fix LiveTable warnings instead of hiding them 2026-04-21 12:58:10 -05:00
narr_profile.ex Rename ERA5 → NARR across the codebase 2026-04-16 09:22:23 -05:00
ncei_metar_client.ex feat(telemetry): broaden Instrument span coverage 2026-04-18 17:25:33 -05:00
nexrad_cache.ex fix(dialyzer): clear 125+ warnings under strict flags 2026-04-21 10:30:06 -05:00
nexrad_client.ex test: expand coverage and refactor to idiomatic style 2026-04-23 13:28:42 -05:00
nexrad_observation.ex Add dialyzer specs and types across the codebase 2026-04-12 08:55:04 -05:00
rebatch_asos.ex perf(weather): asos_day — one job per unique (station, UTC date) 2026-04-24 13:19:20 -05:00
rtma_client.ex feat(telemetry): broaden Instrument span coverage 2026-04-18 17:25:33 -05:00
rtma_observation.ex Add dialyzer specs and types across the codebase 2026-04-12 08:55:04 -05:00
solar_client.ex feat(telemetry): broaden Instrument span coverage 2026-04-18 17:25:33 -05:00
solar_index.ex Add dialyzer specs and types across the codebase 2026-04-12 08:55:04 -05:00
sounding.ex Add dialyzer specs and types across the codebase 2026-04-12 08:55:04 -05:00
sounding_params.ex fix(weather): accept Rust profile shape in SoundingParams + WeatherLayers 2026-04-24 13:53:02 -05:00
station.ex Add dialyzer specs and types across the codebase 2026-04-12 08:55:04 -05:00
surface_observation.ex Add dialyzer specs and types across the codebase 2026-04-12 08:55:04 -05:00
theta_e.ex Guard against zero specific humidity in theta-e computation 2026-04-11 12:52:32 -05:00
uwyo_sounding_client.ex feat(telemetry): wide instrumentation + bump hrrr to 2 per pod 2026-04-18 16:33:34 -05:00
weather_layers.ex fix: three more Rust/Elixir contract drift bugs on /map and /weather 2026-04-24 14:04:02 -05:00