Weather backend: NWS active alerts + nearest-METAR wind, cached (Refs #237) #263
No Reviewers
Labels
Clear labels
area/ai-pipeline
area/auth
area/billing
area/correlation
area/discord
area/frontend
area/governance
area/growth
area/infra-deploy
area/legal
area/map
area/mqtt
area/node-ota
area/osint
area/recording-audio
area/sdr-radio
area/transcription
board
board:agenda
minutes:draft
minutes:final
role:ceo
role:cfo
role:cio
role:ciso
role:cmo
role:coo
role:cto
Scene/entity extraction, summarizer, AI providers, embeddings
AuthN/Z, roles, tenancy/org scoping, API keys, credentials
Plans, entitlements, AI spend accounting and caps
Incident correlation, linking, lifecycle, severity, corr_debug
Discord bot, radio bots, voice streams, bot tokens, webhooks
Web UI: Next.js app and the edge-node local dashboard
Board process, minutes, unattended runner, agent tooling
Go-to-market, outreach, cold email, discovery conversations
CI/CD, VM, registry, Firestore rules/indexes deploy, Terraform/Caddy
ToS, retention, licences/DAAs, CAN-SPAM, E&O, name suppression
Live map: pins, paths, tiles, legend, geocoding
Node-C2 MQTT, checkins, commands, node sweeper, dynsec
Node install, enrollment, OTA updater, image skew
External feeds: cameras, 511, ADS-B, AIS, outages, and their licences
Call capture, boundaries, PulseAudio, ring buffer, trimming, attribution
OP25 decode, SDR hardware/tuning, conventional, second SDR, mesh radio
STT, transcript correction, place verification, name accuracy
Board process: minutes and board-filed items
Needs board scoping at the next sitting; CEO removes the label once scoped
One exec pre-read, closed by CEO
CEO ruling; open until enacted
Filed by the CEO
Filed by the CFO
Filed by the CIO
Filed by the CISO
Filed by the CMO
Filed by the COO
Filed by the CTO
kind
behavior-bug
Wrong product behavior; the instrument reads it correctly
kind
measurement-bug
Corrupts the recording/instrument (debug data, evals, health checks), not behavior
priority
p0
Drop everything: prod broken, live exposure, or owner-ruled P0
priority
p1
Next up: blocks a gate, a customer, or core incident quality
priority
p2
Normal: real defect or planned work, schedule in turn
priority
p3
Low: minor, cosmetic, or someday
status
blocked
Waiting on an external party, spend, or another issue
status
in-progress
Branch or PR open against it
status
needs-decision
Waiting on an owner or board ruling before work
status
needs-info
Root cause or repro unknown; needs a reading first
type
bug
Something built is wrong: code, data, or a measurement
type
chore
Maintenance, refactor, tests, pinning, cleanup: no user-visible change
type
decision
A ruling to make or record: board minutes, owner calls, legal reviews
type
docs
Docs, runbooks, CLAUDE.md, skills, SOPs
type
feature
New capability or an extension of an existing one
type
security
Security, privacy, credential or tenant-isolation exposure
type
tracking
Tracker, checklist, initiative or punch-list spanning several changes
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: logan/server-26#263
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Server-side weather backend for #237 (part 1 of 2; map layers land in batch 5). This PR does not close #237.
What it adds
GET /weather/alerts?south&west&north&east(bbox optional): NWS active alerts forNWS_AREA(defaultNY), returning{alerts, zone_only, fetched_at, error, credit: "National Weather Service"}. Each alert is{id, event, severity, urgency, headline, onset, expires, ends, sender_name, area_desc, geometry, geometry_source, bbox, zones}.GET /weather/wind?lat&lon: nearest METAR within 75 km →{available, reason, wind: {station, station_name, distance_km, obs_time, wind_dir_deg, variable, wind_kt, gust_kt, stale, raw}, fetched_at, error, credit}.require_service_or_firebase_token, the same as/traffic.nws_user_agent(a placeholder that must be overridden in prod; it logs a warning once if left as is),nws_area,weather_alerts_ttl_s=90..env.examplehas the two env keys next to the 511 keys.Acceptance (backend half)
errorandfetched_at. It never returns a silently empty list. It retries after 30 s.geometry: null) get their polygons fromaffectedZones. Zone shapes are cached for 24 h, failed zone fetches for 15 min, and onlyhttps://api.weather.gov/zones/URLs are ever fetched. Any alert still unresolved goes tozone_only, which is never bbox-filtered or dropped.Upstreams checked by hand on 2026-10-05: NWS
/alerts/active?area=returns GeoJSON, and a large share of alerts have null geometry./zones/forecast/Xreturns a Polygon. AWC/api/data/metar?bbox=minLat,minLon,maxLat,maxLon&format=jsonreturns a JSON list, 204 with an empty body when no station is in the box, andwdircan be"VRB". A live smoke test against CA, FL and AK worked: 21 mapped and 10 zone_only, the latter only because of the 80-zone-fetch-per-refresh cap, so they resolve over the next refreshes. White Plains wind resolved to KHPN at 5.9 km.Brief deviation: the wind cache is per 0.5° area cell, not per station. One bbox query serves every point in the cell, so it is still one upstream call per 5 min per area.
Heads-up for the batch-5 map layer: zone-resolved polygons are heavy. The live CA/FL/AK payload was about 2.1 MB unfiltered, so the frontend should always pass the viewport bbox. Follow-up filed as #264 (simplification).
Tests:
tests/test_weather.py, 9 tests (happy path + UA, null-geometry/zone_only, 500 keeps last-good, canary, empty list OK, single-flight cache, bbox filter/validation, wind nearest/VRB/dedupe/cache, wind unavailable). Full c2-core suite: 863 passed.Refs #237
🤖 Generated with Claude Code
Review (
bdbde35): pushed two fixes. (1) Zone fetches now have a 15 s wall-clock budget, because they run under the feed lock and a hung zone endpoint could stall every /weather/alerts request for minutes. New test covers it. (2) The prod c2-core.env.j2 never set NWS_USER_AGENT, so the VM would have sent the placeholder with no contact. It now defaults to the site URL and can be overridden with vault_nws_user_agent. The full c2-core suite passes: 864. Not merged.