feat(vessels): VesselAPI quota-capped AIS poller for Middle East blind spot

Add a server-side REST poller for VesselAPI (free tier 150 calls/mo) that
upserts last-known positions into the shared vessel_last_known store when
AISStream is unset. Default box is the Strait of Hormuz (span 3.6 <= 4 deg),
never CONUS/NC (AISStream owns US coasts).

- app/vesselapi.py: worker loop, 4deg span validator, position->marker
  transform (skip suspected_glitch), durable Postgres daily-quota table.
- Local hard cap 5 successful 2xx/UTC day (VESSELAPI_MAX_CALLS_PER_DAY),
  monthly floor from X-RateLimit-Remaining, single request limit=50, no
  nextToken, no filter.sat, no retry-storm.
- keystore VESSELAPI_API_KEY registry entry; config + compose env passthrough
  (app + ingest); wired next to AISStream in main.py lifespan + run_ingester.
- GET /api/vessels docstring notes AISStream and/or VesselAPI cache.
- tests/test_vesselapi.py: 20 unit tests (no network/DB).
This commit is contained in:
Sirius DevOps 2026-08-29 00:18:49 -04:00
commit 1f23083351
8 changed files with 806 additions and 3 deletions

View file

@ -72,6 +72,11 @@ KEY_REGISTRY: dict[str, dict] = {
"pattern": r"^.{8,}$",
"example": "key from https://aisstream.io/account (GitHub login)",
},
"VESSELAPI_API_KEY": {
"description": "VesselAPI REST AIS (150 calls/mo free; server-side poller).",
"pattern": r"^.{8,}$",
"example": "Bearer token from https://dashboard.vesselapi.com/",
},
"OPENSKY_CLIENT_ID": {
"description": "OpenSky OAuth client id — optional ADS-B fallback (unused until enabled).",
"example": "client id from opensky-network.org account",