feat(geofence): watch list, filtered hit log, fence snapshot #47
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/geofence-watch"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Off-viewport geofence watches, filterable hit log, fence-scoped DVR snapshot.
Phase 2 CRUD already existed;
geofence_alertonly reached clients whose map viewport contained the point. A user who drew a fence and panned away got silence. This PR is the backend contract the HUD (t_3b1b5414) will consume.WS contract (
/ws/live)Client → server:
ids= watch none (viewport-only again).Server → client
geofence_alertif either:(lat, lon)(unchanged), orpayload.geofence_idis in that client's watch set.AIS / ADS-B /
fire_aircraftstay viewport-only.HTTP
GET /api/geofence-alerts?geofence_id=&since=&until=&source_kind=firms|ais|adsb&limit=(1–500, default 100). Same collection path; 422 on badsource_kind.GET /api/geofences/{id}/at?timestamp=<ISO>→{geofence_id, timestamp, aircraft, vessels, fires}. 404 if fence missing. Empty lists if DB down. No writes / norecord_and_notify.DELETE /api/geofences/{id}→ 404 when the row is gone (was always 204).Schema
Alembic
011_geofence_alerts_fence(revises010_bbox_gist):ix_geofence_alerts_fence_created ON geofence_alerts (geofence_id, created_at DESC).Tests
pytest tests/test_geofence.py tests/test_phase2_api.py— 27 passed (watch a/b/c, AIS still viewport-only, filtered alerts,/at404 + empty lists, DELETE 404). Kepttest_geofence_post_rejects_point.Off-viewport clients that send {type:watch_geofences,ids} on /ws/live still receive geofence_alert; AIS/ADS-B stay viewport-only. GET /api/geofence-alerts accepts geofence_id/since/until/source_kind. GET /api/geofences/{id}/at returns CAGG+FIRMS inside the fence at T (404 if missing, empty lists if DB down). DELETE missing fences 404s.