Commit Graph
12 Commits
Author SHA1 Message Date
daikaginza 9bb557bc2a Merge remote-tracking branch 'upstream/main' into fix/opensky-track-credit-governor 2026-10-16 09:16:41 +07:00
Sameh Khamis a02f729191 fix(opensky): cool down before reading a 429, and test the six caps
A 429 now starts the credit cooldown from its headers and drops the body
unread, so a stalled or oversized 429 cannot skip the governor; an oversized
snapshot is not retried. A 429 without retry-after now waits the intended
2 minutes (headers.get() returns null, which Number() read as 0 s). Adds
oversized-stream tests for OpenSky, adsb.lol, CelesTrak and TomTom that fail
on main, names the six reads in the changelog, and corrects the docs on
what was already bounded.
2026-10-15 13:08:37 -07:00
Michael Johnston 3cfef150d1 Merge upstream main and retain PR 581 changelog entry 2026-10-08 00:43:14 -04:00
daikaginza 0c1b017699 Merge upstream/main, following its route renames
main renamed the three routes this branch governs:

  /api/opensky       -> /api/flights
  /api/opensky-track -> /api/flights/track
  /api/adsblol/trace -> /api/military/track

The merge took main's names in the route registrations cleanly, which left the
branch's own material pointing at routes that no longer exist — including
`openSkyTrackGovernor.test.mjs`, which looks its handlers up BY path, so it
failed with "handler is not a function" rather than with anything that named
the cause. Renamed in the test, in both doc comments and in the CHANGELOG and
CURRENT-STATE entries this branch adds. The historical CHANGELOG entry that
main also carries is left alone: it records what was true at that release.

Nothing else about the change moved. The limiter, its sizing, the cooldown
read and the serve-stale path are byte-identical to the branch tip; the only
other differences from it are the two append-only bookkeeping files.

  node --test src/openSkyTrackGovernor.test.mjs \
    src/tooling/liveProviders.test.mjs src/proxyErrorResponses.test.mjs
    tests 34  pass 34  fail 0
  npm run format:check            Checked 1210 source files.
  npm run check:boundaries        clean
  npm run layer-token:check       28 published, 0 new
2026-10-05 17:39:29 +07:00
Sameh Khamis 60644c5f5d feat: name live feed routes and sources for what they serve
The flight, military and vessel feeds were named after the providers the
bundled server uses (/api/opensky, /api/adsblol/mil, /api/ais-live and
their track routes; createOpenSkySource, createAdsbLolSource,
createAisStreamSource). Any server should be able to answer a feed from
its own provider, so the feeds are now:

  /api/flights   /api/flights/track?icao24=
  /api/military  /api/military/track?hex=
  /api/vessels   /api/vessels/track?mmsi=

with createFlightSource, createMilitarySource and createVesselSource. The
old routes are removed. Each server names its provider in X-Feed-Source
(the bundled server sends OpenSky Network, adsb.lol and AISStream, so its
attribution is unchanged) and the military feed's cache state and age in
X-Feed-Cache and X-Feed-Age-Ms. Sources report the provider the server
names and fall back to the feed's name.
2026-10-03 23:10:32 -07:00
Michael JohnstonandClaude Opus 5.5 44a2083d7b Merge current upstream and resolve PR 581 conflicts
b4067f9 moved the OpenSky states/all fetch into fetchOpenSkyStates, with a
10-second limit per attempt and one retry. Keep that and drop this branch's
20-second exchange deadline; the 8 MiB body cap now reads inside the helper
under each attempt's signal. The CHANGELOG bullet moves under [Unreleased],
and CURRENT-STATE describes the per-attempt OpenSky deadline.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-04 02:00:20 -04:00
Sameh Khamis b4067f9859 fix: time-limit OpenSky snapshot requests and retry once
A stalled global snapshot held the request for over a minute. Each attempt
now gets 10 seconds, a timed-out or failed attempt is retried once, and a
second failure is answered from the stale cache or the regional fallback.
The OAuth token request gets the same limit.
2026-10-01 14:26:20 -07:00
daikaginza 65018015a0 fix(server): stop track backfill from spending the OpenSky credit budget
`/api/opensky-track` costs 4 OpenSky credits per call against the same
~4000/day account as `/api/opensky`, but participated in none of that
proxy's credit governor. Its 60-second per-icao cache bounds memory, not
spend: `icao24` is six hex digits, so a caller that varies it produces a
fresh key and a fresh upstream call every time.

Both track-backfill routes now carry an always-on 30/min per-client
limiter (90 global) — the band `/api/geocode` and `/api/regional-brief`
already use, and far above the real demand, which is one backfill per
aircraft the operator selects.

`/api/opensky-track` additionally reads the 429 cooldown `/api/opensky`
already maintains. While the account is out of budget it serves any
cached track and otherwise answers 429 with the remaining cooldown,
instead of minting a token and spending four more credits. adsb.lol is
free and unmetered, so only the limiter applies there.
2026-09-27 23:01:01 +07:00
Michael JohnstonandClaude Opus 5 5f8a275487 fix(providers): bound the remaining upstream body reads
Route the six proxied fetches that still buffered upstream bodies without
a limit through the shared capped readers in src/sources/httpBody.js:
FIRMS CSV, CelesTrak TLE groups, adsb.lol /v2/mil (both the OK and
relayed-status paths), TomTom flow tiles, OpenSky states/all and adsbdb
enrichment lookups. Each cap is a bound sized well above the measured
payload, not a budget.

readResponseBytesCapped gains the same optional abort signal as the text
reader, with the same cancel-on-abort plumbing and reader release, so the
TomTom tile path can share the route deadline instead of reading
arrayBuffer() unbounded. Where a route already had a deadline, the same
signal now covers the body read as well as the headers. Two polls had no
deadline at all: the adsb.lol military poll gains a 12-second one and the
OpenSky states/all exchange, including its Basic-auth retry, a 20-second
one; both miss into their existing STALE paths.

FIRMS map-key status, the OpenSky token exchange and CCTV media are left
as they are.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-26 14:40:08 -04:00
Jejugo a0f07b752f fix: register data providers for local preview
Adapt the preview middleware contribution from PR #324 to the extracted provider modules, including the existing OpenSky route.
2026-09-12 12:43:54 -07:00
Sameh Khamis f9a85528fe style: format extracted live provider modules 2026-09-11 19:06:10 -07:00
Sameh Khamis 0e221441b4 refactor: separate aircraft and vessel server providers 2026-09-11 19:06:09 -07:00