Fixed a critical bug in crates/wx-bet/src/resolve.rs (resolve_one) where ~half of all markets would silently never resolve due to IEM’s publish lag and per-station flakiness.

Symptoms

  • Roughly half of all markets skip resolution entirely
  • No resolution rows written for affected markets
  • Particularly bad for non-US ICAO stations (e.g. Paris/LFPB never published on IEM)

Root Cause

resolve_one fetched IEM ASOS as the primary source. If IEM failed, the market was skipped entirely. IEM has two fatal properties that make it unsuitable as a gating dependency:

  1. ~2-day publish lag — data is not available until well after the resolution window
  2. Per-station flakiness — many international stations (e.g. LFPB) never publish to IEM at all

Meanwhile, TWC (Weather.com) is the source Polymarket actually resolves on, making IEM’s unavailability doubly wrong: it blocked resolution on a source that is both more reliable and authoritative.

Fix

Rewrote resolve_one in crates/wx-bet/src/resolve.rs:

  1. Fetch TWC first as primary (when configured)
  2. Fetch IEM as cross-check/fallback — never gates resolution on its own
  3. Log reconciliation only when both are present (delta > 2°C → warn, else info)
  4. Use TWC value if present, else IEM; only skip the market if both fail
  5. Store iem_celsius / twc_celsius as Option<i32> — whichever sources are present

Source authority

TWC is what Polymarket resolves on. IEM is a secondary cross-check. Never gate resolution on IEM availability.

Tests Added

File: crates/wx-bet/tests/resolve.rs

TestWhat it covers
iem_unavailable_twc_present_resolves_on_twcRegression: IEM 500 errors, TWC valid → market resolves on TWC value
both_sources_present_twc_wins_and_reconcilesBoth present → reconciles log emitted, TWC value used
both_sources_unavailable_skips_resolutionBoth fail → no resolution row written

Refactored test helper from past_market()past_market_with_slug(slug) for DRY setup across all three tests.

Verification

cargo fmt --check          # clean
cargo clippy (lib+tests)   # 0 warnings
cargo test -p wx-bet --features wx-core/testkit   # 25/25 passed (5 resolve tests green)

Known pre-existing issue

cargo clippy --all-targets fails due to a build.rs + -D warnings flag interaction that predates this change. Not caused by this fix.