fix(data): load bundled region packs in the browser; bound region lookups (#743)

The Natural Earth and neighborhood packs were loaded with a JSON-attributed
import(). The Vite dev server answers that request with a JavaScript module,
which the browser rejects, so every analyst region scope failed and fell
through to a geocode lookup that could take 12-28 s.

- src/data/bundledJson.js fetches the pack from a new URL(..., import.meta.url)
  asset in the browser; under Node the caller's attributed import runs.
- resolveRegionRingForQuery caps the geocode + admin-boundary rung at 3 s and
  returns { error: 'region-timeout' }; the lookup keeps running and fills the
  cache. The analyst query reports it as code 'region-timeout'. The Nepal
  locator opts out of the budget.
- Unit tests for the loader, the timeout and the analyst error; the behavior
  harness checks the Gulf of Mexico scope and retries Texas on region-timeout.

Co-authored-by: Bilawal Sidhu <[email protected]>
This commit is contained in:
Bilawal SidhuandBilawal Sidhu authored and GitHub committed 2026-09-24 01:52:41 -05:00
1 parent 513dc87a0e
commit ce671ce500
15 files changed
+263 -28

No files matched your search

+4
View File
@@ -1174,6 +1174,7 @@
"modules": [
"src/data/naturalEarthRegions.js",
"src/data/neighborhoodPolygons.js",
"src/data/bundledJson.js",
"src/data/retryableLoad.js",
"src/data/local_data/neighborhoods/san-francisco.json",
"src/data/local_data/natural_earth/regions.json",
@@ -1408,6 +1409,7 @@
"src/data/regionalBrief.js",
"src/data/regionalModel.js",
"src/data/renderAltitude.js",
"src/data/bundledJson.js",
"src/data/retryableLoad.js",
"src/data/rocketLaunches.js",
"src/data/routePlausible.js",
@@ -2059,6 +2061,7 @@
"src/data/pickRegistry.js",
"src/data/radioCountry.js",
"src/data/renderAltitude.js",
"src/data/bundledJson.js",
"src/data/retryableLoad.js",
"src/data/routePlausible.js",
"src/data/satelliteClass.js",
@@ -2436,6 +2439,7 @@
"src/data/local_data/neighborhoods/san-francisco.json",
"src/data/naturalEarthRegions.js",
"src/data/neighborhoodPolygons.js",
"src/data/bundledJson.js",
"src/data/retryableLoad.js",
"src/data/scenePick.js",
"src/keylessGeocoder.js",