Make main green again + warm-up hardening from the #254 audit - #255
Conversation
Since b9fd39b sim_push_adsb_positions rejects any hex that fails is_transponder_hex(), so the readable "sim{name}" fixtures are dropped before they reach state.adsb_aircraft and the test dies on the KeyError instead of testing the writer. The tcp/fp writers don't filter, so only this class needs real-looking 24-bit addresses. Main has been red on exactly these three cases since the #253 merge. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The combined `with` fits on one line at the repo's 120-char limit. Caught by CI's pre-commit gate, which I should have run before pushing rather than `ruff check` alone. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Two follow-ups from auditing #254: _load_borders() filled _geoms feature-by-feature behind an unlocked fast-path check, so a caller running concurrently with the parse could observe {"us"} only, skip the load, and silently classify a Canadian point as unsupported. Unreachable while every caller sat on the event loop, but the warm-up moved the parse onto a threadpool thread, which removed that structural guarantee. Build the dict locally and publish it in one update instead. The lifespan called warm_borders() unguarded, turning a missing or corrupt geojson into a whole-API boot failure where it used to be a 500 on /api/towers alone - the exact blast radius prime_pipeline_at_startup documents refusing, ten lines up. Swallow and log; classify_region still loads on demand. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Claude finished @jehanazad's task in 5m 57s —— View job Claude finished reviewing this PR
SummaryBoth fixes and both hardening changes hold up. Verified against
Findings1. Comment overclaims parity with The new Failure scenario: the borders GeoJSON goes missing or gets corrupted in a deploy (e.g. a This may be an intentional severity call (smaller blast radius than losing the whole v1 fleet), in which case the comment should say the policy differs rather than claiming parity. Either way it's worth a one-line fix. 2. Latent overflow in the sim-hex fixture generator — _SIM_CASE_HEX = {name: f"a1b2c{i}" for i, (name, _kin) in enumerate(_WRITE_CASES)}This is exactly 6 hex chars only while 3. Minor duplication (not a fix request) — the new Notes
|
Main has been red since the #251 merge, on two independent counts. This fixes both, plus two hardening items a post-merge audit of #254 surfaced.
Unbreak CI
sim_push_adsb_positionsto reject non-transponder hexes, so the test's readablesim{name}fixtures are dropped before they reachstate.adsb_aircraftand the parametrized cases die onKeyErrorinstead of testing the writer. The fixtures are now real-looking 24-bit addresses. The tcp/fp writer tests don't filter and keep their labels.test_region_lookup_warm.pywas pushed toperf/warm-border-polygonsat 21:39:03Z — the same minute Parse the border polygons at startup, not on the first request #254 merged — so it never triggered CI and never reached main. Cherry-picked here (92fd98b).Warm-up hardening (audit findings on #254)
_load_borders()filled_geomsfeature-by-feature behind an unlocked fast-path check. A caller concurrent with the parse could observe{"us"}only, skip the load, and silently 422 a valid Canadian point. Unreachable while every caller sat on the event loop — but Parse the border polygons at startup, not on the first request #254 moved the parse onto a threadpool thread, removing that structural guarantee. The dict is now built locally and published in oneupdate.warm_borders()unguarded, turning a missing/corrupt geojson into a whole-API boot failure (plus deploy rollback) where it used to be a 500 on/api/towersalone — the exact blast radiusprime_pipeline_at_startupdocuments refusing, ten lines up. Now swallowed and logged;classify_regionstill loads on demand.Verified locally: the 3 KeyError cases fail on clean main and pass here; 172 tests across the affected files pass; full
pre-commit run --all-files(ruff check/format, vulture, config drift) green.🤖 Generated with Claude Code