From fa9af39e7b3a0b4be845a182062d1eea9ea5238a Mon Sep 17 00:00:00 2001 From: Pedro Lobato <69770518+Lob26@users.noreply.github.com> Date: Tue, 15 Sep 2026 11:21:07 -0500 Subject: [PATCH 01/30] fix(terrain): bound the client terrain-height cache with LRU eviction The in-memory cache in the terrain-height resolver had no eviction, so a session retained every coordinate it ever resolved for the lifetime of the page. The 5-decimal rounding documented in the file header makes repeated visits to one place share a key, but it does not bound how many distinct places a session visits. Cap it at 20 000 entries, overridable per instance so the bound is testable without minting twenty thousand coordinates. Eviction is least-recently-used rather than insertion-ordered because revisits here are spatial: the cell the camera is parked on must not be dropped for having been resolved early. The bound sits far above a city-scale session at the ~111 m floor grid, so normal use never evicts and issues no additional proxy requests. Batch results are assembled from what the call resolved, so eviction during a large batch cannot report a just-resolved point as unresolved. --- CHANGELOG.md | 2 + docs/CURRENT-STATE.md | 16 ++++ scripts/format-scope.json | 1 + src/services/terrainHeights.js | 96 ++++++++++++++++++-- src/services/terrainHeights.test.mjs | 130 +++++++++++++++++++++++++++ 5 files changed, 236 insertions(+), 9 deletions(-) create mode 100644 src/services/terrainHeights.test.mjs diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b3d01413..890bad535 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ - Preserve Nepal shot camera and map ownership through the public layer lifecycle; passive restoration does not start standalone playback. +- Bound the client terrain-height cache at 20 000 entries with least-recently-used eviction, so a long session no longer retains every coordinate it ever resolved. Consumer reads promote their entry and a batch still reports every point it resolved. + - Separate transit snapshot/history acquisition from the layer and expose its bounded request service independently of Vite. Preserve feed selection, playback, cache policy and compatibility exports. - Widen opaque sensor halos to 3 display pixels with a 30 px fleet core while retaining at least 60% opaque core coverage, adding contrast margin through thermal blur and bloom on bright roofs. diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 40e441b25..bf6467972 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -568,6 +568,22 @@ under `gods-eye-view/server/providers/`. Portable terrain mechanics, traffic til math and GBFS source rules are available under `gods-eye-view/sources/`. The browser layers and their rendering remain in their existing modules. +## Terrain height cache bound + +The client terrain-height resolver's in-memory cache is bounded at 20 000 +entries (`DEFAULT_MAX_CACHE_ENTRIES`, overridable per instance through +`createTerrainHeights({ maxCacheEntries })`). Coordinate rounding makes repeated +visits to one place share a key but does not bound how many distinct places a +session visits, and the cache previously had no eviction, so a long session +retained every coordinate it ever resolved. Eviction is least-recently-used: +a consumer read promotes its entry, so the cell being watched is not dropped for +having been resolved early. The bound sits far above a city-scale session, so +normal use never evicts and issues no additional proxy requests. A batch's +results are assembled from what that call resolved, so eviction during a large +batch cannot report a just-resolved point as unresolved. Re:Earth and +geoid-fallback entry semantics, the fallback cooldown and the abort-time flush +are unchanged. + ## Landmark annotation identity When a landmark geocode contains only address components, annotations retain diff --git a/scripts/format-scope.json b/scripts/format-scope.json index b86632108..145739fb1 100644 --- a/scripts/format-scope.json +++ b/scripts/format-scope.json @@ -609,6 +609,7 @@ "src/data/surfaceServices.js", "src/annotations/resolver.js", "src/services/terrainHeights.js", + "src/services/terrainHeights.test.mjs", "src/services/groundFloor.js", "src/services/meshFloorSampler.js", "src/services/groundSnap.js", diff --git a/src/services/terrainHeights.js b/src/services/terrainHeights.js index 4366d632a..747eda145 100644 --- a/src/services/terrainHeights.js +++ b/src/services/terrainHeights.js @@ -1,7 +1,19 @@ import { ensureGeoidReady, geoidHeight } from '../data/geoid.js'; -/** Construct an instance-owned terrainHeights service with explicit dependencies. */ -export function createTerrainHeights({ source, signal }) { +/** Default live-entry ceiling for the in-memory cache (see CACHE_MAX_ENTRIES). */ +export const DEFAULT_MAX_CACHE_ENTRIES = 20_000; + +/** + * Construct an instance-owned terrainHeights service with explicit dependencies. + * `maxCacheEntries` overrides the cache bound; it exists so the bound is + * testable without minting twenty thousand coordinates, mirroring the injectable + * `maxBytes` on the GBFS reader. + */ +export function createTerrainHeights({ + source, + signal, + maxCacheEntries = DEFAULT_MAX_CACHE_ENTRIES, +}) { if (typeof source?.getHeights !== 'function') throw new TypeError('Terrain heights require a source'); signal?.throwIfAborted(); @@ -45,15 +57,71 @@ export function createTerrainHeights({ source, signal }) { /** Avoid repeatedly hitting a known-failing proxy from warm fallback reads. */ const GEOID_FALLBACK_COOLDOWN_MS = 60_000; + /** + * Live entry ceiling for the cache below. The rounding in point 2 of the file + * header makes repeated visits to one place share a key; it does nothing to + * bound the number of DISTINCT places a session visits, and this cache had no + * eviction, so a long session kept every coordinate it ever resolved for the + * lifetime of the page. + * + * This is a bound, not a budget. At the ~111 m floor grid a city-scale + * session stays well under it, so eviction is the pathological case rather + * than the normal one and a well-behaved session sees no extra network. Sized + * above the sibling caches (adsb.lol points 80, track history 200, TomTom + * tiles 256) because a miss here costs a proxy round trip, not just RAM. + */ + const CACHE_MAX_ENTRIES = + Number.isFinite(maxCacheEntries) && maxCacheEntries > 0 + ? Math.floor(maxCacheEntries) + : DEFAULT_MAX_CACHE_ENTRIES; + /** * In-memory cache: `"lat.toFixed(5),lon.toFixed(5)"` -> `{ellipsoid, source}`. * Module-scoped (not exported) — the only reads are through * `cachedEllipsoidalGround` and the internal lookup in - * `resolveEllipsoidalGround`. + * `resolveEllipsoidalGround`. Bounded at CACHE_MAX_ENTRIES; write through + * `cacheStore` and read a consumer-facing hit through `cacheTouch` so the + * eviction order stays least-recently-used. * @type {Map} */ const cache = new Map(); + /** + * Store an entry and drop the coldest ones once past the cap. `Map` iterates + * in insertion order, so deleting the first key evicts the least recently + * used provided every write and every consumer read re-inserts its key. + * + * Recency rather than plain insertion order because revisits here are + * spatial: a session comes back to cells near where it already was, so the + * cell it is parked on must not be evicted merely for having been resolved + * early. + * @param {string} key + * @param {{ellipsoid: number, source: 'reearth'|'geoid-fallback', retryAt?: number}} entry + */ + function cacheStore(key, entry) { + cache.delete(key); + cache.set(key, entry); + while (cache.size > CACHE_MAX_ENTRIES) { + const coldest = cache.keys().next().value; + if (coldest === undefined) break; + cache.delete(coldest); + } + } + + /** + * Read an entry and promote it to newest, so a coordinate a consumer keeps + * asking about survives eviction. Returns undefined on a miss. + * @param {string} key + * @returns {{ellipsoid: number, source: 'reearth'|'geoid-fallback', retryAt?: number}|undefined} + */ + function cacheTouch(key) { + const entry = cache.get(key); + if (entry === undefined) return undefined; + cache.delete(key); + cache.set(key, entry); + return entry; + } + /** * Builds the rounded cache key shared between the in-memory cache and the * `points` string sent to the proxy (see file header, point 2). @@ -74,7 +142,7 @@ export function createTerrainHeights({ source, signal }) { * @returns {number|null} */ function cachedEllipsoidalGround(lat, lon) { - const entry = cache.get(cacheKey(lat, lon)); + const entry = cacheTouch(cacheKey(lat, lon)); return entry ? entry.ellipsoid : null; } @@ -91,7 +159,7 @@ export function createTerrainHeights({ source, signal }) { * @returns {number|null} */ function cachedRealEllipsoidalGround(lat, lon) { - const entry = cache.get(cacheKey(lat, lon)); + const entry = cacheTouch(cacheKey(lat, lon)); return entry && entry.source === 'reearth' ? entry.ellipsoid : null; } @@ -213,6 +281,12 @@ export function createTerrainHeights({ source, signal }) { uncached.push(item); } + // What this call resolved, so the assembly below can report a point even + // if a later chunk's writes pushed it past CACHE_MAX_ENTRIES. Without it a + // batch big enough to evict its own earlier chunks would report points as + // unresolved that it had in fact just resolved. + const resolvedThisCall = new Map(); + // Resolve the network path in sequential <=CHUNK_SIZE chunks. Each chunk's // failure is isolated to that chunk's points (geoid fallback), so a single // bad chunk doesn't lose results for the rest of a large batch. @@ -230,7 +304,9 @@ export function createTerrainHeights({ source, signal }) { // one contact frozen at the geoid while its neighbors resolved). // An omitted point now caches nothing and retries on the next warm. if (Number.isFinite(ellipsoid)) { - cache.set(item.key, { ellipsoid, source: 'reearth' }); + const entry = { ellipsoid, source: 'reearth' }; + resolvedThisCall.set(item.key, entry); + cacheStore(item.key, entry); } } } catch { @@ -247,11 +323,13 @@ export function createTerrainHeights({ source, signal }) { item.lon, item.sourceOrthometricM, ); - cache.set(item.key, { + const entry = { ellipsoid, source: 'geoid-fallback', retryAt: Date.now() + GEOID_FALLBACK_COOLDOWN_MS, - }); + }; + resolvedThisCall.set(item.key, entry); + cacheStore(item.key, entry); } } } @@ -260,7 +338,7 @@ export function createTerrainHeights({ source, signal }) { // the upstream omitted has NO entry (round 6 — deliberately uncached so it // retries later): report it unresolved instead of throwing. return work.map((item) => { - const entry = cache.get(item.key); + const entry = cache.get(item.key) || resolvedThisCall.get(item.key); return entry ? { ellipsoid: entry.ellipsoid, source: entry.source } : { ellipsoid: null, source: 'unresolved' }; diff --git a/src/services/terrainHeights.test.mjs b/src/services/terrainHeights.test.mjs new file mode 100644 index 000000000..c9884e89c --- /dev/null +++ b/src/services/terrainHeights.test.mjs @@ -0,0 +1,130 @@ +import { test } from 'node:test'; +import assert from 'node:assert/strict'; +import { + createTerrainHeights, + DEFAULT_MAX_CACHE_ENTRIES, +} from './terrainHeights.js'; + +/** + * A terrain source that always resolves, so these tests exercise the cache and + * never the geoid-fallback path. Heights are derived from the coordinate so an + * assertion can name the value it expects. + */ +function stubSource() { + const batches = []; + return { + batches, + async getHeights(chunk) { + batches.push(chunk.map((item) => item.key)); + return chunk.map((item) => ({ ellipsoid: heightAt(item.lon) })); + }, + }; +} + +/** Distinct 5-decimal coordinates along the equator: 0.001, 0.002, … */ +const lonAt = (i) => i / 1000; +const heightAt = (lon) => 1000 + Math.round(lon * 1000); +const pointAt = (i) => ({ lat: 0, lon: lonAt(i) }); + +test('the default cache bound is exported so callers can reason about it', () => { + assert.equal(DEFAULT_MAX_CACHE_ENTRIES, 20_000); +}); + +test('the in-memory cache stops growing once it reaches its entry bound', async () => { + const terrain = createTerrainHeights({ + source: stubSource(), + maxCacheEntries: 4, + }); + + // Six distinct coordinates through a cache that holds four. + for (let i = 0; i < 6; i += 1) { + await terrain.resolveEllipsoidalGround([pointAt(i)]); + } + + // The two coldest are gone. Before the bound existed the cache kept every + // coordinate a session ever resolved, so both of these still answered. + assert.equal(terrain.cachedEllipsoidalGround(0, lonAt(0)), null); + assert.equal(terrain.cachedEllipsoidalGround(0, lonAt(1)), null); + + // The four most recent are untouched — a bound, not a flush. + for (let i = 2; i < 6; i += 1) { + assert.equal( + terrain.cachedEllipsoidalGround(0, lonAt(i)), + heightAt(lonAt(i)), + `coordinate ${i} stayed warm`, + ); + } +}); + +test('a coordinate a consumer keeps reading outlives an equally old one it ignores', async () => { + const terrain = createTerrainHeights({ + source: stubSource(), + maxCacheEntries: 4, + }); + for (let i = 0; i < 4; i += 1) { + await terrain.resolveEllipsoidalGround([pointAt(i)]); + } + + // Read coordinate 0 and ignore coordinate 1. They are otherwise the same age, + // so insertion order alone could not tell them apart. + assert.equal( + terrain.cachedEllipsoidalGround(0, lonAt(0)), + heightAt(lonAt(0)), + ); + + // Two fresh coordinates push the cache two entries past its bound. + for (let i = 4; i < 6; i += 1) { + await terrain.resolveEllipsoidalGround([pointAt(i)]); + } + + assert.equal( + terrain.cachedEllipsoidalGround(0, lonAt(0)), + heightAt(lonAt(0)), + 'the cell being read survived eviction', + ); + assert.equal( + terrain.cachedEllipsoidalGround(0, lonAt(1)), + null, + 'the same-age cell nobody read was evicted instead', + ); +}); + +test('a batch larger than the cache bound still reports every point it resolved', async () => { + const terrain = createTerrainHeights({ + source: stubSource(), + maxCacheEntries: 4, + }); + const batch = Array.from({ length: 10 }, (_, i) => pointAt(i)); + + const results = await terrain.resolveEllipsoidalGround(batch); + + // Eviction inside the call must not turn a point this batch resolved into an + // unresolved one: the results are assembled from what the call produced, not + // from whatever survived in the cache by the time it finished. + assert.equal(results.length, batch.length); + results.forEach((result, i) => { + assert.equal(result.source, 'reearth', `point ${i} reported resolved`); + assert.equal(result.ellipsoid, heightAt(lonAt(i))); + }); + + // The cache still honours the bound afterwards. + const warm = batch.filter( + (point) => terrain.cachedEllipsoidalGround(point.lat, point.lon) !== null, + ); + assert.equal(warm.length, 4); +}); + +test('an out-of-range cache bound falls back to the default instead of disabling the cache', async () => { + for (const maxCacheEntries of [0, -1, Number.NaN, undefined]) { + const terrain = createTerrainHeights({ + source: stubSource(), + maxCacheEntries, + }); + await terrain.resolveEllipsoidalGround([pointAt(1)]); + assert.equal( + terrain.cachedEllipsoidalGround(0, lonAt(1)), + heightAt(lonAt(1)), + `maxCacheEntries=${String(maxCacheEntries)} kept a working cache`, + ); + } +}); From 5f27f6edf4cc7f3ce2b2b593e1890c700da1d40f Mon Sep 17 00:00:00 2001 From: bassem chagra Date: Thu, 17 Sep 2026 10:20:26 +0200 Subject: [PATCH 02/30] =?UTF-8?q?fix(cctv):=20surface=20heading=20confiden?= =?UTF-8?q?ce=20=E2=80=94=20estimated=20bearings=20are=20now=20visible?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every pack sets headingConfidence on each camera, but nothing consumed it: a bearing synthesized by fallbackHeadingFromId (a hash of the id string, no geographic input) rendered exactly like a surveyed one — 2,827 of 3,997 cameras in a default catalog. Fixes #639. Two consumers, plus a passthrough: - HUD: the heading token is tagged when the bearing is synthetic — `HDG 194° (ESTIMATED)` — so a hash never reads as a measured facing. - Wireframe: a low-confidence camera draws its coverage frustum with dashed polylines instead of solid ones. Colors, widths, and the active/idle emphasis are unchanged; the dash is the only signal. - Public camera state gains `headingConfidence` (the raw pack flag) and `headingEstimated` (the derived bit) so UI consumers never re-derive it. A human-vouched pose always wins over the pack flag: a manually saved calibration (calSource:'manual') or a curated catalog entry (poseSource:'curated') is never presented as estimated, mirroring the CAL badge states in calibration.js. - src/layers/cctv/headingConfidence.js: pure helpers (isHeadingEstimated, headingHudToken) - src/layers/cctv/headingConfidence.test.mjs: confidence normalization, calibration/curation overrides, HUD token formatting - src/layers/cctv/presentation.js: HUD token + public-state passthrough - src/layers/cctv/rendering.js: dashed materials for estimated bearings --- src/layers/cctv/headingConfidence.js | 47 +++++++++++++++++ src/layers/cctv/headingConfidence.test.mjs | 60 ++++++++++++++++++++++ src/layers/cctv/presentation.js | 10 +++- src/layers/cctv/rendering.js | 42 ++++++++++----- 4 files changed, 144 insertions(+), 15 deletions(-) create mode 100644 src/layers/cctv/headingConfidence.js create mode 100644 src/layers/cctv/headingConfidence.test.mjs diff --git a/src/layers/cctv/headingConfidence.js b/src/layers/cctv/headingConfidence.js new file mode 100644 index 000000000..a42297e28 --- /dev/null +++ b/src/layers/cctv/headingConfidence.js @@ -0,0 +1,47 @@ +/** + * @module headingConfidence + * + * Consumers for the catalog's per-camera `headingConfidence` flag (#639). + * + * Packs whose feed publishes no facing get a synthetic bearing from + * `fallbackHeadingFromId` — a hash of the id string, with no geographic + * input — and are marked `headingConfidence: 'low'`. Until now nothing read + * the flag, so a guessed bearing rendered exactly like a surveyed one. These + * helpers make the guess visible: the HUD heading token gains an + * `(ESTIMATED)` tag and the coverage wireframe draws dashed instead of solid. + * + * A human-vouched pose always wins over the pack flag: a manually saved + * calibration (`calSource:'manual'`) or a hand-authored catalog entry + * (`poseSource:'curated'`) is never presented as estimated, mirroring the + * CAL badge states in calibration.js. + */ + +/** + * Whether a camera's bearing is a synthetic guess that should present as + * provisional. + * @param {{headingConfidence?: string|null, calSource?: string|null, + * poseSource?: string|null}} camera - Catalog camera (or public state). + * @returns {boolean} + */ +export function isHeadingEstimated(camera) { + if (!camera) return false; + if (camera.calSource === 'manual') return false; + if (camera.poseSource === 'curated') return false; + return ( + String(camera.headingConfidence || '') + .trim() + .toLowerCase() === 'low' + ); +} + +/** + * HUD heading token: `HDG 194°`, tagged `(ESTIMATED)` when the bearing is + * synthetic — so a hash can never read as a surveyed facing. + * @param {{headingDeg?: number, headingConfidence?: string|null, + * calSource?: string|null, poseSource?: string|null}} camera + * @returns {string} + */ +export function headingHudToken(camera) { + const hdg = Math.round(Number(camera?.headingDeg) || 0); + return `HDG ${hdg}°${isHeadingEstimated(camera) ? ' (ESTIMATED)' : ''}`; +} diff --git a/src/layers/cctv/headingConfidence.test.mjs b/src/layers/cctv/headingConfidence.test.mjs new file mode 100644 index 000000000..513bf0d1b --- /dev/null +++ b/src/layers/cctv/headingConfidence.test.mjs @@ -0,0 +1,60 @@ +// src/layers/cctv/headingConfidence.test.mjs +// Bearing-provenance consumers (#639): a pack's headingConfidence:'low' +// (a hashed synthetic bearing) must present as estimated — unless a human +// vouched for the pose via manual calibration or a curated catalog entry. +import { test } from 'node:test'; +import assert from 'node:assert/strict'; +import { isHeadingEstimated, headingHudToken } from './headingConfidence.js'; + +test('low confidence marks the bearing estimated', () => { + assert.equal(isHeadingEstimated({ headingConfidence: 'low' }), true); +}); + +test('confidence matching is trimmed and case-insensitive', () => { + assert.equal(isHeadingEstimated({ headingConfidence: ' LOW ' }), true); + assert.equal(isHeadingEstimated({ headingConfidence: 'Low' }), true); +}); + +test('medium, high, missing, and absent cameras are not estimated', () => { + assert.equal(isHeadingEstimated({ headingConfidence: 'medium' }), false); + assert.equal(isHeadingEstimated({ headingConfidence: 'high' }), false); + assert.equal(isHeadingEstimated({}), false); + assert.equal(isHeadingEstimated(null), false); + assert.equal(isHeadingEstimated(undefined), false); +}); + +test('a manually saved calibration overrides a low pack flag', () => { + assert.equal( + isHeadingEstimated({ headingConfidence: 'low', calSource: 'manual' }), + false, + ); +}); + +test('a curated catalog entry overrides a low pack flag', () => { + assert.equal( + isHeadingEstimated({ headingConfidence: 'low', poseSource: 'curated' }), + false, + ); +}); + +test('HUD token tags a synthetic bearing and rounds the degrees', () => { + assert.equal( + headingHudToken({ headingDeg: 194.4, headingConfidence: 'low' }), + 'HDG 194° (ESTIMATED)', + ); +}); + +test('HUD token stays untagged for surveyed and calibrated bearings', () => { + assert.equal( + headingHudToken({ headingDeg: 67.5, headingConfidence: 'high' }), + 'HDG 68°', + ); + assert.equal( + headingHudToken({ + headingDeg: 225, + headingConfidence: 'low', + calSource: 'manual', + }), + 'HDG 225°', + ); +}); diff --git a/src/layers/cctv/presentation.js b/src/layers/cctv/presentation.js index 742869877..abda57d02 100644 --- a/src/layers/cctv/presentation.js +++ b/src/layers/cctv/presentation.js @@ -1,5 +1,6 @@ import { CCTV_AMBIENT_CARD_MAX } from '../../data/cctvLod.js'; import { ACTIVE_FRAME_REFRESH_MS, IDLE_FRAME_REFRESH_MS } from './policy.js'; +import { headingHudToken, isHeadingEstimated } from './headingConfidence.js'; export function createPresentation({ state: layerState, @@ -35,7 +36,9 @@ export function createPresentation({ return [ `${active.camera.city.toUpperCase()} CCTV`, `${active.camera.name.toUpperCase()}`, - `HDG ${Math.round(active.camera.headingDeg)}°`, + // A synthetic bearing (headingConfidence 'low', no human calibration) + // is tagged so a hashed guess never reads as a surveyed facing (#639). + headingHudToken(active.camera), `FOV ${Math.round(active.camera.fovDeg)}°`, `COVERAGE ${area.toFixed(2)}km²`, overlapCount > 0 ? `OVERLAP ${overlapCount} cams` : 'ISOLATED VIEW', @@ -76,6 +79,11 @@ export function createPresentation({ lat: camera.lat, lon: camera.lon, headingDeg: camera.headingDeg, + // Bearing provenance (#639): the pack's confidence flag plus the derived + // "is this a synthetic guess" bit (calibration-aware), so UI consumers + // never have to re-derive it. + headingConfidence: camera.headingConfidence || null, + headingEstimated: isHeadingEstimated(camera), pitchDeg: camera.pitchDeg, fovDeg: camera.fovDeg, rangeM: camera.rangeM, diff --git a/src/layers/cctv/rendering.js b/src/layers/cctv/rendering.js index 8c4dbb9be..ad8de36b4 100644 --- a/src/layers/cctv/rendering.js +++ b/src/layers/cctv/rendering.js @@ -1,5 +1,6 @@ import * as Cesium from 'cesium'; import { horizonOccluder } from '../../data/iconOrientation.js'; +import { isHeadingEstimated } from './headingConfidence.js'; import { ACTIVE_CAMERA_COLOR, IDLE_CAMERA_COLOR, @@ -228,6 +229,15 @@ export function createRendering({ ); const inVisibleSet = coverageVisible.has(record.camera.id); + // A synthetic bearing (headingConfidence 'low', no human calibration) + // draws its wireframe dashed so a guessed facing is visibly provisional + // rather than rendering identically to a surveyed one (#639). Colors, + // widths, and the active/idle emphasis are unchanged. + const bearingEstimated = isHeadingEstimated(record.camera); + const lineMaterial = (color) => + bearingEstimated + ? new Cesium.PolylineDashMaterialProperty({ color }) + : color; for (const entity of record.coverageEntities || []) { // The frustum wireframe is part of the projection representation — // force it on for the active camera and let it read through geometry @@ -242,13 +252,15 @@ export function createRendering({ // active camera keeps its width/alpha emphasis in both schemes. const hue = viewshedOn ? record.viewshedColors : null; if (entity._coverageRole === 'cap') { - entity.polyline.material = hue - ? isActive - ? hue.lineActive - : hue.line - : isActive - ? ACTIVE_COVERAGE_CENTER - : IDLE_COVERAGE_CENTER_MUTED; + entity.polyline.material = lineMaterial( + hue + ? isActive + ? hue.lineActive + : hue.line + : isActive + ? ACTIVE_COVERAGE_CENTER + : IDLE_COVERAGE_CENTER_MUTED, + ); entity.polyline.width = isActive ? 2.2 : 1.0; entity.polyline.depthFailMaterial = planeShowing ? hue @@ -256,13 +268,15 @@ export function createRendering({ : ACTIVE_COVERAGE_CENTER_DEPTHFAIL : undefined; } else { - entity.polyline.material = hue - ? isActive - ? hue.lineActive - : hue.line.withAlpha(0.6) - : isActive - ? ACTIVE_COVERAGE_EDGE - : IDLE_COVERAGE_EDGE_MUTED; + entity.polyline.material = lineMaterial( + hue + ? isActive + ? hue.lineActive + : hue.line.withAlpha(0.6) + : isActive + ? ACTIVE_COVERAGE_EDGE + : IDLE_COVERAGE_EDGE_MUTED, + ); entity.polyline.width = isActive ? 1.8 : 0.9; entity.polyline.depthFailMaterial = planeShowing ? hue From 899ca4f56e813ffed4820561bdadb04b0bc87e85 Mon Sep 17 00:00:00 2001 From: Ethan Stoner Date: Sun, 20 Sep 2026 19:56:37 -0700 Subject: [PATCH 03/30] fix: bound CCTV media bodies with an idle deadline The media relay only deadlined the wait for upstream response headers. Once headers arrived the timer stopped, so an upstream that answered and then sent nothing held both the client response and the upstream socket open for as long as the camera host allowed. The declared Content-Length ceiling was the only body bound, and a chunked or length-less body had none. A 30-second idle deadline now measures the gap between upstream chunks and tears the stream down through the existing release path. Because a paused pipe also stops upstream bytes arriving, the deadline reschedules itself whenever the response is still waiting to drain, so a viewer on a slow link is not read as a dead camera. Live feeds that keep delivering frames are unaffected. --- CHANGELOG.md | 10 +++ docs/CURRENT-STATE.md | 10 ++- server/providers/cctv/constants.js | 5 ++ server/providers/cctv/media.js | 46 +++++++++++- src/data/cctvMediaRange.test.mjs | 117 ++++++++++++++++++++++++++++- 5 files changed, 182 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 744f4be0a..92946d3a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,16 @@ while ordinary wheel, line-mode and touch-pinch inputs retain their existing behavior; the listener is removed with the application scene. +- Release CCTV media streams whose upstream falls silent after answering. The + 15-second media deadline covered only the wait for response headers, so a + camera that replied and then stopped sending held both the proxy connection + and its upstream socket open for as long as the camera host allowed; the + declared `Content-Length` ceiling was the only body bound, and a chunked or + length-less body had none. A 30-second idle deadline now bounds the gap + between upstream chunks and releases a body that has gone silent. It is + rescheduled while the response is still waiting to drain, so a viewer on a + slow link is not mistaken for a dead camera; live feeds are unaffected. + - Report AIS speed and course that carry the standard "not available" code as unknown instead of 102.3 knots and 360 degrees. Genuine readings, including a stopped vessel's zero and the highest encodable values, are unchanged. diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 9c381ac0c..b22d17339 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -587,10 +587,12 @@ their `configured: false` response. CCTV media waits at most 15 seconds for upstream response headers and returns 504 on timeout. Its timer stops when headers arrive, so live bodies can continue -streaming; body idle deadlines are separate from this header deadline. Error -responses are cancelled. Buffered snapshots have a 16 MiB streaming cap; an -oversized image remains an upstream miss and uses the normal fallback chain. -The existing declared media size ceiling remains 64 MiB. +streaming; a separate 30-second idle deadline then bounds the gap between +upstream chunks and releases a body that has gone silent. A response that is +still waiting to drain reschedules that deadline, so a slow client does not read +as a stalled upstream. Error responses are cancelled. Buffered snapshots have a +16 MiB streaming cap; an oversized image remains an upstream miss and uses the +normal fallback chain. The existing declared media size ceiling remains 64 MiB. ## GBFS upstream bounds diff --git a/server/providers/cctv/constants.js b/server/providers/cctv/constants.js index d66806e45..d6382ad76 100644 --- a/server/providers/cctv/constants.js +++ b/server/providers/cctv/constants.js @@ -253,5 +253,10 @@ export const CCTV_FRAME_MAX_BODY_BYTES = 16 * 1024 * 1024; /** Deadline for upstream response headers; live bodies keep streaming afterward. */ export const CCTV_MEDIA_FETCH_TIMEOUT_MS = 15 * 1000; +/** Silence a live body may carry before the relay gives up on it. Twice the + * header deadline, because a camera that is merely slow between frames is far + * more common than one that has died mid-stream, and a viewer would rather + * wait than be dropped. */ +export const CCTV_MEDIA_IDLE_TIMEOUT_MS = 30 * 1000; /** Declared size ceiling for fixed media responses. */ export const CCTV_MEDIA_MAX_BODY_BYTES = 64 * 1024 * 1024; diff --git a/server/providers/cctv/media.js b/server/providers/cctv/media.js index d652f7150..549e6cf06 100644 --- a/server/providers/cctv/media.js +++ b/server/providers/cctv/media.js @@ -4,6 +4,7 @@ import { CCTV_FRAME_FETCH_TIMEOUT_MS, CCTV_FRAME_MAX_BODY_BYTES, CCTV_MEDIA_FETCH_TIMEOUT_MS, + CCTV_MEDIA_IDLE_TIMEOUT_MS, CCTV_MEDIA_MAX_BODY_BYTES, NSW_IMAGE_ORIGIN, NSW_IMAGE_USER_AGENT, @@ -103,11 +104,17 @@ export function toReadable(body) { * @param {Response} upstream - fetch() Response object. * @param {object} [opts] * @param {string} [opts.sourceHeader='upstream'] - Value for X-CCTV-Source header. + * @param {number} [opts.idleTimeoutMs=CCTV_MEDIA_IDLE_TIMEOUT_MS] - Silence + * allowed between upstream chunks before the stream is released. Injectable + * only to keep the deadline unit-testable. */ export async function proxyMediaResponse( res, upstream, - { sourceHeader = 'upstream' } = {}, + { + sourceHeader = 'upstream', + idleTimeoutMs = CCTV_MEDIA_IDLE_TIMEOUT_MS, + } = {}, ) { const contentType = upstream.headers.get('content-type') || 'application/octet-stream'; @@ -153,7 +160,20 @@ export async function proxyMediaResponse( return; } + // The header deadline only covers the wait for a response line. Past that an + // upstream can hold the connection open and send nothing at all, and the + // relay would wait on it for as long as the camera host cared to. The + // deadline below measures the gap between upstream chunks rather than the + // life of the stream, so a feed that keeps delivering keeps its connection. + let idleTimer = null; + const clearIdleDeadline = () => { + if (!idleTimer) return; + clearTimeout(idleTimer); + idleTimer = null; + }; + stream.on('error', () => { + clearIdleDeadline(); if (!res.writableEnded) res.end(); }); @@ -164,6 +184,7 @@ export async function proxyMediaResponse( const releaseUpstream = () => { if (released) return; released = true; + clearIdleDeadline(); stream.unpipe(res); // Destroying the Node stream cancels the web body it wraps; the direct // cancel covers a body that was never wrapped, and rejects harmlessly when @@ -176,14 +197,37 @@ export async function proxyMediaResponse( /* already closed */ } }; + const armIdleDeadline = () => { + clearIdleDeadline(); + idleTimer = setTimeout(onIdleDeadline, idleTimeoutMs); + idleTimer.unref?.(); + }; + const onIdleDeadline = () => { + // A viewer who cannot keep up pauses the pipe, and no upstream bytes arrive + // while it is paused. That is a slow client rather than a dead camera, so + // it gets the deadline again instead of a teardown. + if (res.writableNeedDrain) { + armIdleDeadline(); + return; + } + releaseUpstream(); + if (!res.writableEnded) res.end(); + }; res.once('close', () => { + clearIdleDeadline(); if (!res.writableEnded) releaseUpstream(); }); res.once('error', releaseUpstream); stream.once('end', () => { + clearIdleDeadline(); released = true; }); + armIdleDeadline(); stream.pipe(res); + // Attached after the pipe because a data listener resumes the stream, and + // flowing before the destination is attached would spill chunks nobody + // forwards. Only bytes from upstream renew the deadline. + stream.on('data', armIdleDeadline); } /** diff --git a/src/data/cctvMediaRange.test.mjs b/src/data/cctvMediaRange.test.mjs index 3e71d3e17..9f279bdc7 100644 --- a/src/data/cctvMediaRange.test.mjs +++ b/src/data/cctvMediaRange.test.mjs @@ -8,8 +8,9 @@ import { test } from 'node:test'; import assert from 'node:assert/strict'; import http from 'node:http'; import net from 'node:net'; -import { Readable } from 'node:stream'; +import { Readable, Writable } from 'node:stream'; import { cctvProxy } from '../../server/providers/cctv.js'; +import { proxyMediaResponse } from '../../server/providers/cctv/media.js'; import { sanitizeCctvRangeHeader } from '../../server/providers/cctv/range.js'; import { CCTV_MEDIA_MAX_BODY_BYTES as CAP } from '../../server/providers/cctv/constants.js'; @@ -586,3 +587,117 @@ test('two sequential seeks are served as two partial responses', async (t) => { assert.equal(first.body, 'chunk-0'); assert.equal(second.body, 'chunk-100'); }); + +// --------------------------------------------------------------------------- +// The body idle deadline. proxyMediaResponse is driven directly here because +// the deadline is only injectable through its options; the route always passes +// the production value. +// --------------------------------------------------------------------------- + +/** + * A response to pipe into, built on a real Writable so the backpressure the + * proxy reads is the stream's own rather than a flag the test sets. With + * `drains: false` the bytes are accepted and never flushed, which is what a + * viewer on a slow link looks like from the server side. + */ +function pipeTarget({ drains = true } = {}) { + const res = new Writable({ + // One byte is enough to leave a target that never empties its buffer + // permanently in need of a drain. + highWaterMark: drains ? undefined : 1, + write(_chunk, _encoding, callback) { + if (drains) callback(); + }, + }); + res.writeHead = (status, headers) => { + res.statusCode = status; + res.headers = headers || {}; + }; + return res; +} + +/** + * An upstream that answers with headers, sends one chunk, and then either + * keeps producing every `everyMs` or goes silent. `released` reports the body's + * own cleanup: a cancelled fetch body lands in the web stream's cancel hook. + */ +function mediaUpstream({ everyMs = 0 } = {}) { + const state = { produced: 0, released: false }; + let ticker = null; + const body = new ReadableStream({ + start(controller) { + const send = () => { + state.produced += 1; + controller.enqueue(new Uint8Array([0xff, 0xd8, 0xff, 0xe0])); + }; + send(); + if (everyMs > 0) { + ticker = setInterval(send, everyMs); + ticker.unref(); + } + }, + cancel() { + state.released = true; + if (ticker) clearInterval(ticker); + }, + }); + state.upstream = { + ok: true, + status: 200, + headers: { + get: (name) => + String(name).toLowerCase() === 'content-type' ? 'video/mp4' : null, + }, + body, + arrayBuffer: async () => Buffer.alloc(0), + }; + return state; +} + +test('an upstream that goes silent after its headers is released at the idle deadline', async (t) => { + const feed = mediaUpstream(); + const res = pipeTarget(); + t.after(() => res.destroy()); + await proxyMediaResponse(res, feed.upstream, { idleTimeoutMs: 40 }); + + await new Promise((resolve) => setTimeout(resolve, 20)); + assert.equal(feed.released, false, 'released before the deadline was due'); + await new Promise((resolve) => setTimeout(resolve, 120)); + // Without the deadline this stream is held open against the camera host for + // as long as that host will keep the socket, with no bytes ever arriving. + assert.equal(feed.released, true, 'the silent upstream was never released'); + assert.equal(res.writableEnded, true, 'the client was left waiting'); +}); + +test('a live feed that keeps producing is not cut off by the idle deadline', async (t) => { + const feed = mediaUpstream({ everyMs: 10 }); + const res = pipeTarget(); + t.after(() => res.destroy()); + await proxyMediaResponse(res, feed.upstream, { idleTimeoutMs: 40 }); + + await new Promise((resolve) => setTimeout(resolve, 250)); + assert.equal(feed.released, false, 'a healthy feed was torn down'); + assert.equal(res.writableEnded, false, 'a healthy feed was ended early'); + assert.ok( + feed.produced > 5, + `the feed stopped producing (${feed.produced} chunks)`, + ); +}); + +test('a client that cannot keep up is not mistaken for a stalled upstream', async (t) => { + // Nothing arrives from upstream while the pipe is paused, which looks exactly + // like silence unless the response is asked whether it is still draining. + const feed = mediaUpstream({ everyMs: 10 }); + const res = pipeTarget({ drains: false }); + t.after(() => res.destroy()); + await proxyMediaResponse(res, feed.upstream, { idleTimeoutMs: 30 }); + + await new Promise((resolve) => setTimeout(resolve, 200)); + assert.equal( + res.writableNeedDrain, + true, + 'the client was not the bottleneck', + ); + assert.equal(feed.released, false, 'a slow viewer tore down a healthy feed'); + assert.equal(res.writableEnded, false, 'a slow viewer ended the response'); +}); From c24399e99d03d3d472490ac29f6b11db59e8d1f7 Mon Sep 17 00:00:00 2001 From: daikaginza Date: Sat, 19 Sep 2026 12:11:55 +0700 Subject: [PATCH 04/30] fix(traffic): say which upstream declined a road load MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Street Traffic draws on OpenStreetMap for geometry and TomTom for flow, and the row said "Road data temporarily unavailable" whichever one failed. The reporter of #661 went and verified a TomTom key while every public Overpass mirror was refusing their network with HTTP 406 — a status fetchRoads already had and dropped on the floor. Classify the refusal where the layer talks to Overpass: 429 is "Overpass rate-limited", 504 is "Overpass timed out", anything else is "Overpass refused the road query (HTTP )". The first two are the words alpr's Overpass source already uses; the status is what says which upstream declined, which a single-source layer never has to. The error carries its status as a RoadRequestError, following LiveSourceError in src/sources/live/contract.js, so a caller can branch on the code without parsing English. The catch promotes a classified refusal and keeps the general line for everything else — the branch is on the error type, not on its text, because a dropped socket throws whatever the platform felt like saying and "Failed to fetch" on a panel row helps nobody. Retries, backoff, caching and the mirror rotation are untouched. --- CHANGELOG.md | 7 ++++ docs/CURRENT-STATE.md | 1 + src/layers/traffic/ingestion.js | 15 +++++-- src/layers/traffic/navigation.test.mjs | 36 +++++++++++++++++ src/layers/traffic/source.js | 55 ++++++++++++++++++++++++++ src/layers/traffic/source.test.mjs | 39 +++++++++++++++++- 6 files changed, 149 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 744f4be0a..33174d45b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +- Report which upstream declined a Street Traffic road load. The layer row now + reads `Overpass rate-limited`, `Overpass timed out`, or + `Overpass refused the road query (HTTP 406)` instead of a general + "Road data temporarily unavailable", so a reader is not sent to check a + TomTom key when the public OpenStreetMap mirrors are the side that failed. + Failures the layer cannot classify keep the general line. + - Enable responsive trackpad pinch zoom on the globe. Browser pixel-mode `Ctrl+wheel` pinch gestures now reach Cesium with bounded amplification, while ordinary wheel, line-mode and touch-pinch inputs retain their existing diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 9c381ac0c..e63817fd8 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -3242,6 +3242,7 @@ silently demoting every later lookup for the session. - HTTP refusals such as 406 now rotate alongside the existing network, rate-limit, and runtime-error cases. A refusal from one mirror no longer prevents reaching healthy alternatives or persists under the seven-day road/month-long boundary cache TTLs. Concurrent identical queries share one mirror sequence; if it fails, both the initiating and joined callers can use the same last-good data. - A refusal every mirror agrees on is still reported with the first mirror's status and body, so a genuinely malformed query says what upstream said — but only after every mirror has had the chance to answer it. `fetchOverpassPayload` takes injectable endpoints and fetch so the rotation is tested without a live mirror (`src/overpassProxy.test.mjs`). - Every mirror is asked with a User-Agent that names the application, its version and the project address (`OVERPASS_USER_AGENT` in `server/providers/overpass/constants.js`), which is what the OSM API usage policy asks for. Mirrors may refuse a client they cannot identify; such a refusal is never treated as data and costs the fan-out that mirror, so the header is what keeps the list at full strength. +- When the fan-out has nothing left to offer, the traffic row says which upstream declined and how: `Overpass rate-limited`, `Overpass timed out`, or `Overpass refused the road query (HTTP 406)`. Street Traffic draws on two upstreams — OpenStreetMap for geometry, TomTom for flow — so a row that only said "road data unavailable" sent readers to check a TomTom key that was never the problem (#661). `roadRequestError` in `src/layers/traffic/source.js` owns the mapping and tags the error with its status. A refusal whose code is unreadable — the layer takes its source by injection, so an adapter may not supply one — reports `Overpass temporarily unavailable` rather than printing `HTTP undefined`, and anything the layer did not classify at all (a dropped connection, a malformed snapshot) still reads `Road data temporarily unavailable`, because a platform exception is not a sentence to put on a panel. ### Share-link v2 layer state (August 2026) diff --git a/src/layers/traffic/ingestion.js b/src/layers/traffic/ingestion.js index de5b56d9f..904ceca04 100644 --- a/src/layers/traffic/ingestion.js +++ b/src/layers/traffic/ingestion.js @@ -4,6 +4,7 @@ import { TILE_CACHE_MAX_ENTRIES, FAST_FETCH_ALTITUDE, } from './policy.js'; +import { RoadRequestError, roadRequestError } from './source.js'; export function createIngestion({ state: layerState, @@ -67,7 +68,7 @@ export function createIngestion({ ); if (!response.ok) { - throw new Error(`Overpass API returned ${response.status}`); + throw roadRequestError(response.status); } if (!state) { @@ -307,8 +308,16 @@ export function createIngestion({ renderedSomething = true; } catch (e) { if (e?.name === 'AbortError') return; - if (generation === layerState._loadGeneration && !renderedSomething) - layerState._roadError = 'Road data temporarily unavailable'; + if (generation === layerState._loadGeneration && !renderedSomething) { + // A refusal we classified carries its own line; anything else — a + // dropped connection, a malformed snapshot — keeps the general one, + // because `e.message` from the platform is not a sentence anyone + // should have to read off a panel. + layerState._roadError = + e instanceof RoadRequestError + ? e.message + : 'Road data temporarily unavailable'; + } console.warn('[Data:Traffic] Fetch error:', e); } finally { if (generation === layerState._loadGeneration) { diff --git a/src/layers/traffic/navigation.test.mjs b/src/layers/traffic/navigation.test.mjs index e7bd4cc62..c07ae6ad9 100644 --- a/src/layers/traffic/navigation.test.mjs +++ b/src/layers/traffic/navigation.test.mjs @@ -216,3 +216,39 @@ test('parked failures back off and disabling cancels the scheduled retry', async assert.equal(calls, 2); assert.equal(layer.getStats().error, null); }); + +test('a declined road request reaches the row as the reason, not as a shrug', async (t) => { + // Issue #661: with every public Overpass mirror refusing a network, the row + // read "Road data temporarily unavailable" while the console already held + // "Overpass API returned 406". The reporter went looking for a bad TomTom + // key — the other half of this layer, and never the problem. The status the + // code already has must survive the trip to the panel. + let status = 406; + const { layer, viewer, tick } = setup(t, async () => ({ ok: false, status })); + layer.enable(viewer); + await tick(400); + assert.equal( + layer.getStats().error, + 'Overpass refused the road query (HTTP 406)', + ); + + status = 429; + for (let i = 0; i < 20; i++) await tick(1500); + assert.equal( + layer.getStats().error, + 'Overpass rate-limited', + 'a rate limit is a different instruction to the reader than a refusal', + ); +}); + +test('an unclassified road failure keeps the general line', async (t) => { + // The complement of the test above, and the reason this is not just + // `e.message`: a dropped socket throws whatever the platform felt like + // saying, and "Failed to fetch" on a panel row helps nobody. + const { layer, viewer, tick } = setup(t, async () => { + throw new Error('socket hang up'); + }); + layer.enable(viewer); + await tick(400); + assert.equal(layer.getStats().error, 'Road data temporarily unavailable'); +}); diff --git a/src/layers/traffic/source.js b/src/layers/traffic/source.js index d499a4b7b..dbcbb67c1 100644 --- a/src/layers/traffic/source.js +++ b/src/layers/traffic/source.js @@ -15,6 +15,61 @@ function buildOverpassQuery( return `[out:json][timeout:${timeoutSec}];(way["highway"~"${regex}"](${south},${west},${north},${east}););out geom qt;`; } +/** + * A road request upstream declined, carrying a line fit to show an operator. + * + * The status travels beside the message instead of only inside it, so a caller + * can branch on the code without parsing English — the same shape + * `LiveSourceError` uses in `src/sources/live/contract.js`. + */ +export class RoadRequestError extends Error { + constructor(message, { status = null } = {}) { + super(message); + this.name = 'RoadRequestError'; + this.status = status; + } +} + +/** + * Name an Overpass refusal in the words the traffic row will print. + * + * This layer has two upstreams — OpenStreetMap for road geometry and TomTom + * for flow — and only one of them can be down at a time. A row that says + * nothing more than "road data unavailable" sends the reader to check their + * TomTom key, which is the wrong half of the layer and costs them the + * afternoon. So the status upstream actually returned is reported: 406 from a + * public mirror is not a configuration problem the reader can fix, and saying + * so is the difference between a dead end and a next step. + * + * The first two lines match `alpr`'s Overpass source word for word; this is + * the same vocabulary, not a new one. What the status adds is *which* upstream + * and *how* it declined — the part a single-source layer never needs to say. + * + * Only what the browser can see is claimed. The proxy rotates mirrors behind + * `/api/overpass`, so a refusal arriving here means the proxy had nothing + * better to offer; how many mirrors it tried is not something this side knows, + * and the message does not pretend otherwise. + * @param {number} status - HTTP status the proxy returned; a code that is + * not a finite number is treated as absent rather than printed. + * @returns {RoadRequestError} + */ +export function roadRequestError(status) { + const code = Number.isFinite(status) ? status : null; + const message = + code === 429 + ? 'Overpass rate-limited' + : code === 504 + ? 'Overpass timed out' + : // A source is injected, so a caller's adapter may hand back a + // refusal with no status on it. "HTTP undefined" on a panel row is + // worse than not naming a number, so an unreadable code falls back + // to what `alpr` says when it cannot be more specific either. + code === null + ? 'Overpass temporarily unavailable' + : `Overpass refused the road query (HTTP ${code})`; + return new RoadRequestError(message, { status: code }); +} + /** Supply road responses, flow availability and one decoded flow cache. */ export function createTrafficSource({ fetchImpl = (...args) => globalThis.fetch(...args), diff --git a/src/layers/traffic/source.test.mjs b/src/layers/traffic/source.test.mjs index 8047ddbbd..f7024d81c 100644 --- a/src/layers/traffic/source.test.mjs +++ b/src/layers/traffic/source.test.mjs @@ -1,7 +1,11 @@ import assert from 'node:assert/strict'; import test from 'node:test'; import { readFileSync } from 'node:fs'; -import { createTrafficSource } from './source.js'; +import { + RoadRequestError, + createTrafficSource, + roadRequestError, +} from './source.js'; import { clampBoundsAroundCenter } from '../../data/trafficBounds.js'; const bounds = { south: 30.267, west: -97.744, north: 30.268, east: -97.743 }; const fixture = readFileSync( @@ -188,3 +192,36 @@ test('road sources decode direction and coordinates before scene construction', ], }); }); + +test('an Overpass refusal is named by status, and keeps the status beside the words', () => { + // The panel prints this string verbatim, so the mapping is part of the + // layer's contract with the reader, not an implementation detail. + assert.equal(roadRequestError(429).message, 'Overpass rate-limited'); + assert.equal(roadRequestError(504).message, 'Overpass timed out'); + assert.equal( + roadRequestError(406).message, + 'Overpass refused the road query (HTTP 406)', + ); + assert.equal( + roadRequestError(500).message, + 'Overpass refused the road query (HTTP 500)', + ); + + // An injected source may refuse without a readable code; a row must never + // print "HTTP undefined" at a reader. + for (const missing of [undefined, null, NaN, 'four-oh-six']) { + const vague = roadRequestError(missing); + assert.equal(vague.message, 'Overpass temporarily unavailable'); + assert.equal(vague.status, null, 'an unreadable code is absent, not zero'); + } + + const refused = roadRequestError(406); + assert.ok(refused instanceof RoadRequestError); + assert.ok(refused instanceof Error); + assert.equal(refused.name, 'RoadRequestError'); + assert.equal( + refused.status, + 406, + 'a caller must be able to branch on the code without parsing English', + ); +}); From 2a47bdb8e74e34ae633e5502a88461063f069851 Mon Sep 17 00:00:00 2001 From: Arthur Bogaart <526197+abogaart@users.noreply.github.com> Date: Mon, 21 Sep 2026 17:28:23 +0200 Subject: [PATCH 05/30] fix: spawn Apple /bin/chmod by absolute path when hardening credentials The macOS credential hardener strips ACLs with `chmod -N`, spawning `chmod` by bare name. On machines where Nix home-manager or Homebrew coreutils sit ahead of /bin on PATH, that resolves to GNU chmod, which has no `-N` flag and exits non-zero. The hardener treated that as a failure and refused every save from the Provider Settings panel with "could not restrict the credential file to your account; nothing was saved". Spawn /bin/chmod by absolute path instead, matching how the Windows branch already resolves its native tools without consulting PATH, and add a regression test that pins the absolute path. --- server/standalone/key-setup-hardening.mjs | 6 +++++- src/keySetupHardening.test.mjs | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/server/standalone/key-setup-hardening.mjs b/server/standalone/key-setup-hardening.mjs index 002ccabdc..e2d11182c 100644 --- a/server/standalone/key-setup-hardening.mjs +++ b/server/standalone/key-setup-hardening.mjs @@ -123,7 +123,11 @@ export function hardenCredentialFile( if (platform !== 'win32') { try { if (platform === 'darwin') { - const aclRemoval = spawn('chmod', ['-N', filepath], { + // `-N` (strip the ACL) is Apple-only. Spawn /bin/chmod by absolute + // path, never by name: a Nix/Homebrew coreutils profile puts GNU chmod + // first on PATH, and GNU chmod rejects `-N` — which read as a + // hardening failure and refused every save on such machines. + const aclRemoval = spawn('/bin/chmod', ['-N', filepath], { stdio: 'ignore', }); if (!commandCompletedSuccessfully(aclRemoval)) return false; diff --git a/src/keySetupHardening.test.mjs b/src/keySetupHardening.test.mjs index 2578be37d..c519576e3 100644 --- a/src/keySetupHardening.test.mjs +++ b/src/keySetupHardening.test.mjs @@ -55,6 +55,21 @@ test('macOS ACL removal failure stops before chmod and fails closed', () => { assert.deepEqual(fileSystem.calls, [], 'mode bits must not disguise an ACL-removal failure'); }); +test('macOS ACL removal spawns Apple /bin/chmod by absolute path, not via PATH', () => { + const spawned = []; + hardenCredentialFile(FILE, { + platform: 'darwin', + fileSystem: fileSystemWithMode(0o100600), + spawn(command, args) { + spawned.push([command, args]); + return { status: 0, signal: null }; + }, + }); + // A coreutils-first PATH (Nix home-manager, Homebrew) resolves bare `chmod` + // to GNU chmod, which has no `-N` and would fail every save. + assert.deepEqual(spawned, [['/bin/chmod', ['-N', FILE]]]); +}); + test('POSIX hardening verifies the resulting 0600 mode', () => { const goodFs = fileSystemWithMode(0o100600); assert.equal(hardenCredentialFile(FILE, { From f01b6a5d8462c182e03c94493fa24098c1ac3771 Mon Sep 17 00:00:00 2001 From: Bilawal Sidhu <106619546+bilawalsidhu@users.noreply.github.com> Date: Mon, 21 Sep 2026 20:19:55 -0500 Subject: [PATCH 06/30] fix(ui): stop panel glows from adding scrollbars to the narrow-screen rails (#699) At 720px and below both panel stacks scroll vertically, so each panel's absolutely positioned glow (negative inset) became scrollable overflow on both axes and drew a horizontal scrollbar band plus a spurious vertical scrollbar whenever CCTV, Context, Data Layers or Scenes was expanded. Pin the glow to its panel box in the narrow-screen block and add a stylesheet test that checks every 720px media block. --- CHANGELOG.md | 11 +++++ docs/CURRENT-STATE.md | 1 + src/ui/panelRails.test.mjs | 91 ++++++++++++++++++++++++++++++++++++ src/ui/styles/responsive.css | 14 ++++++ 4 files changed, 117 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 744f4be0a..1099448ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +- Remove the spurious scrollbars that appeared on both panel stacks at narrow + widths (720px and below) as soon as a panel was expanded. The stacks scroll + vertically there, and each panel's decorative glow, absolutely positioned + with a negative inset, became 18–20px of scrollable overflow on both axes: a + horizontal scrollbar band under the expanded CCTV, Context, Data Layers or + Scenes panel plus a vertical scrollbar that scrolled nothing but glow. The + narrow-screen rules now pin the glow to its panel box; the stacks still + scroll for genuinely tall content such as an expanded DISPLAY panel, and the + Context radio popover is not clipped. `src/ui/panelRails.test.mjs` pins the + rule against every 720px media block. + - Enable responsive trackpad pinch zoom on the globe. Browser pixel-mode `Ctrl+wheel` pinch gestures now reach Cesium with bounded amplification, while ordinary wheel, line-mode and touch-pinch inputs retain their existing diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 9c381ac0c..095ec2fae 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -3599,6 +3599,7 @@ are omitted rather than framing the wrong part of the globe. - The desktop right rail (`#right-context-rail`) owns `DISPLAY`, `CCTV`, its active parameter controls, and `GLOBAL CONTEXT` as one fixed responsive stack in that order. Its compact buttons use the same 176 px width as the left accordion and one consistent 50 px height, share the left stack's 52 px edge inset and measured top baseline across HUD variants, then constrain themselves against visible HUD/chrome rectangles and the remaining vertical corridor. `DISPLAY` is no longer draggable and legacy saved coordinates are ignored. - The right rail is labeled **DISPLAY** (formerly "MOVE") and groups, in order, HUD, DETECT, Bloom, Sharpen, 3D, Clean-UI (HUD + DETECT promoted to the top). Its expanded controls retain the same compact 176 px width as the right-side tabs instead of growing to the wider Context detail-card width. It starts expanded on first run and respects the user's later `v6` collapse choice. Collapses/expands with directional chevrons (`◀` collapsed, `▶` expanded). - Display and Context use matching 330 px expanded widths and matching compact tab dimensions. The parameter panel is part of Display's expanded content. DISPLAY may remain open beside one contextual panel; CCTV and Context are mutually exclusive. In Tactical HUD, expanding CCTV or Context hides the other contextual launcher while DISPLAY remains independently available. The most recently opened right-rail panel owns the constrained lane even when it appears later in DOM order; passive restoration and automatic disclosure do not replace that explicit owner. Minimal and other HUD layouts retain the collapsed launchers; when their active panel exceeds the measured corridor, the rail reserves sibling heights and gaps and scrolls the active panel internally. +- At 720px and below both panel stacks (`#left-panel-stack`, `#right-context-rail`) go edge-to-edge and scroll vertically. Every hosted panel's decorative `.panel-glow` is pinned to its panel box there (`inset: 0` in `src/ui/styles/responsive.css`): on desktop the glow overhangs the panel by 18–20 px as harmless paint, but inside a scroll container that overhang is scrollable overflow on both axes and drew a horizontal scrollbar band plus a vertical scrollbar that scrolled nothing but glow whenever CCTV, Context, Data Layers or Scenes was expanded. The glow's blur is ink overflow and never scrolls, so the look is unchanged. Do not fix this by clipping the stacks: `overflow-x: clip` would also clip the Context radio popover and would not remove the vertical scrollbar. Pinned by `src/ui/panelRails.test.mjs` against every `(max-width: 720px)` block in the flattened stylesheet. - `STYLE PRESETS` and `LOCATIONS` start collapsed, expand on intentional hover/click, and auto-collapse after hover leave delay. - Collapsed mini-status indicators show active style and active location/landmark. - Detection mode is user-controlled and should persist when switching styles. Since 2026-08-22 it also STARTS on — Dense @ 75% for every style on a first run, Normal included — as a `GLOBAL_POST_DEFAULTS` baseline that does NOT set `_detectionUserOverridden`. Exception (unchanged): selecting a military style (CRT/NVG/FLIR) auto-enables the same Dense preset, but only until the user manually changes detection this session (`_detectionUserOverridden` gate), after which style switches never touch it. diff --git a/src/ui/panelRails.test.mjs b/src/ui/panelRails.test.mjs index 46fbebc5f..866c4f4e4 100644 --- a/src/ui/panelRails.test.mjs +++ b/src/ui/panelRails.test.mjs @@ -1,3 +1,4 @@ +import { readStylesheet } from '../testSupport/readStylesheet.mjs'; import assert from 'node:assert/strict'; import test from 'node:test'; import { @@ -269,3 +270,93 @@ test('natural height includes visible content, margins and wrapper chrome, exclu 100, ); }); + +// ── Narrow-screen rail overflow pin ────────────────────────────────────────── +// At ≤720px both panel stacks become scroll containers (overflow-y: auto), +// which also makes their overflow-x compute to auto. Each panel's decorative +// .panel-glow is absolutely positioned with a negative inset, so inside a +// scroll container that overhang is no longer harmless paint: it becomes +// 18–20px of scrollable overflow on both axes, drawing a horizontal scrollbar +// band under the expanded CCTV/Context/Data panel plus a vertical scrollbar +// that scrolls nothing but glow. The narrow block therefore pins every hosted +// glow to its panel box. + +/** Strip comments and return the bodies of every ≤720px media block. */ +function narrowScreenBlocks(css) { + const source = css.replace(/\/\*[\s\S]*?\*\//g, ''); + const blocks = []; + let from = 0; + for (;;) { + const start = source.indexOf('@media (max-width: 720px) {', from); + if (start === -1) break; + const open = source.indexOf('{', start); + let depth = 0; + let close = -1; + for (let index = open; index < source.length; index += 1) { + if (source[index] === '{') depth += 1; + if (source[index] === '}' && (depth -= 1) === 0) { + close = index; + break; + } + } + assert.notEqual(close, -1, 'unterminated narrow-screen media block'); + blocks.push(source.slice(open + 1, close)); + from = close + 1; + } + assert.ok(blocks.length, 'narrow-screen media block is missing'); + return blocks; +} + +/** Split a flat (non-nested) rule list into [selectors, declarations] pairs. */ +function flatRules(block) { + assert.doesNotMatch(block, /@media/, 'nested media queries are not modelled'); + return [...block.matchAll(/([^{}]+)\{([^{}]*)\}/g)].map( + ([, selectors, declarations]) => [ + selectors.split(',').map((part) => part.trim().replace(/\s+/g, ' ')), + declarations, + ], + ); +} + +test('narrow-screen rails pin every hosted panel glow inside its panel box', () => { + const css = readStylesheet(new URL('../../style.css', import.meta.url)); + for (const panel of [ + 'data-panel', + 'scene-panel', + 'cctv-panel', + 'global-context-panel', + ]) { + assert.match( + css, + new RegExp(`#${panel} \\.panel-glow \\{[^}]*\\binset: -\\d+px;`), + `${panel} glow no longer overhangs its panel; revisit this pin`, + ); + } + const narrow = narrowScreenBlocks(css).flatMap(flatRules); + const scrollingRails = [ + ...new Set( + narrow + .filter(([, declarations]) => + /\boverflow(?:-y)?:\s*(?:auto|scroll)\b/.test(declarations), + ) + .flatMap(([selectors]) => selectors) + .filter((selector) => + /^#(?:left-panel-stack|right-context-rail)$/.test(selector), + ), + ), + ].sort(); + assert.deepEqual(scrollingRails, [ + '#left-panel-stack', + '#right-context-rail', + ]); + for (const rail of scrollingRails) { + assert.ok( + narrow.some( + ([selectors, declarations]) => + selectors.includes(`${rail} .panel-glow`) && + /(?:^|;)\s*inset:\s*0\s*;/.test(declarations), + ), + `${rail} scrolls at ≤720px but does not pin its panel glows (inset: 0)`, + ); + } +}); diff --git a/src/ui/styles/responsive.css b/src/ui/styles/responsive.css index 7ebdaadae..7763d3641 100644 --- a/src/ui/styles/responsive.css +++ b/src/ui/styles/responsive.css @@ -197,6 +197,20 @@ overflow-y: auto; } + /* Both stacks are scroll containers at this width (overflow-y above), which + also makes their overflow-x compute to auto. Each panel's decorative + .panel-glow is absolutely positioned with a negative inset (-18px/-20px), + so inside a scroll container it stops being harmless paint and becomes + 18–20px of scrollable overflow on BOTH axes: a horizontal scrollbar band + under the expanded panel plus a vertical scrollbar that scrolls nothing + but glow. Pin the glow to the panel box here — its blur is ink overflow, + which never scrolls — instead of clipping the rail, which would also clip + legitimate content such as the Context radio popover. */ + #left-panel-stack .panel-glow, + #right-context-rail .panel-glow { + inset: 0; + } + #right-context-rail > #pp-toggles { width: 100%; } From 0251c74109bc24b98491667f648f4e583b761b32 Mon Sep 17 00:00:00 2001 From: Bilawal Sidhu <106619546+bilawalsidhu@users.noreply.github.com> Date: Tue, 22 Sep 2026 17:45:39 -0500 Subject: [PATCH 07/30] feat(weather): add globe wind, observed weather and cyclone context (#617) Wind (NOAA GFS and ECMWF IFS: animated particles, colour field, a reading at map centre), observed weather (NOAA MRMS radar, GOES and NESDIS infrared clouds, lightning density) on one shared history timeline, NHC and CPHC cyclone advisories with tracks and cones, and a WEATHER panel in the right rail. On 3D Tiles the observed products render as raised shells with a sharper window around the view. Co-authored-by: Gustavo Beneduzi Co-authored-by: Daniel Slay Co-authored-by: Rehaan Delmotra <208644523+rDelmotra@users.noreply.github.com> Co-authored-by: Cursor Agent --- CHANGELOG.md | 114 +- DATA_SOURCES.md | 127 ++ README.md | 24 +- SECURITY.md | 1 + TESTING.md | 12 + docs/CODE-BOUNDARIES.md | 84 + docs/CURRENT-STATE.md | 351 ++- docs/INFRASTRUCTURE-LAYERS.md | 3 +- package-lock.json | 26 + package.json | 4 +- scripts/format-scope.json | 50 +- scripts/package-boundaries.json | 101 +- scripts/qa-layer-panel.mjs | 26 +- scripts/qa-weather-journey.mjs | 423 ++++ scripts/qa-weather-perf.mjs | 568 +++++ scripts/qa-weather-swap.mjs | 203 ++ scripts/qa-weather-teardown.mjs | 341 +++ scripts/qa-wind-canvas.mjs | 44 + scripts/track-regression.mjs | 44 + server/providers/cctv.js | 124 +- server/providers/cctv/catalog.js | 6 + server/providers/cctv/constants.js | 8 + server/providers/cctv/sources.js | 107 + server/providers/cctv/stream.js | 348 +++ server/providers/cyclones.js | 416 ++++ server/providers/local.js | 6 + server/providers/openai/hud-summary.js | 13 +- server/providers/openai/instructions.js | 3 +- server/providers/openai/toolDescriptions.js | 9 +- server/providers/weather.js | 610 +++++ server/providers/wind.js | 227 ++ server/providers/wind/catalog.js | 34 + server/providers/wind/decode.js | 51 + server/providers/wind/gfs.js | 221 ++ server/providers/wind/grid.js | 172 ++ server/providers/wind/ifs.js | 166 ++ src/app/constructCatalog.js | 33 +- src/app/constructCatalog.test.mjs | 18 +- src/app/data.js | 4 +- src/app/layerPresentation.js | 3 + src/app/sources.js | 2 + src/creditAttribution.test.mjs | 26 +- src/data/aisLiveVessels.test.mjs | 25 + src/data/analystEngine.js | 45 +- src/data/analystEngine.test.mjs | 79 + src/data/cctvHlsStream.test.mjs | 225 ++ src/data/cyclonesProxy.test.mjs | 454 ++++ src/data/dataCredits.js | 32 + src/data/issPass.js | 99 +- src/data/issPass.test.mjs | 8 + src/data/layerSnapshot.js | 253 +++ src/data/layerSnapshot.test.mjs | 260 +++ src/data/layerState.js | 85 +- src/data/layerState.test.mjs | 62 +- src/data/localGeojson.analyst.test.mjs | 222 ++ src/data/localGeojsonCore.js | 108 +- src/data/manager.test.mjs | 141 ++ src/data/satellitePass.js | 458 ++++ src/data/satellitePass.test.mjs | 282 +++ src/data/satellites.analyst.test.mjs | 154 ++ src/data/satellites.js | 3 + src/data/vesselLabels.js | 5 +- src/data/vesselLabels.test.mjs | 1 + src/data/weatherProxy.test.mjs | 1161 ++++++++++ src/data/wind.js | 17 + src/data/windDecode.test.mjs | 9 + src/data/windGfs.test.mjs | 211 ++ src/data/windGrid.test.mjs | 150 ++ src/data/windIfs.test.mjs | 130 ++ src/data/windProxy.test.mjs | 657 ++++++ src/firstRunExperience.test.mjs | 6 +- src/hud.js | 28 +- src/hudSummaryResponse.js | 74 + src/hudSummaryResponse.test.mjs | 49 + src/layers/cctv/index.js | 1 + src/layers/cctv/presentation.js | 3 + src/layers/cctv/projection.js | 91 +- src/layers/cctv/rendering.js | 7 +- src/layers/cctv/videoPlayback.js | 111 + src/layers/cctv/videoPlayback.test.mjs | 93 + src/layers/cyclones/index.js | 447 ++++ src/layers/cyclones/index.test.mjs | 673 ++++++ src/layers/cyclones/labels.js | 180 ++ src/layers/cyclones/labels.test.mjs | 200 ++ src/layers/cyclones/rendering.js | 314 +++ src/layers/cyclones/rendering.test.mjs | 669 ++++++ src/layers/cyclones/source.js | 245 ++ src/layers/cyclones/source.test.mjs | 232 ++ src/layers/satellites/index.js | 5 + src/layers/satellites/orbits.js | 90 +- src/layers/satellites/records.js | 112 + src/layers/satellites/source.test.mjs | 108 + src/layers/vessels/selection.js | 15 +- src/layers/weather/clock.js | 218 ++ src/layers/weather/clock.test.mjs | 277 +++ src/layers/weather/imageryHost.js | 15 + src/layers/weather/imageryHost.test.mjs | 39 + src/layers/weather/imageryOrder.js | 17 + src/layers/weather/imageryOrder.test.mjs | 72 + src/layers/weather/index.js | 727 ++++++ src/layers/weather/infraredAlpha.js | 23 + src/layers/weather/infraredAlpha.test.mjs | 48 + src/layers/weather/infraredImage.js | 109 + src/layers/weather/infraredImage.test.mjs | 164 ++ src/layers/weather/rasterTiles.js | 50 + src/layers/weather/rasterTiles.test.mjs | 156 ++ src/layers/weather/rendering.js | 667 ++++++ src/layers/weather/shellFixture.mjs | 154 ++ src/layers/weather/shellRendering.js | 867 ++++++++ src/layers/weather/shellRendering.test.mjs | 1465 ++++++++++++ src/layers/weather/source.js | 136 ++ src/layers/weather/source.test.mjs | 164 ++ src/layers/weather/weather.test.mjs | 2220 +++++++++++++++++++ src/layers/wind/fields.js | 171 ++ src/layers/wind/fields.test.mjs | 114 + src/layers/wind/gpuRendering.js | 277 +++ src/layers/wind/gpuRendering.test.mjs | 399 ++++ src/layers/wind/index.js | 452 ++++ src/layers/wind/index.test.mjs | 414 ++++ src/layers/wind/inspection.js | 167 ++ src/layers/wind/inspection.test.mjs | 112 + src/layers/wind/model.js | 89 + src/layers/wind/model.test.mjs | 34 + src/layers/wind/presentation.js | 55 + src/layers/wind/presentation.test.mjs | 22 + src/layers/wind/relief.js | 113 + src/layers/wind/relief.test.mjs | 101 + src/layers/wind/rendering.js | 801 +++++++ src/layers/wind/rendering.test.mjs | 1195 ++++++++++ src/layers/wind/source.js | 105 + src/layers/wind/source.test.mjs | 245 ++ src/layers/wind/streamlines.js | 137 ++ src/layers/wind/streamlines.test.mjs | 122 + src/maps/controller.js | 9 + src/maps/controller.test.mjs | 23 + src/maps/google3d.js | 11 +- src/maps/sourceFactories.test.mjs | 29 + src/overlays/worldOverlay.js | 1 + src/panelStackLayout.test.mjs | 4 +- src/radioMarkup.test.mjs | 17 +- src/sources/windBody.js | 40 + src/standalone/layerSources.js | 6 + src/ui/applicationShell.js | 7 + src/ui/cctvControls.js | 15 + src/ui/cctvPresentation.js | 25 +- src/ui/cctvVideo.js | 59 + src/ui/cctvVideo.test.mjs | 40 + src/ui/chipGroup.js | 42 + src/ui/chipGroup.test.mjs | 33 + src/ui/layerBindings.js | 25 + src/ui/layerPanel.js | 305 +-- src/ui/layerPanel.test.mjs | 85 + src/ui/panelChrome.js | 3 + src/ui/panelLayoutController.js | 18 +- src/ui/panelPositionControls.js | 8 + src/ui/panelRails.test.mjs | 217 ++ src/ui/railCardBlocks.js | 295 +++ src/ui/railCards.js | 128 ++ src/ui/railCards.test.mjs | 259 +++ src/ui/railTestFixture.mjs | 116 + src/ui/railTimeline.js | 200 ++ src/ui/railTimeline.test.mjs | 118 + src/ui/rightPanelRail.js | 106 +- src/ui/rowList.js | 74 + src/ui/shellElements.js | 1 + src/ui/shellLifecycle.test.mjs | 99 + src/ui/shellLifetime.test.mjs | 20 + src/ui/styles/cctv.css | 16 + src/ui/styles/layers.css | 66 +- src/ui/styles/radio.css | 9 + src/ui/styles/weather.css | 385 ++++ src/ui/templates/context.html | 12 + src/ui/templates/layer-panels.html | 1 + src/ui/weatherPanel.js | 296 +++ src/ui/weatherPanel.test.mjs | 656 ++++++ src/voice/actionSchemas.js | 18 + src/voice/actionSchemas.test.mjs | 20 +- src/voice/gevActions.js | 117 +- src/voice/gevActions.test.mjs | 88 + style.css | 2 + 180 files changed, 30645 insertions(+), 434 deletions(-) create mode 100644 scripts/qa-weather-journey.mjs create mode 100644 scripts/qa-weather-perf.mjs create mode 100644 scripts/qa-weather-swap.mjs create mode 100644 scripts/qa-weather-teardown.mjs create mode 100644 scripts/qa-wind-canvas.mjs create mode 100644 server/providers/cctv/stream.js create mode 100644 server/providers/cyclones.js create mode 100644 server/providers/weather.js create mode 100644 server/providers/wind.js create mode 100644 server/providers/wind/catalog.js create mode 100644 server/providers/wind/decode.js create mode 100644 server/providers/wind/gfs.js create mode 100644 server/providers/wind/grid.js create mode 100644 server/providers/wind/ifs.js create mode 100644 src/data/cctvHlsStream.test.mjs create mode 100644 src/data/cyclonesProxy.test.mjs create mode 100644 src/data/layerSnapshot.js create mode 100644 src/data/layerSnapshot.test.mjs create mode 100644 src/data/localGeojson.analyst.test.mjs create mode 100644 src/data/satellitePass.js create mode 100644 src/data/satellitePass.test.mjs create mode 100644 src/data/satellites.analyst.test.mjs create mode 100644 src/data/weatherProxy.test.mjs create mode 100644 src/data/wind.js create mode 100644 src/data/windDecode.test.mjs create mode 100644 src/data/windGfs.test.mjs create mode 100644 src/data/windGrid.test.mjs create mode 100644 src/data/windIfs.test.mjs create mode 100644 src/data/windProxy.test.mjs create mode 100644 src/layers/cctv/videoPlayback.js create mode 100644 src/layers/cctv/videoPlayback.test.mjs create mode 100644 src/layers/cyclones/index.js create mode 100644 src/layers/cyclones/index.test.mjs create mode 100644 src/layers/cyclones/labels.js create mode 100644 src/layers/cyclones/labels.test.mjs create mode 100644 src/layers/cyclones/rendering.js create mode 100644 src/layers/cyclones/rendering.test.mjs create mode 100644 src/layers/cyclones/source.js create mode 100644 src/layers/cyclones/source.test.mjs create mode 100644 src/layers/satellites/records.js create mode 100644 src/layers/weather/clock.js create mode 100644 src/layers/weather/clock.test.mjs create mode 100644 src/layers/weather/imageryHost.js create mode 100644 src/layers/weather/imageryHost.test.mjs create mode 100644 src/layers/weather/imageryOrder.js create mode 100644 src/layers/weather/imageryOrder.test.mjs create mode 100644 src/layers/weather/index.js create mode 100644 src/layers/weather/infraredAlpha.js create mode 100644 src/layers/weather/infraredAlpha.test.mjs create mode 100644 src/layers/weather/infraredImage.js create mode 100644 src/layers/weather/infraredImage.test.mjs create mode 100644 src/layers/weather/rasterTiles.js create mode 100644 src/layers/weather/rasterTiles.test.mjs create mode 100644 src/layers/weather/rendering.js create mode 100644 src/layers/weather/shellFixture.mjs create mode 100644 src/layers/weather/shellRendering.js create mode 100644 src/layers/weather/shellRendering.test.mjs create mode 100644 src/layers/weather/source.js create mode 100644 src/layers/weather/source.test.mjs create mode 100644 src/layers/weather/weather.test.mjs create mode 100644 src/layers/wind/fields.js create mode 100644 src/layers/wind/fields.test.mjs create mode 100644 src/layers/wind/gpuRendering.js create mode 100644 src/layers/wind/gpuRendering.test.mjs create mode 100644 src/layers/wind/index.js create mode 100644 src/layers/wind/index.test.mjs create mode 100644 src/layers/wind/inspection.js create mode 100644 src/layers/wind/inspection.test.mjs create mode 100644 src/layers/wind/model.js create mode 100644 src/layers/wind/model.test.mjs create mode 100644 src/layers/wind/presentation.js create mode 100644 src/layers/wind/presentation.test.mjs create mode 100644 src/layers/wind/relief.js create mode 100644 src/layers/wind/relief.test.mjs create mode 100644 src/layers/wind/rendering.js create mode 100644 src/layers/wind/rendering.test.mjs create mode 100644 src/layers/wind/source.js create mode 100644 src/layers/wind/source.test.mjs create mode 100644 src/layers/wind/streamlines.js create mode 100644 src/layers/wind/streamlines.test.mjs create mode 100644 src/sources/windBody.js create mode 100644 src/ui/cctvVideo.js create mode 100644 src/ui/cctvVideo.test.mjs create mode 100644 src/ui/chipGroup.js create mode 100644 src/ui/chipGroup.test.mjs create mode 100644 src/ui/railCardBlocks.js create mode 100644 src/ui/railCards.js create mode 100644 src/ui/railCards.test.mjs create mode 100644 src/ui/railTestFixture.mjs create mode 100644 src/ui/railTimeline.js create mode 100644 src/ui/railTimeline.test.mjs create mode 100644 src/ui/rowList.js create mode 100644 src/ui/styles/weather.css create mode 100644 src/ui/weatherPanel.js create mode 100644 src/ui/weatherPanel.test.mjs diff --git a/CHANGELOG.md b/CHANGELOG.md index 1099448ff..c4016296b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,93 @@ # Changelog +## Unreleased — weather review + +- On 3D Tiles, draw a 4096×2048 detail window around the view on each + observed-weather shell except global infrared, sampled by the shell's own + surface. It follows the view on camera move end, keeps its place while the + view stays near its centre, and hides until its image is ready after a move; + an older frame's detail stays over at most one newer frame. The image proxy + accepts a 2:1 `bbox` inside the product bounds, rounded to 0.25°. + Lightning's whole-extent image is now 4096×2048; each shell caches up to + 128 MiB of decoded images. + +- On 3D Tiles, show observed weather and the wind color field as raised, + translucent shells (5.0–6.6 km, lightning highest) with one full-extent image + per frame instead of draping onto tiles; they show at any camera height. + Globe hosts are unchanged. The weather image proxy serves every product + (radar and regional infrared up to 4096×2048, lightning and global infrared + up to 2048×1024) with a size parameter and a 16 MiB cap. Accept bounded tile + sizes in the proxy with separate immutable cache entries. + +- Cache exact-time weather images and tiles for 24 hours. Retain up to 6 decoded + global mosaics per renderer and warm the next observation during playback; + tile prefetch is bounded to eight requests and cancels when suspended. + +- Move weather times, coverage, legends and cyclone advisory details into keyed + right-rail cards; left rows keep status and configuration. Use one native + observed-history timeline with local preview and coalesced drag commits. +- Add reusable rail card and timeline components. Keep panel collapse, count, + hidden-empty behavior and first-appearance expansion. +- Show wind unit controls beside speed legends and inside inspection readings; + changing units preserves the sampled location and open reading. +- Name satellite imagery Satellite clouds, with Clouds only / Full image modes + and explicit regional coverage. Existing share parameters are unchanged. + +- Share one observed history clock across radar, infrared and lightning. Step + through their union timeline with bounded nearest-at-or-before selection; + hide products without an eligible frame. Latest uses each product's newest + observation; playback waits for all frame loads to settle before advancing. +- Label wind as a forecast that does not follow observed history. Keep history + transient and product readouts synchronized. + +- Keep Google 3D Tiles drawing while draped weather imagery loads and retain the + old observation until the replacement has rendered. +- Decode one bounded global infrared mosaic per frame on both map hosts, then + crop local tiles to avoid request-dependent brightness seams. +- Add Clouds only / Full image controls and share-link state. Filtered mode uses + a soft linear-brightness alpha ramp from 0.40 to 0.70 around the old 0.55 cut. + +- Dock the weather summary in the right rail with standard panel collapse and drag chrome. + +- Filter infrared brightness so cold cloud tops stand out; this is a display + filter, not a cloud mask. +- Retry throttled weather tiles up to three times per tile. + +- Cull regional wind batches per frame, fade curves below 60 km, and stop idle + rendering when no curve is visible. +- Fade the wind color field below ~1,200 km camera height and hide it at 200 km. + On 3D Tiles, update alpha in 0.1 steps only at camera move end or installation; + globe imagery keeps its smooth per-frame fade. + +- Hide cyclone markers, labels, tracks and cones beyond the horizon on every map source. +- Reserve stable weather status space and coalesce panel refreshes per frame. + +- Add keyless NOAA/NHC cyclone advisory positions, coherent forecast tracks and + uncertainty cones, plus NOAA's observed 15-minute lightning density imagery. + Preserve source clocks, basin coverage and explicit pending/stale states. +- Make wind default to trails, preserve earlier share-link appearance, retain + geometry across scalar changes, and show a compact weather summary with a + location marker and selected-field emphasis for forecast inspection. + +- Add keyless NOAA observed rain radar and infrared satellite layers to Weather, + with explicit coverage/freshness, recent observation playback and native Cesium tiles. +- Increase desktop wind density to 7,200 paths and improve temperature contrast + while retaining the 1,200-path narrow-screen budget and unchanged forecast values. + +- Expand Wind into a surface-weather prototype: globe-draped speed shading, + optional same-run 2 m temperature and mean sea-level pressure, GFS/ECMWF model + selection, a numeric legend, wind units, Pause, and a dismissible map-center + reading. Keep wind visible when an optional field is unavailable; respect + reduced motion and stop animation while hidden or disabled. Bake bounded + forecast-following curves once per field and animate their phase on the GPU, + with a canvas fallback and globe view lighting owned only while Wind is enabled. + Display lift does not + change the 10 m forecast level; this adds no cloud volume, radar or forecast-time + playback. Native hardware GPU behavior remains unverified. + +Add feed provenance to analyst/view answers and HUD context while retaining existing response fields and runner ownership (Matt Van Horn, #347). + +Analyst records for loaded satellites, datacenters and dams, with explicit bounded count/rank coverage (Matt Van Horn, #351). - Remove the spurious scrollbars that appeared on both panel stacks at narrow widths (720px and below) as soon as a panel was expanded. The stacks scroll vertically there, and each panel's decorative glow, absolutely positioned @@ -63,17 +151,14 @@ with shared playback/seek interpolation, easing and holds. Navigation and manual input cancel authored motion; older scene files retain existing flights. - - Director validates bounded version-3 scene files before replacing a project, preserves unreadable browser saves, migrates legacy bloom once and preserves zero-pitch/low-altitude camera and scope/detection edits. Project normalization has a separate owner. - - Separate Director timing, seek calculations, playback clocks and registered scene-pack presentation rules. Preserve authored content and controls; Stop releases pending hold timers and stale ticks cannot affect replacement playback. - - Keep parked transit vehicles aligned to their world course during camera orbits, fall back to reported bearing, and keep vehicles with no course consistently screen-up. - Separate Realtime connection, response/tool, Radio, input/audio, cost, viewport @@ -167,6 +252,13 @@ - Split application scene, controls, catalog, tools and HTML into reusable components; configure application request services and sources without changing global fetch. Preserve standalone markup and voice behavior. Explicit annotation navigation may resolve a distant named target. +## Satellite pass prediction + +- Bisect pass rise/set to ~0.2 s and fit peak elevation with a parabola. +- Mark passes visible from Earth-shadow and civil-twilight checks. +- Add `getNextSatellitePass(noradId, options)` for any loaded catalog satellite. +- `next_iss_pass` retains the next geometric pass and adds visibility metadata. `next_satellite_pass` adds bounded loaded-catalog name/NORAD lookup and optional visible-only filtering (Rehaan Delmotra, #451; maintainer adaptation). + ## Voice component boundaries - Separate voice controls, Realtime connection requests and the action runner. @@ -258,8 +350,9 @@ of current runtime behavior, see [`docs/CURRENT-STATE.md`](docs/CURRENT-STATE.md ## [Unreleased] -- Add bounded Director feature actions with accessible controls, explicit camera/layer admission and cancellation; restore pack geometry on same-shot seek. Preserve existing scenes and content attribution. +- Add ECMWF IFS model selection to Wind (#464, thanks @beneduzi), with model-scoped forecast-step caches, cancellation of replaced requests, and separate issue/valid timestamps. +- Add bounded Director feature actions with accessible controls, explicit camera/layer admission and cancellation; restore pack geometry on same-shot seek. Preserve existing scenes and content attribution. - Give application request services, terrain/floor caches and annotation lookup state explicit owners and cancellation; share them across controls, layers and voice. @@ -388,6 +481,12 @@ of current runtime behavior, see [`docs/CURRENT-STATE.md`](docs/CURRENT-STATE.md Visible animation, detection membership, history storage and proxy requests are bounded. Share links carry Transit as token `j`. +- Add a keyless **Wind** layer from NOAA GFS 10 m wind (#459, thanks @beneduzi). The `/api/wind` proxy + byte-range fetches only the UGRD/VGRD GRIB2 messages from the public AWS bucket, + decodes them with ecCodes (WASM), and serves a compact Float32 U/V grid; the + client renders nullschool-style animated particles in a canvas overlay that + follows the Cesium camera and skips globe-occluded points. Forecast, not + observations. Requires Node ≥24 for the WASM decoder. - Add Ontario 511 as a keyless CCTV source pack, including Kitchener-area highway cameras, with server-registered still URLs and attribution. - CCTV Mesh adds Finland: Fintraffic road weather cameras, keyless, nationwide, 300 by default. Each camera view of a station is placed separately; ambient stills refresh on the source's 10-minute cadence (the active camera keeps the usual 10-second refresh). @@ -1050,3 +1149,10 @@ represent previously published GitHub Releases. ## [0.1.0] — 2026-02-09 - Initial project version. + +### Live CCTV integration candidate + +- Live HLS video shares one decoder between the camera panel and projection, + with a DelDOT HTTPS source pack. Credit: Daniel Slay (@Danielslay86), PR #489. +- Maintainer adjustments bound sessions and downloads, remove disk/subprocess + remuxing, reject redirects, and clean up playback on switching or disabling. diff --git a/DATA_SOURCES.md b/DATA_SOURCES.md index 7c822558a..d6796a70e 100644 --- a/DATA_SOURCES.md +++ b/DATA_SOURCES.md @@ -15,6 +15,7 @@ How to read this: | Source | Used for | License / terms | Attribution | | --------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | +| **NOAA GFS (wind)** | Global 10 m wind, optional 2 m temperature and mean sea-level pressure for Wind | U.S. public domain (NOAA); keyless via NOAA Open Data on AWS | "NOAA Global Forecast System (GFS)" (courtesy; not an endorsement) | | **OpenStreetMap ALPR camera locations** (including DeFlock community mapping) | Optional mapped automatic license-plate-reader camera layer | [ODbL 1.0](https://opendatacommons.org/licenses/odbl/1-0/); commercial use permitted with applicable attribution and database share-alike obligations | [© OpenStreetMap contributors](https://www.openstreetmap.org/copyright); [DeFlock](https://deflock.org) community mapping | | **Google Map Tiles API** (Photorealistic 3D Tiles) + Places/Geocoding | The 3D globe, voice scene context, and on-demand nearby installation search | Google Maps Platform ToS (proprietary, your own key + billing) | "Google" / "Google Maps" logo — **shown in-app**, required | | **OpenSky Network** | Primary worldwide live-flight snapshot | Non-commercial research/education license | Schäfer et al., _"Bringing Up OpenSky"_, IPSN 2014 + opensky-network.org | @@ -41,6 +42,7 @@ How to read this: | **Stadt Warendorf webcam** | Webcam frames, Marktplatz / Historisches Rathaus (`config/cctv_sources.warendorf.json`) | Public municipal webcam data | "Stadt Warendorf — webcam.warendorf.de" (courtesy); mount and heading derived from OSM geometry, "© OpenStreetMap contributors" (ODbL) | | **Live Traffic NSW (Transport for NSW)** | CCTV camera catalog + frames, New South Wales | [CC BY 4.0](https://opendata.transport.nsw.gov.au/) — attribution REQUIRED | "Live Traffic NSW — Transport for NSW" | | **Caltrans (cwwp2.dot.ca.gov)** | CCTV camera catalogs + frames, California districts | Public Caltrans traffic camera data | "Caltrans — cwwp2.dot.ca.gov" (courtesy) | +| **DelDOT (video.deldot.gov)** | CCTV camera catalog + live HTTPS HLS video, Delaware | Public DelDOT traffic camera streams via the [DelDOT traffic map](https://deldot.gov/map/) |"DelDOT — Delaware Department of Transportation" (courtesy) | | **TfL Open Data (JamCams)** | CCTV camera catalog + frames, London | [TfL Open Data terms](https://tfl.gov.uk/info-for/open-data-users/) — attribution REQUIRED | "Powered by TfL Open Data. Contains OS data © Crown copyright and database rights" | | **Ontario 511** | CCTV camera catalog + frames, Ontario highways including Kitchener-area routes | [Open Government Licence – Ontario](https://www.ontario.ca/page/open-government-licence-ontario) | "Ontario 511" plus Open Government Licence - Ontario | | **Fintraffic / Digitraffic (weathercams)** | CCTV camera catalog + frames, Finland | [CC BY 4.0](https://www.digitraffic.fi/en/terms-of-service/) — attribution REQUIRED | "Fintraffic / digitraffic.fi, license CC BY 4.0" | @@ -67,6 +69,7 @@ How to read this: - **Launch Library 2.** `/api/launches` makes a server-side rolling-30-day query against the supported v2.3 detailed launch endpoint, caches successful responses for 15 minutes in memory and on disk, and serves the last successful response during a throttle or transient outage. Anonymous access is limited to 15 calls/hour; deployments can provide `LL2_API_TOKEN` for authenticated access. The Space Devs' published terms permit using and sharing the API data in any form, ask users not to forward it without adding value, disclaim complete accuracy, and encourage—but do not require—attribution. This app keeps a courtesy credit. Payload and stage/recovery records are shown only when supplied. Failed launches expose their source status and never receive fallback orbit geometry or a live/estimated marker. LL2 supplies launch context and event timing, not continuous ascent telemetry or live orbital state. - **TfL JamCams.** The camera list comes from the keyless `api.tfl.gov.uk` endpoint (an optional `TFL_APP_KEY` raises its rate limit); frames come from TfL's public S3 bucket. The "Powered by TfL Open Data" attribution is required by TfL's terms and is registered in the Data attribution popover. - **Ontario 511 CCTV.** The camera list comes from the keyless `511on.ca/api/v2/get/cameras` endpoint; frames are server-registered still images under `511on.ca/map/Cctv/`. The source is live-fetched at runtime and attributed under the Open Government Licence - Ontario. +- **DelDOT live video cameras.** The keyless `tmc.deldot.gov/json/videocamera.json` catalog supplies active cameras and official `https://video.deldot.gov/live/…/playlist.m3u8` links. The local server transiently buffers bounded MPEG-TS segments in memory and deletes them on session release or idle expiry. No recordings are retained. `CCTV_DELDOT_ENABLED=0` disables the pack. Public availability is not a blanket redistribution license; deployment beyond personal local viewing needs confirmation of applicable DelDOT terms. - **Fintraffic weathercams.** The camera list is one keyless GeoJSON request to `tie.digitraffic.fi/api/weathercam/v1/stations` (809 stations / 2,275 presets), sent with the `Digitraffic-User: gods-eye-view` header the service asks clients to identify themselves with and with gzip; frames are stills on `weathercam.digitraffic.fi`, refreshed on each station's 600 s collection interval, which is also the client's ambient-still refresh cadence for this pack (the active camera keeps the usual 10-second refresh). One preset (a fixed camera view) is one camera; stations not `GATHERING` and presets not `inCollection` are dropped. Attribution is required by the CC BY 4.0 licence and is registered in the Data attribution popover. `CCTV_FINTRAFFIC_ENABLED=0` is the kill switch. - **DriveBC highway cameras.** The camera list comes from the keyless `https://www.drivebc.ca/api/webcams/` endpoint served by the DriveBC.ca site ([bcgov/DriveBC.ca](https://github.com/bcgov/DriveBC.ca)); frames come from `https://www.drivebc.ca/images/.jpg`, built from the numeric camera id. DataBC's [DriveBC HighwayCams](https://catalogue.data.gov.bc.ca/dataset/bc-highwaycams) catalogue entry publishes the same cameras under the Open Government Licence – British Columbia, but its CSV still lists the retired `images.drivebc.ca` frame URLs, which now return a placeholder. The licence's attribution statement is required and is registered in the Data attribution popover. By default the 250 cameras nearest Vancouver and Victoria load; `CCTV_DRIVEBC_MAX_SOURCES` changes the cap and `CCTV_DRIVEBC_ENABLED=0` turns the pack off. Some cameras in the feed are supplied by partners (TransLink, the City of Vancouver, the City of Surrey, Parks Canada / Alberta Motor Association and others); the feed's per-camera credit is carried onto the camera record and shown beside the provider in the CCTV panel. - **TxDOT ITS cameras.** The catalog comes from the keyless `its.txdot.gov/its/DistrictIts/GetCctvStatusListByDistrict` endpoint, one call per district. Frames come from the per-camera `GetCctvSnapshotByIcdId` endpoint, which answers JSON carrying a base64 JPEG rather than an image body; the proxy decodes it only for responses from the official TxDOT origin and validates the JPEG header before serving. Only cameras reporting `Device Online` are registered. Districts default to Austin and San Antonio (`CCTV_TXDOT_DISTRICTS`; 25 codes exist statewide); `CCTV_TXDOT_MAX_SOURCES` caps the pack and `CCTV_TXDOT_ENABLED=0` turns it off. Frames are fetched live at request time and are never stored or redistributed. @@ -153,6 +156,42 @@ transaction quota. Requires a free `FIRMS_MAP_KEY` (https://firms.modaps.eosdis.nasa.gov/api/map_key/); the layer is empty without it. The former bundled 2026-05-25 snapshot was removed 2026-07-16. +### ECMWF IFS wind + +Wind also offers ECMWF IFS 10 m forecasts from the keyless [ECMWF Open Data](https://www.ecmwf.int/en/forecasts/datasets/open-data) service. The proxy reads its JSON Lines inventory and byte-range fetches 10u/10v GRIB messages, optionally adding 2t (2 m temperature) or msl (mean sea-level pressure) from the same run and forecast time. It resamples these fields to the approximately 1° display grid. Data is licensed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). The [ECMWF Terms of Use](https://apps.ecmwf.int/datasets/licences/general/) also apply. In-app attribution identifies this service as based on ECMWF data and products, links the CC BY 4.0 licence, identifies resampling and animation as modifications, and retains the required ECMWF liability disclaimer. Both model issue time and the selected forecast valid time appear in the layer row. These are model forecasts, not observations. + +### NOAA GFS wind + +The optional **Wind** layer animates the global 10 m wind field from NOAA's +Global Forecast System (GFS). The `/api/wind` server-side proxy selects the +latest available 0.25° cycle, reads its `.idx` inventory, byte-range fetches only +the `UGRD`/`VGRD` 10 m GRIB2 messages, optionally adding `TMP` at 2 m or +`PRMSL` at mean sea level from the same run and forecast time. It decodes the +selected messages with ecCodes (WASM), resamples to a compact grid (1° by +default), and serves a manifest plus Float32 U/V and optional scalar values. It is keyless, cached +per cycle for an hour, and is a **forecast, not an observation**: the particles +show model flow, not measured wind. The renderer bakes bounded curves through +the sampled field and animates their phase on the GPU, with a canvas fallback. +Any display lift is a visual aid and does not change the forecast's 10 m level. +NOAA GFS data is U.S. public domain; the credit above is a courtesy and does not +imply endorsement. + +For both models, optional temperature is normalized from K to °C and pressure +from Pa to hPa before delivery. A missing, malformed or timed-out companion field +does not discard valid wind: the manifest marks that field unavailable, and the +UI retains wind without inventing scalar values. The proxy caches by model and +requested field, with bounded current/previous grids and shared in-flight loads. +Wind speed shading is computed locally from U/V and needs no companion download. +The legend and map-center reading explain units and forecast validity; the +animation is a visual flow through one forecast, not advancing forecast time. +Optional globe relief uses existing terrain vertex normals for view lighting; +without those normals it shades global globe curvature only, not local terrain +relief. Neither mode represents measured sunlight or a new elevation source. +This Wind prototype adds no cloud-volume or radar data. Mapped.earth's public +bundles were studied for rendering ideas, but +no code or assets were reused and no application licence granting reuse was +found. Its presentation is not a weather-data source for this implementation. + ### Natural Earth physical regions (`natural_earth/`) Curated from the **Natural Earth 10m physical vectors** (https://www.naturalearthdata.com/ — @@ -193,4 +232,92 @@ Douglas-Peucker simplification, 6-decimal rounding). ## In-app attribution +The required Google Maps / Cesium credit renders on the on-globe credit line (`#cesium-credits`, bottom-left) and must stay visible — including in clean-view and recording modes (the whole line, logo + "Google Maps" + the "Data attribution" link, stays on screen; only the GEV panels/HUD fade). The layer-specific credits (adsb.lol, TeleGeography, OSM datacenters/dams/roads, NASA FIRMS, CelesTrak, USGS, City of Austin, Fintraffic, GBFS, Radio Browser, OpenSky, AISStream) are registered into the expandable **"Data attribution"** popover on that credit line via `viewer.creditDisplay.addStaticCredit(new Cesium.Credit(html, /* showOnScreen */ false))` — see `src/data/dataCredits.js`. When you add a new data source, add its license and attribution to this file **and** append an entry to `DATA_CREDITS` in `src/data/dataCredits.js` so it surfaces in the app. + +### Observed weather: NOAA nowCOAST + +The Weather section provides keyless, observed **MRMS radar reflectivity** for the +contiguous United States and **infrared satellite imagery**. Fixed upstream WMS +services: `https://nowcoast.noaa.gov/geoserver/observations/weather_radar/ows` and +`https://nowcoast.noaa.gov/geoserver/observations/satellite/ows`. + +- `conus_base_reflectivity_mosaic`: approximately 1 km, usually 4-minute updates. + dBZ measures radar reflectivity, not rainfall rate, probability or future rain. + Coverage gaps do not mean no precipitation. The numeric legend follows NOAA's + `weather_radar_base_reflectivity` style. +- `goes_longwave_imagery`: GOES-19/18 Band 14, approximately 2 km, 5-minute updates, + regional North America. Filtered infrared softly dims pixels with a linear + brightness ramp from 0.40 to 0.70; Full infrared retains source alpha. This + is a display filter, not a cloud mask or measured cloud volume. +- `global_longwave_imagery_mosaic`: approximately 3 km, hourly, nominal 60°S–60°N + coverage and typically 2–3-hour latency. It is slower global context. + +The UI displays the exact advertised observation time separately from acquisition; +latest means the newest available observation, not zero-delay real time. Up to 13 +recent advertised frames can be replayed as history. No nowcast is synthesized. +Tiles use WMS 1.1.1 EPSG:4326 longitude/latitude bounds; Cesium's geographic 2×1 +root grid is capped at level 6 for radar and regional GOES. Global infrared uses +one fixed 2048×1024 geographic image on both hosts: the source's request-dependent +contrast otherwise creates brightness seams between tiles. The browser decodes +and filters it once, then crops 256 px tiles bounded to the manifest extent at +maximum level 3. This broad context view has a coarser display resolution than +its 3 km source. No browser reprojection is used. Browser imagery owns a displayed +frame and a staging frame, retaining the outgoing layer for one render after +admission; the proxy has an 8-request +concurrency budget, 12-second deadline, 1 MiB tile / 4 MiB global PNG caps and a shared 16 MiB/128-image cache. +Metadata refreshes every two minutes with explicitly stale last-good fallback. +No key, new dependency, image reprojection job, or full-disk image download is needed. + +Credit: NOAA nowCOAST, NWS/OAR MRMS, NESDIS GOES and global satellite partners. +[NOAA disclaimer](https://oceanservice.noaa.gov/disclaimer.html). +Community context: [#85](https://github.com/bilawalsidhu/gods-eye-view/issues/85), +[#588 radar](https://github.com/bilawalsidhu/gods-eye-view/pull/588), and +[#457 clouds](https://github.com/bilawalsidhu/gods-eye-view/pull/457). +This implementation is original; those contributions have not been merged here. + + +### Weather: NHC/CPHC cyclone advisories + +- **Sources:** [NHC current tropical cyclone status](https://www.nhc.noaa.gov/CurrentStorms.json) and + [NOAA tropical weather summary GIS](https://mapservices.weather.noaa.gov/tropical/rest/services/tropical/NHC_tropical_weather_summary/MapServer). +- **Rights/credit:** NOAA/NWS National Hurricane Center / Central Pacific Hurricane Center; + [NWS public-data terms](https://www.weather.gov/disclaimer). Fetch official products at runtime; + no bundled advisory archive and no NOAA endorsement implied. +- **Coverage/meaning:** Atlantic and eastern/central North Pacific, not global cyclone coverage. + Status position time and advisory issue time remain separate. Forecast track, points and cone + require matching advisory numbers across all GIS parts. Cone means uncertainty in the + forecast center track, not storm size or a complete hazard boundary. +- **Delivery:** keyless same-origin `/api/cyclones`, five-minute singleflight cache, + fixed upstream endpoints, bounded bodies/geometry/deadline, explicit unavailable/stale states. + Direct status fetching is unsuitable in browsers because NHC does not advertise CORS. + +### Weather: observed lightning density + +- **Source:** [NOAA nowCOAST lightning detection WMS](https://nowcoast.noaa.gov/geoserver/observations/lightning_detection/ows), + fixed `ldn_lightning_strike_density` layer and `lightning_density` style. +- **Rights/credit:** NOAA/NWS nowCOAST; derived from Vaisala NLDN/GLD360. + [Official product description and public distribution terms](https://ocean.weather.gov/lightning/lightning_pdd.php) + permit distribution of this NOAA Level-5 derived product, not raw Vaisala detections. +- **Meaning:** 15-minute accumulated density on an approximately 8 km grid; + source color scale is strikes per km² per minute ×10³. Not individual GLM optical flashes, + a live ground-strike counter, an all-clear indication, or global coverage. +- **Coverage:** 110°E across the Pacific/Americas to 0°, 25°S–80°N. Display exact advertised + observations; ten-minute metadata refresh, source-matched colors, bounded shared imagery cache. + +### Community weather prior art + +The weather design builds on Gustavo Beneduzi's retained GFS/ECMWF contribution +commits ([#459](https://github.com/bilawalsidhu/gods-eye-view/pull/459), +[#464](https://github.com/bilawalsidhu/gods-eye-view/pull/464)). Related community +proposals informed the observed-weather experience: Sandiv D's on-demand radar +and imagery controls ([#588](https://github.com/bilawalsidhu/gods-eye-view/pull/588)); +Gustavo Beneduzi's GOES and GLM source work +([#457](https://github.com/bilawalsidhu/gods-eye-view/pull/457), +[#458](https://github.com/bilawalsidhu/gods-eye-view/pull/458)); and HadiMuhammed's +NOAA hazard provenance and freshness work +([#414](https://github.com/bilawalsidhu/gods-eye-view/pull/414)). +The fixed nowCOAST imagery and NHC advisory implementations are original maintainer +work; this acknowledgement does not represent merging those four PRs or equate +NOAA density imagery with the raw GLM product. + The required Google Maps / Cesium credit renders on the on-globe credit line (`#cesium-credits`, bottom-left) and must stay visible — including in clean-view and recording modes (the whole line, logo + "Google Maps" + the "Data attribution" link, stays on screen; only the GEV panels/HUD fade). The layer-specific credits (adsb.lol, adsbdb, TeleGeography, OSM datacenters/dams/roads, NASA FIRMS, CelesTrak, USGS, City of Austin, Fintraffic, GBFS, Radio Browser, OpenSky, AISStream) are registered into the expandable **"Data attribution"** popover on that credit line via `viewer.creditDisplay.addStaticCredit(new Cesium.Credit(html, /* showOnScreen */ false))` — see `src/data/dataCredits.js`. When you add a new data source, add its license and attribution to this file **and** append an entry to `DATA_CREDITS` in `src/data/dataCredits.js` so it surfaces in the app. diff --git a/README.md b/README.md index 580bb147c..0c5cdfbec 100644 --- a/README.md +++ b/README.md @@ -188,7 +188,7 @@ Choose a first-run mission, or try these in order. The GIFs show Google Photorea ![Moving from a full airport overhead down to close taxiway inspection with 3D flight models](docs/media/start-here/airport-ground-traffic-google-3d.gif) -4. **Look through a public camera.** Turn on **CCTV** over Austin, London, California, or Finland. The feeds aren't webcam embeds — they project _into_ the 3D city. Cycle coverage to **VIEWSHED** and every camera draws its estimated coverage volume — where it reaches, and where it goes blind. +4. **Look through a public camera.** Turn on **CCTV** over Austin, London, California, Finland, or Delaware (live video). The feeds aren't webcam embeds — they project _into_ the 3D city. Cycle coverage to **VIEWSHED** and every camera draws its estimated coverage volume — where it reaches, and where it goes blind. ![Diving into an Austin intersection with a live public camera projected into the 3D scene](docs/media/03-austin-cctv.gif) @@ -282,7 +282,7 @@ Fifteen layers and map sources. **Thirteen have a keyless path.** Some offer add | 🛰️ **Satellites** | 838-object catalog, color-coded by class with a live legend — the **DENSE** chip drops in the whole Starlink shell | CelesTrak | 🟢 | | 🌍 **Earthquakes** | Global seismic activity, last 24h | USGS | 🟢 | | 🚗 **Traffic** | Simulated vehicles on OSM roads. With TomTom, live flow speeds drive the simulation and congestion colors below ~8 km; individual vehicle positions are not live observations | TomTom + OSM | 🟢 simulation · 🟡 live flow speeds | -| 📹 **CCTV Mesh** | ~3,600 public cameras projected _into_ the 3D space — Austin · Texas (TxDOT) · California (Caltrans) · London (TfL) · Ontario (511) · Finland (Fintraffic) · British Columbia (DriveBC) · Estonia (Tallinn, Tarktee) · New South Wales (Live Traffic NSW) · Calgary. Positions are published; poses are estimated priors **you calibrate by dragging a gizmo on the camera itself** | City APIs | 🟢 | +| 📹 **CCTV Mesh** | ~3,600 public cameras projected _into_ the 3D space — Austin · Texas (TxDOT) · California (Caltrans) · London (TfL) · Ontario (511) · Finland (Fintraffic) · British Columbia (DriveBC) · Estonia (Tallinn, Tarktee) · Delaware (DelDOT live video) · New South Wales (Live Traffic NSW) · Calgary. Positions are published; poses are estimated priors **you calibrate by dragging a gizmo on the camera itself** | City APIs | 🟢 | | 📻 **Radio** | Geolocated world radio with an **analog tuner** — drag the needle across up to 750 stations and the globe flies to each broadcaster | Radio Browser / broadcasters | 🟢 | | 🚌 **Transit** | Live buses, trams, metros, trains and ferries with delayed playback between reports, selected-vehicle trails, and mode-coloured DETECT labels — Boston, Austin, Minneapolis, Helsinki, the Netherlands, Norway, South East Queensland | Operator GTFS-Realtime feeds | 🟢 | | 🚲 **Bikeshare** | Live station availability | GBFS | 🟢 | @@ -441,6 +441,26 @@ OpenSky can run fully anonymous (`OPENSKY_AUTH_MODE=anon`), or import OAuth cred +
+Live video cameras (HLS) + +CCTV sources with `"feedType": "hls"` and a registered HTTP(S) `.m3u8` +URL play through a lazily loaded hls.js decoder shared by the monitor plane +and panel. DelDOT uses its official HTTPS HLS catalog links. Disable that +pack with `CCTV_DELDOT_ENABLED=0`. + +The server allows two concurrent sessions. Each retains at most 12 segments +and 24 MiB in memory; individual downloads are capped at 4 MiB with a ten +second deadline. There are no segment files or ffmpeg processes. Redirects, +off-origin references, encrypted playlists and non-MPEG-TS segments are refused. +Each decoder has its own client lease (at most eight per session), including +native HLS. Closing it releases only that lease; abandoned leases expire after +15 seconds without access. The last release stops upstream work. Failed live video +uses the existing still/Street View/synthetic fallback, which is not live video. +RTMP-only sources are not supported by this integration. + +
+ ### 💸 What it actually costs Honest numbers, roughly, as of mid-2026 — always check the provider pricing pages: diff --git a/SECURITY.md b/SECURITY.md index a21ea99a4..9a46e2cdd 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -62,6 +62,7 @@ browser-key fallback for existing single-key setups. The data proxies under `server/providers/` are written so the browser cannot turn the server into an open relay: - **No arbitrary-URL fetching.** The CCTV frame proxy fetches only server-registered camera/frame URLs — clients cannot pass an upstream URL to fetch (SSRF mitigation). Other proxies target fixed upstream hosts. +- **Live HLS is bounded and origin-pinned.** Registered HTTP(S) HLS sources use a Node puller that rejects redirects and off-origin playlist references, bounds playlists and segment bodies while streaming, and aborts timed-out or released sessions. At most two sessions retain 12 segments/24 MiB each, plus bounded download buffers. Stores are memory-only and idle sessions expire after 15 seconds. RTMP/ffmpeg execution is not enabled. Locally configured source URLs remain an operator trust boundary. - **Radio is not an audio relay.** `/api/radio/stations` contacts only allowlisted Radio Browser HTTPS hosts and paths, rejects redirects, rejects any hostname with a loopback/private/link-local/metadata/non-public A or AAAA result, and pins each TLS connection to a validated address. It returns normalized public HTTPS stream URLs; `/api/radio/click/:uuid` applies the same destination policy and accepts only station IDs from the current bounded catalog. The browser then connects directly to the broadcaster after an explicit playback action, so the broadcaster sees the listener's IP address. GEV never proxies, caches, records, or redistributes audio. - **No verbatim client headers upstream.** The CCTV media route is the one route that relays a request header (`Range`, for video seeking). It is parsed and canonicalized before it is forwarded: one `bytes=` range only, with every accepted form — explicit span, open-ended and suffix — bounded to the same 64 MiB ceiling the relay applies to a declared response body. Multi-range, malformed, inverted and non-`bytes` values are dropped and the request proceeds without a `Range`, as RFC 7233 §3.1 prescribes. Bounding the request bounds what is asked for: a response that declares no length — live streamed media, or a chunked body from an upstream that ignores the `Range` — has no ceiling. An upstream request the browser has stopped waiting for is cancelled rather than left running, whether the viewer leaves before the headers arrive or during the body. - **Transit fetches registered feeds only.** `/api/transit/vehicles/` resolves the id against `src/data/transitFeeds.js`; the browser never supplies a URL, and a feed that is registered but disabled does not resolve at all. Redirects are followed manually and each hop is validated against the feed's own https origin before it is requested, so an off-origin or downgraded hop is refused rather than contacted. Bodies are capped at 8 MB, the protobuf is decoded server-side under entity-count and string-length ceilings, a differential feed is refused, and snapshots live 15 s in memory with no disk cache. A per-feed admission limiter and a failure cooldown ladder bound what this process can ask of any operator. diff --git a/TESTING.md b/TESTING.md index adb247880..19cff9fed 100644 --- a/TESTING.md +++ b/TESTING.md @@ -210,6 +210,18 @@ While recording, call out anything in these areas — this is the feedback I mos happened? Any command it misunderstood? - **Anything that looks wrong, janky, or surprising** — screenshot it; that's the gold. +--- + +## 6. Live video CCTV (HTTPS HLS) — soak, no mic + +> Requires the DelDOT pack (loads by default; `CCTV_DELDOT_ENABLED=0` disables it). + +1. Turn on **CCTV**, fly to Dover, DE, and activate **DE 1 @ Main Toll Plaza**. ✅ Within ~30 s the monitor plane and the panel preview both show moving video,. +2. Leave it for **five minutes**. ✅ Continuous playback; at most a short hitch about once a minute (the agency restarts its stream on a timer). ❌ A freeze that does not recover, or the panel picture stopping while the plane keeps moving. +3. Toggle **PROJECTION** off. ✅ The panel keeps playing; the plane and the active camera's cone hide. +4. Switch to **DE 8 @ Saulsbury Rd**, then back. ✅ Each switch resumes within ~10 s with no stale frame from the previous camera. +5. Optional: DevTools → Network, filter `media/`. ✅ Playlist responses carry `X-CCTV-Source: hls-pull`; segments return `video/mp2t`. + ## If something looks off - **Grey globe / slow tiles:** wait a few seconds after a camera flight; photoreal streams in. diff --git a/docs/CODE-BOUNDARIES.md b/docs/CODE-BOUNDARIES.md index 35409e1d4..1aeddd565 100644 --- a/docs/CODE-BOUNDARIES.md +++ b/docs/CODE-BOUNDARIES.md @@ -277,6 +277,90 @@ share restoration and movement of controls between containers remain caller-owne Existing helper imports from `cockpitMath.js` and `rightRailPolicy.js` remain compatible through re-exports. +### Adding a right-rail readout panel + +Add the shell in `src/ui/templates/context.html` inside `#right-context-rail`: +a `.panel-collapsible` with a stable `id` and matching `data-panel-id`, the +existing `.panel-header`, collapse button and a dedicated body. Register it +with the existing panel chrome/layout owners; do not allocate rail space in +the body renderer. Set `hidden` while empty so the allocator ignores it, and +expand through the existing collapse button only on first appearance per page +session, and only when the chrome marked the restored state as a default +(`data-collapsed-preference`), never over a stored or shared choice. Preserve +the user's later collapse choice, including body remounts. Mark the body +`data-rail-scroller` when it scrolls: the rail's measuring pass lifts its +`max-height` and puts the scroll offset back afterwards. Panel bodies only +scroll on an open-card change, with one write, never on a refresh. + +Compose `createRailCards({ container, document, onParams, onOpen })` and +`createRailTimeline({ container, document, onCommit, onPreview, onStep, +onLatest, onPlay })`. Cards reconcile `{ id, title, badge, open, compact, +compactStatus, blocks }` in place. Their full-width native button headers expose +`aria-expanded` and `aria-controls`; articles expose `data-open`. The feature +adapter owns accordion state. Generic cards do not select data or enable layers. + +`blocks` is an ordered array of loose, optional `{ id, type, ... }` descriptors, +rendered by `railCardBlocks.js`. There are no per-section disclosures: + +- `summary`: `text`, a single summary line. +- `list`: `list: { ariaLabel, items }`, reconciled by `syncRowList` in `rowList.js`. +- `lines`: keyed `lines: [{ id, text, muted? }]` for details and status. +- `settings`: `settings: [{ id, label, chips }]`; each labelled row has a 56 px + label column and a wrapping `syncChipGroup` from `chipGroup.js`. +- `legend`: `legend: { colors, labels, units?, zeroIndex?, categorical? }` for a + ramp/scale (including a physical freezing anchor) or separate keyed swatches. +- `actions`: keyed `actions: [{ id, label, params?, href?, onClick?, disabled?, +hint? }]` in a footer, using buttons or safe new-tab links. +- `result`: `label`, keyed `lines`, and optional `clear: { params | onClick }`; + its accessible × button sits beside the title. + +Every block and control has a stable id. Lists, settings, actions and results +can appear in any requested order, including a scene panel's rectangle action, +results list, then selected-scene details. Chip/list/action `params` dispatch +through `onParams(cardId, params)`; the feature adapter supplies +`setLayerParams(id, params, { origin: 'user' })`. Current descriptors and disabled +state are read at dispatch. Identical updates do not move nodes or write DOM; +focused controls survive feed refreshes. + +Weather descriptors retain top-level `chips`, `list` and `legend` for non-DOM +consumers. They expose `summary.settings`, `summary.actions` and optional +`summary.result`; wind also retains its raw captured `summary.reading`. +`readout: true` layer rows render only the toggle and source/meta line; their +subscriptions still refresh the cards. Cards own configuration and readings. + +Weather orders cyclones, wind, then a bordered Observed history group containing +the timeline and active radar, satellite and lightning cards. The group heading +and scope name its active products. The timeline stays visible whenever any +observed product is enabled; fewer than two ticks disables transport. Pass +`heading: false` to the timeline when the containing group owns the heading. +Exactly one active card is open. Header clicks and newly enabled ids choose it +(the last new entry wins a batch); refreshes and clock ticks retain it. First +appearance uses cyclones with storms, otherwise the first card. Disabling the +open layer falls back to the first remaining card. A WeakMap per document keeps +explicit choices through body remounts without adding share state. Card opening, +storm selection and layer enabling remain independent. + +Optional card/badge/slider class names provide feature styling. Card titles use +`.data-name` typography; meta/time/badges use `.data-toggle-meta` typography; +setting/result labels use `.panel-title`; chips retain `.data-toggle-chip`. +Reserve one status line, even without a legend. Use app tokens. Wind's footer +reads the map center into a result after the action. The captured location stays +fixed until another read; model changes resample that location, units reformat +it, and × clears both reading and map marker. + +The timeline shows endpoint times and receives ticks, index, mode, playing, +readout and disabled state. Its preview callback receives the tick and index and +may return readout text; commits receive the same values after a 150 ms coalesced +drag or final change. Feature adapters own data mapping and service subscriptions; +generic modules own DOM/listeners/timers and release them in `destroy()`. + +Keep persistence with panel chrome: collapse uses +`godsEyeView.v6.panelCollapsed.`, position uses +`godsEyeView.v8.panelPos.`, and share state uses the registered panel id. +Do not rename existing +ids or reset persistence versions when adding a body. The WEATHER adapter is +`src/ui/weatherPanel.js`; its observed-history selection remains transient. + ## Visual input `gods-eye-view/ui/input` exports `bindApplicationShortcuts` and diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 095ec2fae..6453981aa 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -1,5 +1,193 @@ # God's Eye View Current State +Wind appears in the Weather group before Utilities. The surface-weather prototype +uses keyless NOAA GFS or ECMWF IFS forecasts on an approximately 1° display grid. +It defaults to 10 m wind trails over the existing basemap. Speed shading is an explicit choice; earlier v2 links retain their original speed-shading meaning. +Weather rows contain only the toggle and source/meta line. Configuration lives +in each WEATHER card's Settings section: model, No color field, Speed, Pressure, +Temperature, wind units, Pause/Resume and **Inspect center** for wind; coverage, +image treatment and opacity controls for observed products. Cyclone cards carry +a Storms section whose entries select and fly to the advisory, plus the official +advisory link. Settings and Storms default closed; disclosure choices last for +the page session. + +Inspect center adds an open Reading section to the wind card with captured +coordinates, interpolated wind speed and meteorological direction, selected +scalar, model, valid time and freshness. Clear reading removes the sample and +map marker. Model/field changes or refresh also clear them. Unit chips reformat +the captured sample without resampling or moving its marker. There is no separate +floating reading surface. The card shows forecast issue and valid times; the +observed-history timeline labels the oldest and newest available ticks. Animation +moves through a fixed forecast; it does not advance forecast time. + +Temperature is air temperature at 2 m in °C; pressure is mean sea-level pressure +in hPa. Optional companion fields come from the same model run/forecast as the +wind. A missing or invalid companion leaves usable wind visible and identifies +the selected field as unavailable. The color texture drapes the globe basemap; on +photorealistic 3D Tiles the same 360×181 raster is a raised shell 5 km above the +ellipsoid. With GPU rendering, the color field fades out below ~1,200 km camera +height and is hidden at or below 200 km. Globe imagery keeps the smooth +per-frame fade. On 3D Tiles, the shell alpha is quantized to 0.1 steps and +updated only on camera move end, installation or rehome. +GPU wind curves follow the sampled forecast field. Their 12 km display lift is a +rendering aid; the source remains 10 m wind, +not a forecast at the displayed height or a street-level observation. + +The renderer owns field installation, scalar imagery and the animation lifecycle. +It bakes at most 7,200 curves (1,200 below 700 px) with at most 33 geographic points each on the CPU +when installing a wind field, then advances a GPU phase along those curves +without CPU projection of every point on every frame. Regional 30° batches are +culled against the horizon and view frustum each frame, including when the globe +is hidden; curves fade below 60 km and disappear at 15 km. Animation stops when +no batch is visible and resumes on camera events. A canvas renderer remains +available as a fallback. Pause and reduced-motion mode show a static flow view +without an idle animation loop; hidden tabs suspend animation, and +disable/destruction releases owned rendering +resources and subscriptions. The globe relief helper is enabled with Wind and +released when Wind is disabled. It uses terrain vertex normals +for view-directed shading, falling back to global globe-curvature shading when +normals are unavailable; the fallback does not show local hillshade. Neither mode +adds elevation data or represents sunlight. Relief declines to replace an +existing globe material, restores the prior empty material only while still +owning it, and leaves later owners intact. +Source acquisition retains deadlines, body budgets, disconnect cancellation, +per-model/field singleflight caching and one-minute failure backoff. Application +catalog construction owns each instance. + +Wind animates one forecast without advancing forecast time. Separate Weather +observation layers provide radar and satellite history; none claims measured cloud volume. +Weather imagery drapes onto the globe basemap. On photorealistic 3D Tiles each +observed product is instead a raised, translucent shell: one rectangle over the +product bounds at a fixed height (global infrared 5.5 km, regional infrared +5.8 km, radar 6.2 km, lightning 6.6 km) showing one full-extent image per frame. +Draping onto 3D Tiles was limited by Cesium's per-primitive texture budget and +rebuilt every tile's coverage on each change; shells avoid both and show at any +camera height. Shells draw first in the opaque pass, in height order, +alpha-blended without depth writes: lightning draws over the other products, +other map content draws over the shells, and shells are not pickable. A +map-source change tears down one renderer and restages the shown observation on +the other. A map without an imagery host pauses history while metadata refresh +continues, then resumes when a host returns. +Globe tiled products use 256 px tiles to maximum level 6. The tile proxy accepts +size=256 (default), 512 or 1024 and keys cached bytes by size, retaining the +24-hour immutable response and eight upstream slots. The image proxy serves every +product as one whole-extent PNG at its advertised bounds, up to 4096×2048 for +radar, regional infrared and lightning and 2048×1024 for global infrared +(`size=W×H`, default the maximum), capped at 16 MiB and cached by product, time +and size. NOAA returned each of these sizes from a single request in a live +check; the WMS capabilities advertise no size maximum. Devices whose texture +limit is below the product size request halved images. +On 3D Tiles, each shell except global infrared also draws a detail window: the +shell's own surface samples a second, 4096×2048 image of the area around the +view inside that window, so the two images share one mesh and never blend. On +camera move end and host switch the window is centred on the camera's ground +footprint, max(2 × its longitude span, 6°) wide and half as tall, on a 0.5° grid +inside the product bounds. It is used only while narrower than half the +product's longitude extent and while the view overlaps the product; it moves +only when the view centre leaves its inner half or the span changes by more +than 50 %. A window applies once its image has drawn; until then the +full-extent image covers it. A new frame swaps the full-extent image first and +keeps the previous detail image until the new one decodes, over at most one +newer frame; a moved window hides until its image arrives. Global +infrared contrast depends on the requested extent, so it keeps one image. The +image proxy accepts `bbox=west,south,east,north` for every product: inside the +product bounds, 2:1 within 1 %, rounded to 0.25°, up to 4096×2048 (the +default), cached by product, time, size and bbox. Diagnostics report +`shell.detail` (`bbox`, `size`, `ready`, `enabled`). +Clouds only applies a soft brightness ramp to decoded pixels once, using +Cesium's sRGB-to-linear conversion (`channel ** 2.2`) and smoothstep from 0.40 +to 0.70. The old 0.55 threshold is the ramp midpoint. RGB and source alpha are +preserved in Full image mode; both modes use the chosen layer opacity. This +is a display filter, not a cloud mask. Satellite share links retain the display +mode; observation history remains transient and links open latest. +Global infrared fetches one capped 4 MiB, 2048×1024 mosaic per frame and decodes +and processes it before staging. Globe hosts crop that canvas into 256 px tiles +to maximum level 3 on a geographic 2×1 root grid bounded to the manifest extent, +avoiding request-dependent contrast seams. +On globe hosts, regional infrared retains network tiles and processes each +decoded tile once; shells process each whole frame once. +Exact-time tile and image responses are immutable for 24 hours; manifests and +errors remain uncached. Each globe renderer retains up to 6 processed global +mosaics in a least-recently-used cache keyed by observation time and infrared +mode (up to 48 MiB of canvas pixels). Each shell keeps decoded full-extent and +detail images in one least-recently-used cache bounded at 128 MiB, keyed by +time, mode and window: the shown frame and the warmed next frame, each +full-extent and detail; nothing older survives them. Disable clears the caches. +Cache hits skip +fetch/decode and report `mosaic.cached: true` with zero decode time. +During playback, a successful frame warms the next advertised observation, +wrapping at the end. Global imagery warms a decoded frame and shells warm the +next frame and its detail window; globe tiled +products fetch at most eight level-0/1 tiles intersecting the view and product +bounds. Prefetch is best effort, has a deadline, and cancels on frame +replacement, pause, suspension or clear. Diagnostics expose the renderer +(`host`), mosaic count and active prefetch state. +Browser cache reuse and scrub-back latency still require browser verification. +On globe hosts a replacement becomes visible before the previous layer retires +on the next rendered frame; a shell keeps its previous texture until the new +image is uploaded. Failed acquisition or staging retains the previous +observation. Imagery ordering skips already ordered layers. Diagnostics expose +the infrared mode and mosaic fetch/decode state. +Throttled weather requests (429/503) get at most three retries per tile within +a frame, independent of other tiles; successful requests reset only their own +counter, and closing a frame clears its retry state. +Mapped.earth's public bundles informed the rendering study; no code or assets +were reused, and the study found no application licence granting reuse. Native +hardware GPU behavior remains unverified; software-rendered checks do not +establish native GPU performance or compatibility. + +The right-rail WEATHER panel owns active-product readouts, coverage badges, +legends and the single observed-history timeline. The timeline appears with an +active observed layer and at least two union times; wind alone does not show it. +Dragging previews UTC and age locally and coalesces clock commits at 150 ms; +release commits immediately. Latest selects the newest frame per product, and +history labels the actual displayed frame as synced or nearest. Missing-frame +messages use each product's eligibility gap (30 minutes, or three hours for the +global mosaic). Wind shows forecast valid and issue times and does not follow +history. Satellite clouds uses Clouds only / Full image configuration labels. + +Left weather rows retain the toggle, one status line with a source tooltip, +configuration chips and the cyclone selection/focus list. Cyclone advisory, +position time, wind, pressure, geometry status and the official advisory link +live in the card. Controls opens the corresponding left row. The panel hides +when empty, auto-expands once per page session and then preserves the user's +collapsed state. Status lines reserve their space and refreshes are coalesced +per frame. Generic keyed rail cards and the native rail timeline preserve DOM +nodes and avoid identical writes; the weather panel owns descriptor mapping. +Inspection emphasizes the chosen scalar and marks the exact sampled location; +the passive marker follows that snapshot, respects globe occlusion and disappears +on dismissal, field/model changes, disable or teardown. Clean view and +recording mode hide weather presentation with the other controls. Scalar changes +reuse native wind geometry when the model, issue/valid time, grid and U/V values +are identical; new or revised wind still rebuilds. Source and renderer clocks +remain independent of the shared Cesium clock. + +Weather also offers default-off lightning density and cyclone advisories. +Lightning uses NOAA/NWS nowCOAST's public derived 15-minute density product from +Vaisala NLDN/GLD360, with ten-minute metadata refresh and exact source times. +Coverage is the Americas/Pacific (110°E across the dateline to 0°, 25°S–80°N), +not worldwide detections; units are strikes/km²/min ×10³. It is neither raw GLM +flashes nor a live strike counter. Weather imagery orders scalar context below +satellite, radar and lightning consistently across enable and history order. + +Cyclones combine fixed NHC/CPHC status and summary GIS endpoints through a bounded +same-origin provider. The status endpoint lacks browser CORS; each installation +fetches keyless public sources at runtime, with no centralized ingestion service. +The five-minute snapshot covers Atlantic and eastern/central North Pacific only. +Current positions, advisory issue time and position time stay distinct. Tracks, +forecast lead-hour points and cones render only when all source parts match the +status advisory; a newer status shows its position with geometry pending rather +than relabeling older geometry. The cone represents forecast center uncertainty, +not storm size or the full hazard area. Successful empty and unavailable states +are distinct. One owned native Cesium data source preserves polygon holes and +geographic seams and releases on disable; forecast animation is not implied. +Cyclone markers, labels, tracks and cones are hidden beyond the horizon on every map source. +Consult the linked official advisory for safety decisions. + +Voice and HUD snapshots reuse the existing feedState classifier. Analyst follow-ups retain their original data provenance; current-view results append provenance without replacing legacy fields. HUD context and deterministic telemetry include non-nominal feed state. + +Satellite and local infrastructure layers expose on-demand analyst records through their current factory owners. Analyst counts and ranks explicitly cover only bounded examined loaded records (default 2,000 per new layer, core satellite rows before dense extras); omitted records can change nearest/count and satellite distance is ground distance. Existing tools and result fields remain available. + AIS encodes speed over ground in 0.1-knot units and course over ground in 0.1-degree units, reserving the top code of each field for "not available", so those reports arrive as 102.3 knots and 360 degrees. Both are stored as unknown, @@ -125,7 +313,7 @@ Source factories have dedicated `layers//source` exports. ALPR and earth Voice controls bind to a protocol-independent session factory. The default WebRTC adapter preserves the existing Realtime connection, push-to-talk, cost controls and radio handoff. Session subscriptions expose state, transcript, action call/result, interruption and completion events; stopping or replacing a session cancels pending actions. Alternate adapters can use the same controls and action runner. -Voice action argument schemas have one portable owner under `src/voice/actionSchemas.js`. The Realtime provider builds the same 28 tools using separate description-only metadata. Description customization cannot replace argument types, enum values or required fields. +Voice action argument schemas have one portable owner under `src/voice/actionSchemas.js`. The Realtime provider builds 29 tools, retaining the existing 28 names and argument contracts apart from the three additive analyst-layer enum values using separate description-only metadata. Description customization cannot replace argument types, enum values or required fields. Portable source exports provide Radio Browser station normalization, CCTV feed types and regional records independently of HTTP middleware. Radio normalization accepts an explicit URL policy; the standalone directory retains its existing HTTPS rules. Tile coordinate validation accepts explicit zoom bounds with unchanged traffic defaults. Cache, request and rendering owners remain unchanged. @@ -154,7 +342,6 @@ owns disclosure, docking and Cockpit panel snapshots. Each takes explicit operations and reads instead of the complete shell. Existing controls, share formats and one-application-per-page behavior are preserved. - Layer lifecycle transactions are owned by `data/lifecycle`, which has no panel, render-governor or detection imports. Application composition mounts a separate layer presentation owner that reacts to status, accepted visibility/parameter @@ -163,7 +350,6 @@ rendered detection set. The legacy manager retains panel helper compatibility; registration sealing, restoration order and failed-transition rollback remain unchanged. - Application scene setup owns request services, terrain/floor caches and annotation lookup state. Controls, layers and voice share those owners, and cancellation clears caches and removes map-stack listeners. Standalone setup supplies the @@ -172,7 +358,6 @@ framing and annotation boundaries receive their service instances explicitly. Compatibility entrypoints retain defaults for direct callers; normal startup does not change global service slots. Analyst follow-up memory belongs to its voice runner. - Application startup constructs fresh layer instances from explicit source objects. Standalone composition selects the existing providers. Controls, launch orbit lookups, Contacts voice answers and ISS pass queries use the registered catalog. @@ -180,7 +365,6 @@ Aircraft classification is catalog-owned and cancelled with application teardown scene engines still support one application per page. Compatibility data entrypoints remain for direct callers, but normal startup does not configure global sources. - Application data setup receives an ordered layer catalog and serialization metadata. Controls use the same instances. The standalone composition selects the existing default catalog, and restoration starts only after all registrations are sealed. @@ -199,7 +383,6 @@ transports and cancellation through response parsing. Stop and application teardown abort pending connections; reconnect requests a new client secret. Microphone, radio handoff, tool schemas and default model behavior are preserved. - Geospatial lookups are composed through `src/search`: forward/reverse geocoding, text/nearby search and routing use configurable providers/endpoints. Annotation, HUD and voice consumers share the configured service. Existing Google/Photon @@ -207,7 +390,6 @@ selection, route/direct-line honesty and tool schemas are preserved. Node Google, OSRM and Nominatim adapters accept trusted construction-time configuration; request parameters cannot choose arbitrary upstream URLs. See APPLICATION.md. - The optional **ALPR Cameras** layer shows community-mapped OpenStreetMap locations, not camera footage or plate records. City-scale queries use the existing Overpass provider, with capped results, retry, cached-data and incomplete-coverage notices. @@ -311,7 +493,6 @@ Selection changes, disable and destruction cancel pending trail requests; late responses cannot refill a cleared or replacement trail. Heading and course, sea-surface placement, click ownership and card selection policy are unchanged. - ## Military-flight components and aircraft mechanics `gods-eye-view/layers/military` exports `createMilitaryFlightLayer`. It uses the @@ -368,7 +549,6 @@ messages; arbitrary HTTP response bodies are not surfaced as diagnostics. Sources receive cancellation signals and check them after body parsing. The layer's existing lifecycle and selection guards continue to reject late work. - ## State and action outcomes Share preferences, place lookups and Scene playback expose immutable snapshots @@ -417,7 +597,6 @@ retained Cockpit actions cannot restart a disposed controller. Input, subscripti and queued panel work stop before asynchronous layer restoration; final camera and portal cleanup follows that restoration. - ## Context coordination Context controls own Contacts/Space Missions state, entry and exit transactions, @@ -427,7 +606,6 @@ presentation work stop during disposal; layer restoration retains its existing compensation and latest-intent rules. Clear Selected Layers shares this owner, so an older restore cannot replay over a newer Clear action. - ## Camera panel ownership CCTV controls receive the existing camera port and explicit application actions. @@ -438,7 +616,6 @@ calibration edit. Failed refreshes preserve settled pixels for the same camera, while a newly selected camera never shows the prior camera's image. Disposal releases listeners, subscriptions, image handlers, summary timers and chip-hide timers. - ## UI disposal UI disposal releases the CCTV subscription, command-dock observer, legacy drag @@ -480,7 +657,6 @@ and result presentation. Existing search providers and camera handoff policy are preserved. Replacing or closing a POI row cancels its pending expansion frame; destruction releases listeners, pending searches and the orbit indicator. - ## Layer panel ownership Layer rows, feed feedback, counts, focus-preserving chips and toggle listeners @@ -489,7 +665,6 @@ snapshots, lifecycle actions and row descriptors. Remount and teardown remove listeners and row subscriptions; obsolete completions do not repaint old rows. The clear control presents busy state while its existing action owns the transaction. - ## Map Source control ownership Map Source controls own chip listeners, source-state subscriptions and selection @@ -541,7 +716,6 @@ panel, and honors keyboard focus on the right. Mobile layout still releases desktop allocation styles. Stable Display allocation avoids unnecessary style writes. This extraction does not change panel positions or layout defaults. - ## Surface keyboard lifecycle `ui/surfaces` owns the capture-phase keyboard listener, Tab cycling and return @@ -553,7 +727,6 @@ preferences. Provider Settings retains its existing visibility and save policy. Initial focus, transitions and DOM content remain with each screen. This component does not add modal semantics or make the map inert. - ## Panel disclosure lifecycle Panel collapse buttons, nested Escape handling and dock hover/focus timing now @@ -563,7 +736,6 @@ Location draft cleanup and Map Source selection remain with their existing callers. Listener and timer cleanup is synchronous when controls are replaced or disposed, preventing old hover or focus work from changing a later view. - ## Military feed cooldown and loading guidance The adsb.lol military proxy reuses its last response during upstream 429/5xx @@ -577,7 +749,6 @@ Mapped-installation zoom guidance appears in the layer row without counting as a global loading failure. Guidance statuses do not suppress independent refresh errors. - ## Places and CCTV request bounds With a Google key configured, nearby and text search reject missing, blank, @@ -592,16 +763,13 @@ responses are cancelled. Buffered snapshots have a 16 MiB streaming cap; an oversized image remains an upstream miss and uses the normal fallback chain. The existing declared media size ceiling remains 64 MiB. - ## GBFS upstream bounds The station reader addresses the proxy as `/api/gbfs/`; the -feed address is read from the path, and a query-string form is refused with a -400. GBFS refuses upstream redirects and enforces its 5 MiB response cap while +feed address is read from the path, and a query-string form is refused with a 400. GBFS refuses upstream redirects and enforces its 5 MiB response cap while streaming. The 12-second deadline includes reading the body, and rejected or stalled downloads are cancelled. Development and preview use the same handler. - ## Remaining local service modules Overpass query validation, geometry simplification, disk caching and upstream @@ -634,7 +802,6 @@ preview returns JSON 404 for those endpoints. Server credentials come from the local environment; browser keys are captured at build time. Rebuild after changing a browser key. Preview is for local build verification, not a production server. - ## CCTV and radio provider modules CCTV catalog acquisition, source normalization and frame/media delivery now live @@ -728,7 +895,6 @@ supported. `.env.example` and `pinokio/_ENVIRONMENT` document both entries. The Street View headings tool uses the same server-first selection after resolving environment overrides per variable; its explicit `--key` wins. - ## Infrastructure marker visibility Datacenter/dam registration uses fresh reusable factories with the application's @@ -866,7 +1032,6 @@ The existing aircraft normalizer is separately available through the portable `gods-eye-view/sources/adsb-lol` export. Provider URLs, local credentials, cache policy, fallback behavior, response shapes and rendering remain unchanged. - ## Control names for assistive technology Scope, Bloom, Sharpen and location search have explicit accessible names. @@ -961,7 +1126,7 @@ fetching, trailing-24-hour filtering and partial-success caching are unchanged. > durable in this app (`gev:layer-state:v2`, written by > `LayerStateCoordinator._commitExplicit` only for origin `user`/`voice`/`tool`). > A mission enables **its own** layers at `origin: 'user'` — durable, exactly as -> clicking those rows is, because picking the mission *is* that choice. The two +> clicking those rows is, because picking the mission _is_ that choice. The two > Context missions also expand the Context panel, as the visible tabs do; the > globe missions open no panel. Everything else is off limits: detection > mode/density, `gev:detection-allocation:v1`, 3D models, feather, and above all @@ -996,7 +1161,7 @@ fetching, trailing-24-hour filtering and partial-success caching are unchanged. > `stopImmediatePropagation()`, and the launcher skips `defaultPrevented` events. > `stopPropagation()` alone does **not** stop later listeners on the same > `document` — that is exactly how the compact Radio disclosure made one key -> close the disclosure *and* dismiss the launcher. +> close the disclosure _and_ dismiss the launcher. > > **Accepted:** a surface class that never clears means no launcher for that page > load, with no timeout. None of the four classes is restored at startup, so an @@ -1052,6 +1217,7 @@ This is the current runtime/source-of-truth snapshot for the project. > [!IMPORTANT] > **Delta since the July-2 body below** (the detailed sections are still accurate > for everything they describe; these landed after): +> > - **"Never answered yet" is a THIRD state, distinct from empty (2026-08-23):** > `sourceState` in `src/data/militaryAwareness.js` treats a dependency that is > busy AND has never produced an answer (`loading === true && !lastUpdate`) as @@ -1074,7 +1240,6 @@ This is the current runtime/source-of-truth snapshot for the project. > samples, `enabling` throughout, panel non-numeric) and across a failing > one. Its `status: 'idle'` is not what saves it — the lifecycle is; the > module has no `loading` status at all. -> > Any new dependency that can be slow must report `loading` and `lastUpdate` > honestly for the contract to hold, and must be pinned against the shape its > own module really returns — a fixture that invents a status the module cannot @@ -1279,7 +1444,7 @@ This is the current runtime/source-of-truth snapshot for the project. > 1,000,000,000 m, plus finite components — not a null check, because a depth > read over empty sky can return a Cartesian that Cesium mishandles three > different ways: non-finite throws `DeveloperError: normalized result is not -> a number`, exactly `(0,0,0)` returns undefined, and a near-center value such +a number`, exactly `(0,0,0)` returns undefined, and a near-center value such > as `(500,0,0)` converts SILENTLY into a point 6,378 km underground that > reverse-geocodes as 0°, 0°. The floor sits ~346 km below the smallest real > surface magnitude (WGS84 polar radius 6,356,752 m); the ceiling is ~24× @@ -1337,17 +1502,17 @@ This is the current runtime/source-of-truth snapshot for the project. > supersession, and run teardown abort it — the data manager rolls an aborted > enable back through the module's own `disable()`, so no layer is left on > carrying stale params. Visuals: `styleManager.applyVisualState(state, { -> isCurrent })` gates BOTH halves of the map-stack switch, which is its only -> suspension point. The switch is a *mutation*, not just a wait, and +isCurrent })` gates BOTH halves of the map-stack switch, which is its only +> suspension point. The switch is a _mutation_, not just a wait, and > `mapStackController` invalidates a switch only when another `setStack()` > arrives — a winning state that omits `mapStack` (every normalized shot does) > never issues one, so a stale switch would otherwise stand on the globe. > So: an already-superseded caller never starts the switch, and one superseded -> *during* it puts the globe back to the stack the winner inherited — but only +> _during_ it puts the globe back to the stack the winner inherited — but only > while `getSwitchGeneration()` shows no newer switch has claimed it, because > a newer switch is a live intent that must not be stomped. The shader-uniform > commit after the await keeps its own gate. Precisely: a stale LOAD's -> *synchronous* prelude (style/bloom/HUD) can still have landed before it was +> _synchronous_ prelude (style/bloom/HUD) can still have landed before it was > superseded, and is then overwritten by the newer state; what cannot survive > is its map stack, its uniform commit, its layers, or its camera flight. > Post-`await` flag checks remain as a backstop. Known remainder: run cleanup @@ -1467,7 +1632,7 @@ This is the current runtime/source-of-truth snapshot for the project. > - **AIS feed watchdog (2026-08-18):** feed liveness is judged by DATA, not > socket state — AISStream can complete the handshake and then deliver > nothing forever. `/api/ais-live` reports `live | stale | reconnecting | -> down | auth-failed` (plus the unchanged `missing-key`/`unsupported`) with +down | auth-failed` (plus the unchanged `missing-key`/`unsupported`) with > `silentForMs`, `reconnectAttempt` and `nextAttemptAt`. Silence is REPORTED > at 120s and ACTED ON at 300s; recovery walks a 5s/15s/60s/300s ladder and > then stops at a terminal `down` with a slow 15-min retry running behind it @@ -2012,8 +2177,7 @@ This is the current runtime/source-of-truth snapshot for the project. > at `z-index:5`**, not into `#world-overlay-root`: the root is a stacking > context (`z-index:6`), i.e. an isolated blending group, and a surface inside > it has its `mix-blend-mode: screen` silently discarded by the browser -> instead of compositing against the WebGL scene. z-index (5 under the root's -> 6) keeps it beneath ambient-through-tracked host paint. +> instead of compositing against the WebGL scene. z-index (5 under the root's 6) keeps it beneath ambient-through-tracked host paint. > The >22 ms odd-frame relief valve is restored: the host does not clear the > detection surface on a held frame, while unrelated shared lanes repaint, > and `throttleSkipCount` remains a live diagnostic. Detection `data-*` fields @@ -2107,7 +2271,7 @@ This is the current runtime/source-of-truth snapshot for the project. > Identity stays `icao24` on every keyed surface (`getNearby().icao24`, the > detection `sourceId` declutter hashes, and the `id` that `trackById` and the > Context cohorts resolve) — only the displayed string follows the chain. -> Because adsbdb enrichment can answer *after* selection, the Context subject +> Because adsbdb enrichment can answer _after_ selection, the Context subject > re-resolves its label each refresh (`resolveSubjectLabel()`) instead of > freezing the selection-time snapshot. > - **Phase 5 tracked military aircraft label:** The military tracking entity @@ -2225,7 +2389,7 @@ This is the current runtime/source-of-truth snapshot for the project. > active camera is excluded from the 40-card ambient quota and has no host > card by default: its monitor plane is the active representation. The > product option `cctvLayer.setCardPresentationOptions({ -> activeCameraCardEnabled: true })` may publish it through the retained +activeCameraCardEnabled: true })` may publish it through the retained > protected path. CCTV leaders use the source cyan, remain vertical at the > camera anchor except for the off-card edge clamp, and counter-scale to one > CSS pixel through the altitude transform. Card hits come from @@ -2407,7 +2571,7 @@ This is the current runtime/source-of-truth snapshot for the project. > sprites/trails, OpenSky credit governor). The 2026-07-08 CHANGELOG entry > records the subsystem's architecture, invariants, residuals, and verification. > - **Height-datum test surface:** `npm test` 184 unit · `npm run -> test:track` 43 tracking invariants · headless QA harnesses under +test:track` 43 tracking invariants · headless QA harnesses under > `scripts/qa-*.mjs` incl. `qa-height-datum.mjs` (numeric heights) and > `qa-floor-verify.mjs` (any-airport ground-truth oracle). > - **2026-08-19 — display-time ground floor (flights layer).** A grounded @@ -2510,25 +2674,26 @@ nearby place—always use station selection. Unqualified “turn on/start the ra requests use Play; a qualified Play-shaped tool call is normalized to Select so its criteria cannot be silently ignored. -| Layer | Source | File | Proxy | Update Interval | -|-------|--------|------|-------|-----------------| -| Live Flights ✈️ | OpenSky Network; bounded adsb.lol regional fallback | `src/data/flights.js` | `/api/opensky` (OAuth + fallback) | 30s | -| Military Flights 🎖️ | adsb.lol /v2/mil | `src/data/militaryFlights.js` | `/api/adsblol/mil` | 15s | -| Live AIS Vessels 🚢 | AISStream websocket | `src/data/aisLiveVessels.js` | `/api/ais-live` | 60s (+800ms visibility pass) | -| Mapped Installations ⌖ | OpenStreetMap mapped context; on-demand Google Maps Places supplement | `src/data/militaryInstallations.js` | `/api/military-installations`, `/api/google/text-search` | viewport-driven + user search; while unavailable, auto-retry 30 s → 240 s backoff | -| Earthquakes | USGS | `src/data/earthquakes.js` | — | 60s | -| Satellites | CelesTrak | `src/data/satellites.js` | `/api/celestrak` | 120s | -| Space Missions (30d) | Launch Library 2 + CelesTrak | `src/data/rocketLaunches.js` | `/api/launches` + `/api/celestrak/active` | 5 min | -| Traffic | OSM Overpass (+ optional TomTom live flow) | `src/data/traffic.js` | `/api/overpass` + `/api/tomtom` | viewport-driven | -| CCTV | Austin + Caltrans (CA) + TfL London + Ontario 511 + Fintraffic (FI) + DriveBC (BC) + TxDOT (TX) + Estonia (Tallinn, Tarktee) + Live Traffic NSW + Open Calgary Open Data + Street View fallback | `src/data/cctv.js` | `/api/cctv` | 10s (active) | -| Radio | Radio Browser (public-domain station directory) | `src/data/radio.js` | `/api/radio/stations`, `/api/radio/click/:uuid` | 45 min directory refresh | -| Transit 🚌 | Operator GTFS-Realtime VehiclePositions (7 keyless regions, `src/data/transitFeeds.js`) | `src/layers/transit/` via `src/app/layers/transit.js` | `/api/transit` | 15s (poll + delayed playback) | -| Bikeshare 🚲 | GBFS (Lyft + BCycle) | `src/data/bikeshare.js` | `/api/gbfs` | 60s | -| Directions 🧭 | OSRM on FOSSGIS servers (OpenStreetMap) | `src/data/directions.js` | `/api/route` (`steps=1`) | on placement / mode change | -| Datacenters ▣ | OSM extract (bundled) | `src/data/localLayers.js` | — | static | -| Dams ▰ | OpenInfraMap/OSM extract (bundled) | `src/data/localLayers.js` | — | static | -| Submarine Cables ◠ | TeleGeography public map (bundled) | `src/data/telegeographySubmarineCables.js` | — | static | -| FIRMS Active Fires ▲ | NASA FIRMS live (VIIRS ×3 NRT, trailing 24h) | `src/data/firmsHeatmap.js` | `/api/firms` (`FIRMS_MAP_KEY`) | 10 min (proxy TTL 30 min) | +| Layer | Source | File | Proxy | Update Interval | +| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- | -------------------------------------------------------- | --------------------------------------------------------------------------------- | +| Live Flights ✈️ | OpenSky Network; bounded adsb.lol regional fallback | `src/data/flights.js` | `/api/opensky` (OAuth + fallback) | 30s | +| Military Flights 🎖️ | adsb.lol /v2/mil | `src/data/militaryFlights.js` | `/api/adsblol/mil` | 15s | +| Live AIS Vessels 🚢 | AISStream websocket | `src/data/aisLiveVessels.js` | `/api/ais-live` | 60s (+800ms visibility pass) | +| Mapped Installations ⌖ | OpenStreetMap mapped context; on-demand Google Maps Places supplement | `src/data/militaryInstallations.js` | `/api/military-installations`, `/api/google/text-search` | viewport-driven + user search; while unavailable, auto-retry 30 s → 240 s backoff | +| Earthquakes | USGS | `src/data/earthquakes.js` | — | 60s | +| Satellites | CelesTrak | `src/data/satellites.js` | `/api/celestrak` | 120s | +| Space Missions (30d) | Launch Library 2 + CelesTrak | `src/data/rocketLaunches.js` | `/api/launches` + `/api/celestrak/active` | 5 min | +| Traffic | OSM Overpass (+ optional TomTom live flow) | `src/data/traffic.js` | `/api/overpass` + `/api/tomtom` | viewport-driven | +| CCTV | Austin + Caltrans (CA) + TfL London + Ontario 511 + Fintraffic (FI) + DriveBC (BC) + TxDOT (TX) + Estonia (Tallinn, Tarktee) + Live Traffic NSW + Open Calgary Open Data + Street View fallback | `src/data/cctv.js` | `/api/cctv` | 10s (active) | +| Radio | Radio Browser (public-domain station directory) | `src/data/radio.js` | `/api/radio/stations`, `/api/radio/click/:uuid` | 45 min directory refresh | +| Transit 🚌 | Operator GTFS-Realtime VehiclePositions (7 keyless regions, `src/data/transitFeeds.js`) | `src/layers/transit/` via `src/app/layers/transit.js` | `/api/transit` | 15s (poll + delayed playback) | +| Bikeshare 🚲 | GBFS (Lyft + BCycle) | `src/data/bikeshare.js` | `/api/gbfs` | 60s | +| Directions 🧭 | OSRM on FOSSGIS servers (OpenStreetMap) | `src/data/directions.js` | `/api/route` (`steps=1`) | on placement / mode change | +| Datacenters ▣ | OSM extract (bundled) | `src/data/localLayers.js` | — | static | +| Dams ▰ | OpenInfraMap/OSM extract (bundled) | `src/data/localLayers.js` | — | static | +| Submarine Cables ◠ | TeleGeography public map (bundled) | `src/data/telegeographySubmarineCables.js` | — | static | +| FIRMS Active Fires ▲ | NASA FIRMS live (VIIRS ×3 NRT, trailing 24h) | `src/data/firmsHeatmap.js` | `/api/firms` (`FIRMS_MAP_KEY`) | 10 min (proxy TTL 30 min) | +| Wind 🌬 | NOAA GFS 10 m wind (keyless, 0.25°→1° grid; animated particles) | `src/data/wind.js` | `/api/wind` | 1 h (forecast cycle) | Directions is a keyless front end to the routing the voice agent already uses. Its row chips are the whole interface: DRIVE / WALK / BIKE pick the @@ -2584,7 +2749,7 @@ tool holds the pointer. FLY runs through the UI shell's immediate-navigation facade — the same camera authority validated voice destinations use — and is handed the shared ground-floor read and corridor warm, so the dolly does not fly a mountain corridor at sea level. A reroute (SWAP, or a profile change), -CLEAR, disable and destroy stop the flight *this layer started* and only that +CLEAR, disable and destroy stop the flight _this layer started_ and only that one: `flyRoute` returns a motion id and `interruptCameraMotionIfActive` refuses to stop a motion someone else began. @@ -3161,7 +3326,7 @@ silently demoting every later lookup for the session. COVERAGE ON enable creates the active/visible 14-camera cohort, and activation always creates the selected frustum even with COVERAGE OFF. **Field validation passed 2026-07-04** (core look + downtown no-clip confirmed); that round fixed three findings: the - ground clamp now lifts the cap *center* only so the wireframe stays a true pyramid welded to + ground clamp now lifts the cap _center_ only so the wireframe stays a true pyramid welded to the plane (was a flattened fan / the ~47.5 m divergence — RESOLVED), re-selecting the active camera is a no-op (killed a click-flash), and texture swaps gate on canvas content (killed a periodic white flash). Coverage is now **metro-wide: 250 cameras** (`CCTV_AUSTIN_MAX_SOURCES` @@ -3173,7 +3338,7 @@ silently demoting every later lookup for the session. poses, and the layer is stills-first. sources. Fintraffic Finland road weather cameras (2026-09-13; cap 300, `CCTV_FINTRAFFIC_MAX_SOURCES`, kill switch `CCTV_FINTRAFFIC_ENABLED=0`) are the fourth pack: one keyless GeoJSON station list - covering the whole country, where one *preset* (a station's fixed view) is one camera — 806 + covering the whole country, where one _preset_ (a station's fixed view) is one camera — 806 GATHERING stations carry 2,256 in-collection presets, prioritized to 300 against seven anchors on the main road spine. `CCTV_MAX_SOURCES` is a 4,000 catalog-wide ceiling shared round-robin across packs, so a lower global cap thins every region instead of starving the last pack. @@ -3226,7 +3391,7 @@ silently demoting every later lookup for the session. `activeCameraCardEnabled` presentation option can publish the retained protected-card path. Disable tears the tier down completely. Coverage/viewshed semantics unchanged. -- **Satellites**: orbit rings rotate about Earth's Z by ΔGMST every ~1s (exact inertial→ECEF compensation; no SGP4 re-runs); the tracked satellite propagates per frame with one shared epoch for dot/label/camera. Verified: ISS holds <1km perpendicular to its ring while tracked. +- **Satellites**: orbit rings rotate about Earth's Z by ΔGMST every ~1s (exact inertial→ECEF compensation; no SGP4 re-runs); the tracked satellite propagates per frame with one shared epoch for dot/label/camera. Verified: ISS holds <1km perpendicular to its ring while tracked. Pass prediction (`src/data/satellitePass.js`; `getNextSatellitePass`, `getNextIssPass`) scans at 20s, bisects rise/set to ~0.2s, fits the peak with a parabola, and marks a pass visible when the satellite is outside a cylindrical Earth shadow while the observer's Sun is at or below −6°. `next_iss_pass` preserves its geometric-pass ordering and appends visibility metadata. General `next_satellite_pass` accepts a loaded NORAD ID or unambiguous name, searches 24 hours and optionally requires estimated visibility. These estimates do not account for weather or satellite brightness. - **Space Missions (30d)**: recent launches render as bounded shared-host, horizon-occluded mission markers using Launch Library 2 v2.3 detailed records. Enabling the layer selects the unified right-side Context panel's Space Missions mode and enables the required satellite layer. Before applying its temporary dense/hidden Satellite mode, Space Missions snapshots the complete standalone Satellite parameter set and exact enabled-layer set. Disabling Space Missions from either Context or the left Data Layers rail restores those parameters and the exact prior enabled state, so a Satellite layer that was already on stays on while a mode-owned dependency returns off; enabling Satellites by itself remains independent. Selecting a mission isolates its launch-to-orbit transfer and dashed satellite orbit, fills that same panel with navigation/details, and animates a small phase-colored marker along the exact displayed Cartesian samples. Marker hit testing drill-picks through photorealistic tiles so the depth-test-free tactical dot remains reliably selectable; its text is non-interactive shared-host presentation. The selected pad is the camera's zoom pivot: the overview remains centered on its launch site, wheel zoom approaches that site instead of drifting elsewhere, and camera pitch progressively changes from global nadir to an oblique close 3D view. Its protected shared-host callout remains visible and expands to include both mission and launch-site names. `FOCUS` flies directly to a 12 km oblique frame around the selected launch site and retains the same anchored zoom/orbit behavior. `REPLAY ASCENT` resets the selected marker at the pad, frames it from an oblique third-person angle, and follows it through the mission-specific compressed ascent directly into one orbital lap at the default `1×` rate. A live `0.25×`–`4×` slider changes ascent and orbit playback speed; adjusting it mid-replay preserves the current path position and historical mission timestamp. Re-entry/recovery cannot be inserted into replay. At orbit insertion the camera smoothly pulls back over the first fifth of the orbital replay and pitches to a globe-scale nadir view while continuing to target the moving replay point. Replay Cancel, mission navigation, deselection, layer disable, and data refresh all release camera ownership. Reconstructed paths are one continuous 128-sample geodetic curve: horizontal departure begins near zero while altitude rises quickly, then the climb progressively bends toward insertion without the former hard 120 km corner. Unmatched orbit fallbacks are smooth planar inclined rings rather than longitude/latitude ground-track curves. The panel lists disclosed payload names, types, operators/manufacturers, mass, multiplicity, and destination when supplied; an empty LL2 payload collection is shown as `CLASSIFIED / MULTI-PAYLOAD`. Launcher, spacecraft, and recoverable payload stages appear in a compact stage table with serial/flight/reuse details, recovery outcome/type, destination, and final coordinates when those records exist; an empty recovery collection omits the section. Stage recoveries with confirmed coordinates use those coordinates; return-to-launch-site records use the pad; downrange-only records receive an explicitly labeled estimated endpoint along the ascent azimuth. Available endpoints render as static 2 px dashed descent/recovery paths with a fixed final-position dot and an estimated atmospheric-interface segment when applicable. The ascent is geodetically densified above the ellipsoid toward the orbit's nearest insertion point, then rendered with `ArcType.NONE`, so it neither cuts through Earth nor separates from the marker. Because LL2 does not normally supply continuous ascent telemetry, pad-to-insertion paths without upstream trajectory samples are labeled `RECONSTRUCTED ESTIMATE` / `ASCENT ESTIMATE`; only supplied trajectory samples receive the replay wording. Selected-orbit framing fits the complete ring, rear-side linework uses normal scene depth occlusion, and current distance, speed, and callout data come only from a launch-year-validated satellite match. Speed is the magnitude of the SGP4 inertial velocity vector at the same propagation epoch as position, displayed in km/s with km/h available as hover detail. Unavailable operator, site, launch-time, orbit, current-altitude, and speed values omit their detail rows instead of reserving panel space with placeholders. Newly launched payloads absent from the core operational groups use CelesTrak's cached active TLE feed as a lookup-only fallback; weak constellation-name matches are rejected. The replay callout maps compressed animation progress onto Launch Library's mission-relative timeline, showing the historical UTC date/time at the marker's current path position; unavailable timelines remain explicit. Matched live satellite positions propagate at one-second cadence and use a distinct green dot/callout with the current UTC date/time. When no mission is selected, the Context panel presents a scrollable newest-first roster of every launch in the rolling window, including the smaller 5 px operator-colored marker, provider, and launch date. Hovering or keyboard-focusing a row shows four compact cyan corner brackets on both that roster row and its corresponding globe dot, rotates the globe at the current zoom to center it, and gives its label declutter priority without selecting it; the globe label remains unbracketed. Selecting a roster row invokes the same mission isolation and full-orbit framing as clicking its globe marker. The replay vehicle is one screen-space SVG/CSS HUD overlay rather than separate Cesium billboard, label, and reticle graphics. It is hidden during ordinary Focus and manual close views, where the standard selected launch-site label remains visible, and exists only while ascent replay is active. Its fixed pixel scale is shared by ascent and insertion, so camera range never resizes the rocket on screen before the phase boundary. Generic Launch Library pad names are reduced to their identifying suffix, and replay timestamps use a cyan state title over unprefixed white UTC date/time values. `REPLAY ASCENT` holds the unframed cyan/white rocket at the pad for a real-time `T−10` countdown, transitions through `LIFTOFF`, and attaches six tapered cyan/white ellipse waves directly below it from liftoff through insertion to convey thrust without adding scene geometry. While replay is active, the single start button is replaced by compact Play, Pause, and Cancel icon controls. Pause freezes countdown or mission time, vehicle/stage positions, camera target, labels, and thrust-wave animation; Play resumes from that exact frame, and Cancel releases replay camera ownership. The rocket and thrust group rotates from the path's live screen-space tangent, so its nose follows the visible ascent curve while the adjacent text remains upright. The camera begins as a close oblique launch chase, then smoothly widens between roughly 120 and 420 km vehicle altitude into a higher oblique context view that keeps the moving rocket targeted while exposing the ascent bend and orbit connection. At insertion the rocket/thrust glyph is replaced by the fixed-size cyan orbit dot, which the camera follows through the existing globe-scale orbit pullback. The chase camera limits per-frame yaw changes across heading wraps so it cannot abruptly cross in front of the vehicle and make ascent read in reverse; the replay-speed slider affects mission playback but not countdown duration. Mission world text has no native `LabelGraphics`: overview launch markers publish at most 48 ambient candidates for a 24-winner budget, while selecting a mission clears that overview source and publishes its launch-site callout, stage re-entry annotations, live/estimated payload-position readout, and orbit annotation as protected selected-lane entries. The source retains the exact former strings and colors. Static anchors reuse the Cartesian values used to build their mission geometry; the moving payload entry reads the layer's per-frame live-position cache; catalog-backed orbit annotation positions are cached in the same one-second matrix update that realigns the orbit primitive. Keyhole edge fade, horizon culling, final collision placement, and UI exclusion are owned by the shared host. Deselect restores the bounded overview, and refresh, disable, and destroy replace or clear both mission sources. @@ -3362,6 +3527,7 @@ silently demoting every later lookup for the session. - **Token flow**: browser fetches a short-lived client secret from `/api/realtime/token`; the Vite middleware holds `OPENAI_API_KEY` and posts the full session config (instructions, tool schemas, VAD, truncation) to `api.openai.com/v1/realtime/client_secrets`. SDP exchange goes directly to `api.openai.com/v1/realtime/calls` with the ephemeral token. - **Session defaults** (env-tunable): model `gpt-realtime-2` (or `gpt-realtime-2.1-mini` when the MINI tier is selected — see the model-tier entry below), voice `marin`, reasoning effort `low`, semantic VAD with low eagerness, no response interruption, context window truncated to ~3,000 post-instruction tokens with 0.5 retention ratio — the conversational window stays short because map state is fetched live per turn. - **Twenty-eight tools** (schemas defined server-side in `vite.config.js`, executed client-side in `src/voice/gevActions.js`): `fly_to_location`, `select_nearest_aircraft`, `adjust_camera_zoom`, `zoom_to_globe`, `set_layer_visibility`, `show_data_layers_menu`, `set_panel_open`, `set_visual_style`, `get_entity_context`, `get_current_view_state`, `set_hud`, `set_detection`, `set_map_stack`, `set_post_processing`, `control_scene`, `control_cctv`, `set_context_mode`, `control_cockpit`, `control_radio`, `track_entity`, `stop_tracking`, `frame_overhead`, `annotate_map`, `clear_annotations`, `move_camera`, `fly_route`, `analyst_query`, and `next_iss_pass`. + > **Reading `npm test` totals:** the count depends on the Node major. The two > GC-bracketed allocation microbenchmarks (`src/data/focusAllocations.test.mjs` > = 1 test, `src/overlays/worldOverlayAllocation.test.mjs` = 13) only RUN on the @@ -3391,15 +3557,15 @@ silently demoting every later lookup for the session. - **Tier selection.** `standard` = `gpt-realtime-2` (default), `mini` = `gpt-realtime-2.1-mini` (~3× cheaper per audio token). The client sends `?tier=` to `/api/realtime/token`; the endpoint resolves it through the shared registry, so an unknown, empty, or hostile value falls back to `standard` rather than reaching OpenAI as a model id. Responses echo `X-GEV-Voice-Tier` / `X-GEV-Voice-Model` (plus `X-GEV-Voice-Tier-Fallback: 1` when a bogus tier was downgraded). Persisted at `godsEyeView.voiceCost.tier`. - **Applies NEXT session.** The model is fixed when the ephemeral token is minted, so a live session always keeps the model it connected with; toggling mid-session only records the preference (the button title says so). The cost tracker's lifetime is the session's lifetime and its model binding is immutable from `start()` to `stop()` — rebuilding it on toggle would erase accrued spend and let repeated toggles bypass the cap. The tracker may only be replaced once the session is FULLY SETTLED (`isVoiceSessionSettled()`: not active **and** no data channel **and** no peer connection) — `!isActive()` alone is not enough, because the `error` status reports inactive while the transport can still deliver a late `response.done`. The toggle itself reads and writes only the persisted preference, never the live tracker. - **Env overrides.** `OPENAI_REALTIME_MODEL` / `OPENAI_REALTIME_MODEL_MINI` remain authoritative per tier, so a drifted upstream model id is a `.env` fix rather than a code change. Because an override can point a tier at any model, the client prices against the model id the server actually echoed, **not** the tier it requested. An unrecognised id is billed at the most expensive known rates plus one console warning — under-metering is what lets a cap be overrun. - - **Metering.** Token usage from each `response.done` is folded into a per-session estimate. Cached tokens are subtracted from their modality totals; any aggregate-minus-details residual (and any payload with no detail at all) is attributed to audio rates, so uncertainty always resolves *upward*. + - **Metering.** Token usage from each `response.done` is folded into a per-session estimate. Cached tokens are subtracted from their modality totals; any aggregate-minus-details residual (and any payload with no detail at all) is attributed to audio rates, so uncertainty always resolves _upward_. - **Thresholds** (one object, persisted at `godsEyeView.voiceCost.limits`): soft warning at **$2** — amber readout plus exactly one console line; hard cap at **$5** — the session ends through the ordinary stop path (data channel and peer connection closed, mic tracks stopped) and the readout reads `Session ended — cost cap`. `0`/negative disables a threshold and round-trips through storage as an `'off'` sentinel (raw `Infinity` would JSON-serialize to `null` and silently restore the default); a corrupt entry falls back to the defaults rather than disarming the cap. - - **Cap semantics — in-flight tools COMPLETE and are NOT rolled back.** A session-ending latch (`isSessionEnding()`) is checked at the tool-dispatch site, so no *new* tool is dispatched once the cap trips. `extractFunctionCalls` yields at most one call per event, so that single check covers the whole batch. A tool already executing may still finish its map mutation (a camera flight, a layer toggle, an annotation). This is deliberate: unwinding a partially applied map change has no safe general implementation, and a half-reverted camera/layer/annotation state is worse than a completed one. + - **Cap semantics — in-flight tools COMPLETE and are NOT rolled back.** A session-ending latch (`isSessionEnding()`) is checked at the tool-dispatch site, so no _new_ tool is dispatched once the cap trips. `extractFunctionCalls` yields at most one call per event, so that single check covers the whole batch. A tool already executing may still finish its map mutation (a camera flight, a layer toggle, an annotation). This is deliberate: unwinding a partially applied map change has no safe general implementation, and a half-reverted camera/layer/annotation state is worse than a completed one. - **In-flight response at teardown → the accounting is INCOMPLETE.** Usage only arrives with `response.done`, which never comes for a response cut off by teardown (`stop()` closes the peer connection, and the server cancels rather than completes it). Rather than invent a token count for it, the tracker is marked `incomplete`: the chip shows a trailing `*` (`~$1.00*`) as a see-note mark and the tooltip carries the reason. Deliberately **not** presented as a lower bound — the estimate can also run high (residuals and unrecognised models bill at worst-case rates, and sub-cent totals round up), so it is partial rather than directional. (A bounded teardown drain was tried and removed: `pc.close()` closes the data channels a drain would listen on, so it was structurally dead.) - **⚠️ Model ids and rates are external facts** read from OpenAI's model + pricing pages on 2026-08-18 and marked VERIFY-AT-RELEASE in `voiceCost.js`. - **Reliability**: tool-call dedupe (2.5s window across call/item/args keys); response-create queueing that respects active responses and defers follow-ups when the user starts speaking; per-tool follow-up instructions so the agent confirms only what actually happened (zoom confirms only on `ok=true`). - **Aircraft identity honesty:** “What is this aircraft?” reads callsign, operator, registration, type, and route only from the selected contact context. Missing operator, route, or type enrichment is named explicitly rather than silently omitted or inferred from the callsign. - **Diagnostics**: every client/server event is posted to `/api/realtime/debug-log` and appended to `.gev-logs/realtime-conversations.jsonl` (gitignored) with secret/image redaction; last 30 errors persist in `localStorage` (`gev-realtime-errors`); `window.__gevVoiceCommands.getDiagnostics()` in the console. -- **Counting semantics ("near")** — a CONTRACT; new count-bearing tool work inherits it. Three honest numbers exist for one question: the Contacts cohort (250 km around the subject, what the panel shows), `analyst_query`'s count of *currently-loaded* records for the requested scope, and the layer-wide loaded total in `coverage.layersQueried[].records`. They diverge legitimately — the flights layer loads by viewport, so after a camera dive the loaded set can hold a fraction of the cohort (field case: panel 42, analyst 8). The contract: +- **Counting semantics ("near")** — a CONTRACT; new count-bearing tool work inherits it. Three honest numbers exist for one question: the Contacts cohort (250 km around the subject, what the panel shows), `analyst_query`'s count of _currently-loaded_ records for the requested scope, and the layer-wide loaded total in `coverage.layersQueried[].records`. They diverge legitimately — the flights layer loads by viewport, so after a camera dive the loaded set can hold a fraction of the cohort (field case: panel 42, analyst 8). The contract: 1. **Contacts ACTIVE** → "near / nearby / how many aircraft" means the **Contacts window** — the panel's numbers, spoken verbatim. Mechanism: `contactsWindow` (`{centeredOn, radiusKm, flights, military, vessels}`), carried by both `analyst_query` and `get_current_view_state`, derived by `contactsWindowFromSnapshot()` from the same snapshot the panel renders so the two cannot drift. A cohort whose feed cannot answer reports `'unknown'`, never a confident zero. 2. **Contacts OFF** → "nearby" means **in view**; "near \" means a radius around that place. A radius query with Contacts active and no explicit centre is centred on the **active contact**, not the camera. 3. **Every count names its scope in words** — "42 in your window", "8 in view", "about 30 within 250 km of Austin" — never a bare number. `analyst_query` returns `scopeLabel` so this is mechanical. Two different numbers with named scopes are not a contradiction. @@ -3674,7 +3840,7 @@ are omitted rather than framing the wrong part of the globe. - **Aircraft course slew:** civilian and military 3D models retain the 60°/s course limiter, but each rendered frame can consume at most 250 ms of accumulated slew time. A long tile/render stall therefore catches up over multiple visible frames instead of turning one delayed frame into a heading snap. - **Manual-first cockpit briefing:** the right-side Live Signals / Regional News / Local Info carousel does not advance automatically on page load. Previous, Next, and direct page controls remain available; the visible `CYCLE OFF` / `CYCLE ON` toggle explicitly starts or stops the nine-second page cycle, which still pauses on hover/focus and while collapsed, hidden, or outside cockpit mode. Live signal data continues refreshing in either state. - **Photoreal horizon blend:** Cesium's sky atmosphere remains enabled behind the hidden base globe, but its light intensity, saturation, and brightness are reduced from the library defaults so the distant Google Photorealistic 3D Tiles boundary blends into the sky instead of producing a bright cyan horizon seam. - - **Cockpit direction and speed tapes:** plausible destination metadata now drives one translucent, isometric visor chevron labeled directly below with the estimated geographic bearing; the prior full geodesic dashed path is not rendered. A mirrored live ground-speed tape follows the inside-left keyhole rim using the same responsive curve, end fades, fixed pointer, and fractional tick motion as the altitude tape on the right. Speed values scroll upward as they increase while altitude values scroll downward. Its tick endpoints and current-speed pointer share the rail's inset-circle origin, so the markings stay attached to the visible curve rather than drifting inward with the text-label gutter. + - **Cockpit direction and speed tapes:** plausible destination metadata now drives one translucent, isometric visor chevron labeled directly below with the estimated geographic bearing; the prior full geodesic dashed path is not rendered. A mirrored live ground-speed tape follows the inside-left keyhole rim using the same responsive curve, end fades, fixed pointer, and fractional tick motion as the altitude tape on the right. Speed values scroll upward as they increase while altitude values scroll downward. Its tick endpoints and current-speed pointer share the rail's inset-circle origin, so the markings stay attached to the visible curve rather than drifting inward with the text-label gutter. - Voice control UI (`#gev-voice-control`) shows status states OFF / CONNECTING / LISTENING / EXECUTING / ERROR. ### Current Global Post Defaults @@ -3917,7 +4083,6 @@ frames. Typing fields, modified keys and key repeats do not toggle it. The readout starts hidden each session and releases its timer and frame listener when hidden or when the application is disposed. - ## Radio components The radio entry composes one layer from directory ingestion, station queries, @@ -3960,3 +4125,55 @@ releases imagery layers/listeners on replacement. Destroy invalidates pending work and releases owned resources, including late factory results. Supplied 3D tilesets remain owned by the caller; tilesets created through the controller's factory are added to its viewer and removed on destruction. + +## Live CCTV integration candidate (#489) + +Daniel Slay's shared-decoder panel/projection feature is adapted to bounded +HTTP(S) HLS. DelDOT uses official HTTPS HLS URLs; RTMP/ffmpeg remux is excluded +because subprocess transport does not inherit the Node redirect policy. Server +sessions reserve synchronously, cap memory and response bytes, reject redirects, +and abort on release/shutdown. No disk store or background sweep exists while +inactive. The panel paints the same video at at most 640px/15 fps; collapse stops +its paint loop. Camera deactivation destroys the decoder, and fatal playback +errors revert to the labeled frame fallback. Camera changes clear the old panel +frame. hls.js is imported only when an HLS camera starts. Two live sessions may +coexist with at most eight independent consumer leases each; no-access lease +expiry is 15 seconds. Closing one consumer leaves other consumers running. Encrypted/fMP4/byte-range playlists fail +closed. Performance and live agency reliability require recorded validation. + +## Wind forecast models + +Wind supports selectable GFS/IFS models with persisted model choice. Each fetch chooses the available cycle and forecast step nearest the current time; rows show both issue and valid UTC timestamps. Grid identities include model, cycle, forecast step and any requested scalar field. The six model/field cache slots each retain the last two issued grids for manifest/grid rollover, coalesce concurrent requests, retain last-good data on failures and retry no faster than once per minute. Model changes clear the old field immediately, cancel old acquisition and ignore superseded results. + +### Local Weather review candidate + +Weather combines the GFS/ECMWF surface forecast with three observation layers: +NOAA Rain radar (CONUS), Satellite clouds (regional GOES or slower global infrared), +and 15-minute lightning density (Americas and Pacific). One transient observed +clock drives all enabled observation rows. Earlier/Later use the sorted union of +non-suspended products' advertised times; each product selects its nearest frame +at or before the requested UTC time, never a future frame or an interpolation. +The maximum gap is 30 minutes for radar, regional infrared and lightning, and +3 hours for hourly global infrared. A missing eligible frame hides that product +and reports the gap; rows show actual displayed UTC time with synced/nearest labels. +Manifest rollover preserves the requested history time, even when frames expire. + +Latest follows each product's own newest frame, so its timestamps can differ. +Playback advances two seconds after all products settle, wraps, and stops with +fewer than two union times or when all products are suspended. Hidden documents, +reduced motion and unavailable imagery hosts suspend products. Re-enabling or +restoring a host joins the retained history target. The wind row explicitly says +“Forecast · does not follow history” while the observed clock is in history mode. +The catalog exposes `weatherClock` and destroys it with its lifetime signal. + +Existing row controls retain source, opacity, coverage navigation and transport; +no controls move in this pass. The viewer clock is untouched. Observation layers +are off by default; share/persist includes appearance and product, while history +is transient and shared links open latest. Rendering retains the previous frame +when an incoming frame fails; no eligible historical frame instead hides imagery. + +Desktop wind now allows 7,200 baked native GPU paths (narrow viewports remain at +1,200). This doubles the maximum desktop geometry budget, not forecast resolution. +Temperature uses stronger fixed −40..50°C colors; the underlying 1° forecast and +numeric inspection values are unchanged. No volumetric cloud height or local rain +arrival prediction is claimed. NOAA source limits are documented in DATA_SOURCES. diff --git a/docs/INFRASTRUCTURE-LAYERS.md b/docs/INFRASTRUCTURE-LAYERS.md index d29e356f9..76567e605 100644 --- a/docs/INFRASTRUCTURE-LAYERS.md +++ b/docs/INFRASTRUCTURE-LAYERS.md @@ -36,7 +36,8 @@ const layers = createInfrastructureLayers({ | `governorRequestRender` | `(reason)`; request a frame through the existing render scheduler | Each returned layer supports `init(viewer)`, `enable(viewer)`, `disable(viewer)`, -`update(viewer)`, `destroy(viewer)`, `getStats()` and `getLodDiagnostics()`. +`update(viewer)`, `destroy(viewer)`, `getStats()`, `getLodDiagnostics()` and +`getAnalystRecords()`. Use the same viewer for the instance's entire lifetime. Each viewer/context/overlay host permits one live instance per layer ID; destroy an old instance before replacing it. Separate applications may use identical IDs with separate hosts. diff --git a/package-lock.json b/package-lock.json index c24590e4a..d98116fb4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,8 +10,10 @@ "license": "MIT", "dependencies": { "@mapbox/vector-tile": "^3.0.0", + "@meri-imperiumi/eccodes-wasm": "^2.48.2", "cesium": "^1.124.0", "egm96-universal": "^1.1.1", + "hls.js": "^1.7.3", "mgrs": "^2.1.0", "pbf": "^5.1.2", "satellite.js": "^6.0.2" @@ -1076,6 +1078,24 @@ "pbf": "^5.0.0" } }, + "node_modules/@meri-imperiumi/eccodes-wasm": { + "version": "2.48.2", + "resolved": "https://registry.npmjs.org/@meri-imperiumi/eccodes-wasm/-/eccodes-wasm-2.48.2.tgz", + "integrity": "sha512-Z7rD3xInomPG7FS97ORD1UGKAdgeeRP9ofa9k4m8d+k2sDfDQeAjTzvs9UOndyaZovaSbEQeIoNX8gTmQNhiSA==", + "cpu": [ + "x64", + "arm64" + ], + "license": "Apache-2.0", + "os": [ + "darwin", + "linux", + "win32" + ], + "engines": { + "node": ">=24.0.0" + } + }, "node_modules/@puppeteer/browsers": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-3.2.2.tgz", @@ -1944,6 +1964,12 @@ "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", "license": "MIT" }, + "node_modules/hls.js": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/hls.js/-/hls.js-1.7.3.tgz", + "integrity": "sha512-MsPlx6yVW4Qv4C7mEVou4/gk/5cN2dVxOTnrNjPSmyH2f0Ln+/UkG10Ax1PE6OvrmTVPKgQYozTtBaPOuCzq7A==", + "license": "Apache-2.0" + }, "node_modules/http-errors": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", diff --git a/package.json b/package.json index 809841ba2..3dd681f41 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "gods-eye-view", "private": true, "version": "0.1.1", - "description": "A real-time intelligence console for planet Earth \u2014 photorealistic 3D globe, live aircraft/ships/satellites/earthquakes/CCTV, and hands-free voice control. Runs in a browser.", + "description": "A real-time intelligence console for planet Earth — photorealistic 3D globe, live aircraft/ships/satellites/earthquakes/CCTV, and hands-free voice control. Runs in a browser.", "type": "module", "license": "MIT", "author": "Bilawal Sidhu", @@ -48,8 +48,10 @@ }, "dependencies": { "@mapbox/vector-tile": "^3.0.0", + "@meri-imperiumi/eccodes-wasm": "^2.48.2", "cesium": "^1.124.0", "egm96-universal": "^1.1.1", + "hls.js": "^1.7.3", "mgrs": "^2.1.0", "pbf": "^5.1.2", "satellite.js": "^6.0.2" diff --git a/scripts/format-scope.json b/scripts/format-scope.json index 2ed4f1081..6439aca8e 100644 --- a/scripts/format-scope.json +++ b/scripts/format-scope.json @@ -383,6 +383,10 @@ "src/layers/launches/model.js", "src/layers/launches/selection.js", "src/layers/launches/camera.js", + "src/data/localGeojson.analyst.test.mjs", + "src/data/satellites.analyst.test.mjs", + "src/data/layerSnapshot.test.mjs", + "src/data/satellitePass.test.mjs", "src/data/satellites.js", "src/data/rocketLaunches.js", "src/layers/satellites/source.test.mjs", @@ -730,6 +734,27 @@ "scripts/format-runtime.json", "src/tooling/transitService.test.mjs", "src/sources/overpassFeatures.test.mjs", + "src/data/cctvHlsStream.test.mjs", + "src/layers/cctv/videoPlayback.test.mjs", + "src/ui/cctvVideo.test.mjs", + "src/ui/styles/weather.css", + "src/layers/weather/index.js", + "src/layers/weather/clock.js", + "src/layers/weather/clock.test.mjs", + "src/layers/weather/rendering.js", + "src/layers/weather/shellRendering.js", + "src/layers/weather/shellRendering.test.mjs", + "src/layers/weather/infraredAlpha.js", + "src/layers/weather/infraredAlpha.test.mjs", + "src/layers/weather/infraredImage.js", + "src/layers/weather/infraredImage.test.mjs", + "src/layers/weather/source.js", + "src/layers/weather/weather.test.mjs", + "src/layers/weather/rasterTiles.test.mjs", + "src/layers/wind/rendering.test.mjs", + "src/layers/weather/source.test.mjs", + "src/data/weatherProxy.test.mjs", + "server/providers/weather.js", "src/director/clock.test.mjs", "src/director/timeline.test.mjs", "src/scenes/packs/registry.test.mjs", @@ -745,5 +770,28 @@ "scripts/qa-director-interactions.mjs", "src/director/sharing/sharing.test.mjs", "scripts/qa-director-sharing.mjs", - "src/data/aisStreamSentinels.test.mjs" + "src/ui/weatherPanel.js", + "src/ui/weatherPanel.test.mjs", + "src/ui/railCards.js", + "src/ui/railCards.test.mjs", + "src/ui/railTimeline.js", + "src/ui/railTimeline.test.mjs", + "src/layers/weather/imageryOrder.js", + "src/layers/weather/imageryOrder.test.mjs", + "server/providers/cyclones.js", + "src/data/cyclonesProxy.test.mjs", + "src/layers/cyclones/index.js", + "src/layers/cyclones/rendering.js", + "src/layers/cyclones/labels.js", + "src/layers/cyclones/source.js", + "src/layers/cyclones/rendering.test.mjs", + "src/layers/cyclones/labels.test.mjs", + "src/layers/cyclones/index.test.mjs", + "src/layers/cyclones/source.test.mjs", + "src/data/aisStreamSentinels.test.mjs", + "scripts/qa-weather-perf.mjs", + "scripts/qa-weather-journey.mjs", + "scripts/qa-weather-swap.mjs", + "scripts/qa-weather-teardown.mjs", + "src/layers/weather/imageryHost.test.mjs" ] diff --git a/scripts/package-boundaries.json b/scripts/package-boundaries.json index 433f5f36a..a2e1d9519 100644 --- a/scripts/package-boundaries.json +++ b/scripts/package-boundaries.json @@ -161,6 +161,7 @@ "server/providers/cctv/normalize.js", "server/providers/cctv/range.js", "server/providers/cctv/sources.js", + "server/providers/cctv/stream.js", "server/providers/common/http.js", "src/data/directionText.js", "server/providers/common/geo.js", @@ -268,6 +269,10 @@ "server/providers/openai/realtime.js", "server/providers/openai/tools.js", "src/hudSummaryResponse.js", + "src/data/layerSnapshot.js", + "src/data/feedState.js", + "src/loadingFeedback.js", + "src/data/installationFeedback.js", "src/voice/voiceCost.js", "src/voice/actionSchemas.js", "server/providers/openai/toolDescriptions.js", @@ -375,11 +380,18 @@ "modules": [ "src/ui/layers.js", "src/ui/layerPanel.js", + "src/ui/weatherPanel.js", + "src/ui/railCards.js", + "src/ui/railCardBlocks.js", + "src/ui/chipGroup.js", + "src/ui/rowList.js", + "src/ui/railTimeline.js", "src/ui/clearLayersControl.js", "src/loadingFeedback.js", "src/data/installationFeedback.js", "src/keySetupCore.mjs", - "src/data/feedState.js" + "src/data/feedState.js", + "src/data/layerSnapshot.js" ], "external": [] }, @@ -413,6 +425,7 @@ "src/ui/cctvCalibration.js", "src/ui/cctvControls.js", "src/ui/cctvFrames.js", + "src/ui/cctvVideo.js", "src/ui/cctvPresentation.js" ], "external": [] @@ -513,6 +526,7 @@ "src/ui/cctvCalibration.js", "src/ui/cctvControls.js", "src/ui/cctvFrames.js", + "src/ui/cctvVideo.js", "src/ui/cctvPresentation.js", "src/ui/clearLayersControl.js", "src/ui/cockpit.js", @@ -540,6 +554,12 @@ "src/ui/effects.js", "src/ui/frameRateMonitor.js", "src/ui/layerPanel.js", + "src/ui/weatherPanel.js", + "src/ui/railCards.js", + "src/ui/railCardBlocks.js", + "src/ui/chipGroup.js", + "src/ui/rowList.js", + "src/ui/railTimeline.js", "src/ui/layers.js", "src/ui/leftPanelRail.js", "src/ui/location.js", @@ -577,7 +597,9 @@ "src/ui/visualSettings.js", "src/worldFocus.js", "src/data/feedState.js", + "src/data/layerSnapshot.js", "src/ui/aircraftDisplay.js", + "src/layers/weather/imageryHost.js", "src/ui/layerBindings.js", "src/ui/displayBindings.js", "src/ui/shellFacade.js" @@ -608,7 +630,8 @@ "src/ui/styles/command-dock-sliding.css", "src/ui/styles/voice-cost.css", "src/ui/styles/first-run.css", - "src/ui/styles/provider-settings.css" + "src/ui/styles/provider-settings.css", + "src/ui/styles/weather.css" ], "external": [] }, @@ -856,6 +879,7 @@ "modules": [ "src/data/issPass.js", "src/data/satelliteClass.js", + "src/data/satellitePass.js", "src/layers/satellites/catalog.js", "src/layers/satellites/controls.js", "src/layers/satellites/index.js", @@ -864,6 +888,7 @@ "src/layers/satellites/labels.js", "src/layers/satellites/lifecycle.js", "src/layers/satellites/orbits.js", + "src/layers/satellites/records.js", "src/layers/satellites/policy.js", "src/layers/satellites/rendering.js", "src/layers/satellites/source.js", @@ -1025,6 +1050,7 @@ "src/layers/cctv/policy.js", "src/layers/cctv/presentation.js", "src/layers/cctv/projection.js", + "src/layers/cctv/videoPlayback.js", "src/layers/cctv/rendering.js", "src/layers/cctv/selection.js", "src/layers/cctv/source.js", @@ -1035,7 +1061,7 @@ "src/data/inputOwnership.js", "src/layers/cctv/sourcePolicy.js" ], - "external": ["cesium"] + "external": ["hls.js", "cesium"] }, "alpr-cameras": { "exports": ["./layers/alpr"], @@ -1279,6 +1305,19 @@ "src/data/contactMatch.js", "src/data/contextStore.js", "src/data/dataCredits.js", + "src/data/wind.js", + "src/layers/wind/index.js", + "src/layers/wind/model.js", + "src/layers/wind/fields.js", + "src/layers/wind/streamlines.js", + "src/layers/wind/gpuRendering.js", + "src/layers/wind/relief.js", + "src/layers/wind/inspection.js", + "src/layers/wind/presentation.js", + "src/layers/wind/rendering.js", + "src/layers/weather/rasterTiles.js", + "src/layers/wind/source.js", + "src/sources/windBody.js", "src/data/detection.js", "src/data/detectionCohort.js", "src/data/detectionDraw.js", @@ -1332,6 +1371,7 @@ "src/data/rocketLaunches.js", "src/data/routePlausible.js", "src/data/satelliteClass.js", + "src/data/satellitePass.js", "src/data/satellites.js", "src/data/scenePick.js", "src/data/spriteOrder.js", @@ -1414,6 +1454,7 @@ "src/layers/cctv/policy.js", "src/layers/cctv/presentation.js", "src/layers/cctv/projection.js", + "src/layers/cctv/videoPlayback.js", "src/layers/cctv/rendering.js", "src/layers/cctv/selection.js", "src/layers/cctv/source.js", @@ -1519,6 +1560,7 @@ "src/layers/satellites/labels.js", "src/layers/satellites/lifecycle.js", "src/layers/satellites/orbits.js", + "src/layers/satellites/records.js", "src/layers/satellites/policy.js", "src/layers/satellites/rendering.js", "src/layers/satellites/source.js", @@ -1629,6 +1671,7 @@ "src/ui/cctvCalibration.js", "src/ui/cctvControls.js", "src/ui/cctvFrames.js", + "src/ui/cctvVideo.js", "src/ui/cctvPresentation.js", "src/ui/clearLayersControl.js", "src/ui/cockpit.js", @@ -1657,6 +1700,12 @@ "src/ui/effects.js", "src/ui/frameRateMonitor.js", "src/ui/layerPanel.js", + "src/ui/weatherPanel.js", + "src/ui/railCards.js", + "src/ui/railCardBlocks.js", + "src/ui/chipGroup.js", + "src/ui/rowList.js", + "src/ui/railTimeline.js", "src/ui/layers.js", "src/ui/leftPanelRail.js", "src/ui/location.js", @@ -1727,6 +1776,7 @@ "src/voice/realtimeEvents.js", "src/app/localGeojsonServices.js", "src/data/feedState.js", + "src/data/layerSnapshot.js", "src/layers/alpr/records.js", "src/layers/earthquakes/records.js", "src/layers/cctv/sourcePolicy.js", @@ -1782,6 +1832,13 @@ "src/voice/realtimeRadio.js", "src/voice/realtimeTurns.js", "src/voice/realtimeConnection.js", + "src/layers/weather/index.js", + "src/layers/weather/clock.js", + "src/layers/weather/rendering.js", + "src/layers/weather/shellRendering.js", + "src/layers/weather/infraredAlpha.js", + "src/layers/weather/infraredImage.js", + "src/layers/weather/source.js", "src/director/clock.js", "src/director/timeline.js", "src/scenes/shotPresentation.js", @@ -1809,9 +1866,16 @@ "src/director/sharing/lifetime.js", "src/director/authoring.js", "src/scenes/sharing.js", - "src/ui/sceneSharing.js" + "src/ui/sceneSharing.js", + "src/layers/weather/imageryOrder.js", + "src/layers/weather/imageryHost.js", + "src/layers/cyclones/index.js", + "src/layers/cyclones/rendering.js", + "src/layers/cyclones/labels.js", + "src/layers/cyclones/source.js" ], "external": [ + "hls.js", "@mapbox/vector-tile", "cesium", "egm96-universal", @@ -1838,6 +1902,16 @@ "src/annotations/resolver.js", "src/app/catalog.js", "src/app/constructCatalog.js", + "src/layers/wind/index.js", + "src/layers/wind/model.js", + "src/layers/wind/fields.js", + "src/layers/wind/streamlines.js", + "src/layers/wind/gpuRendering.js", + "src/layers/wind/relief.js", + "src/layers/wind/inspection.js", + "src/layers/wind/presentation.js", + "src/layers/wind/rendering.js", + "src/layers/weather/rasterTiles.js", "src/app/layers/aisLiveVessels.js", "src/app/layers/alprCameras.js", "src/app/layers/bikeshare.js", @@ -1885,6 +1959,7 @@ "src/data/infrastructure.js", "src/data/installationFeedback.js", "src/data/issPass.js", + "src/data/satellitePass.js", "src/data/labelArbiter.js", "src/data/layerState.js", "src/data/localGeojson.js", @@ -1976,6 +2051,7 @@ "src/layers/cctv/policy.js", "src/layers/cctv/presentation.js", "src/layers/cctv/projection.js", + "src/layers/cctv/videoPlayback.js", "src/layers/cctv/rendering.js", "src/layers/cctv/selection.js", "src/layers/cctv/source.js", @@ -2081,6 +2157,7 @@ "src/layers/satellites/labels.js", "src/layers/satellites/lifecycle.js", "src/layers/satellites/orbits.js", + "src/layers/satellites/records.js", "src/layers/satellites/policy.js", "src/layers/satellites/rendering.js", "src/layers/satellites/source.js", @@ -2203,9 +2280,23 @@ "src/sources/overpassFeaturesRecords.js", "src/sources/overpassFeatures.js", "src/sources/featureSource.js", - "src/sources/overpassRoads.js" + "src/sources/overpassRoads.js", + "src/layers/weather/index.js", + "src/layers/weather/clock.js", + "src/layers/weather/rendering.js", + "src/layers/weather/shellRendering.js", + "src/layers/weather/infraredAlpha.js", + "src/layers/weather/infraredImage.js", + "src/layers/weather/source.js", + "src/layers/weather/imageryOrder.js", + "src/layers/weather/imageryHost.js", + "src/layers/cyclones/index.js", + "src/layers/cyclones/rendering.js", + "src/layers/cyclones/labels.js", + "src/layers/cyclones/source.js" ], "external": [ + "hls.js", "cesium", "egm96-universal", "satellite.js", diff --git a/scripts/qa-layer-panel.mjs b/scripts/qa-layer-panel.mjs index 453009929..1282c6b50 100644 --- a/scripts/qa-layer-panel.mjs +++ b/scripts/qa-layer-panel.mjs @@ -23,13 +23,17 @@ try { `${process.env.QA_BASE_URL || 'http://localhost:4173'}/?welcome=0`, { waitUntil: 'domcontentloaded' }, ); - await page.waitForFunction( - () => window.__godsEyeView?.dataManager?._layerPanel, - { timeout: 60000 }, - ); + await page.waitForFunction(() => window.__godsEyeView?.dataManager, { + timeout: 60000, + }); const results = await page.evaluate(async () => { const manager = window.__godsEyeView.dataManager; - const container = manager._toggleContainer; + const entry = document.querySelector( + 'script[type="module"][src*="/src/main.js"]', + ); + const { application } = await import(entry.src); + const { presentation } = application.getComponents().data; + const container = presentation.panel._toggleContainer; const id = 'qa-panel-lifecycle'; let listener = null; let enabled = 0; @@ -54,7 +58,7 @@ try { }); const result = []; try { - manager.buildTogglePanel(container); + presentation.mount(container); const row = () => container.querySelector(`[data-layer-id="${id}"]`); const first = row().querySelector('.data-toggle-btn'); result.push([ @@ -66,7 +70,7 @@ try { 'row subscription is installed', typeof listener === 'function', ]); - manager.buildTogglePanel(container); + presentation.mount(container); first.click(); await Promise.resolve(); result.push([ @@ -97,7 +101,7 @@ try { ]); await manager.setEnabled(id, true); const final = row().querySelector('.data-toggle-btn'); - manager._layerPanel.destroy(); + presentation._panel.destroy(); final.click(); await Promise.resolve(); result.push([ @@ -109,10 +113,10 @@ try { manager.isEnabled(id), ]); } finally { - manager._layerPanel?.destroy(); - manager._layerPanel = null; + presentation._panel?.destroy(); + presentation._panel = null; await window.__gevQaUnregisterLayer(manager, id); - manager.buildTogglePanel(container); + presentation.mount(container); } result.push([ 'ordinary layer rows return after reassembly', diff --git a/scripts/qa-weather-journey.mjs b/scripts/qa-weather-journey.mjs new file mode 100644 index 000000000..75cd2c269 --- /dev/null +++ b/scripts/qa-weather-journey.mjs @@ -0,0 +1,423 @@ +#!/usr/bin/env node +/** + * qa-weather-journey — drive the Weather layers the way a person would and + * keep the evidence: numbered screenshots plus per-step layer diagnostics. + * + * Starts at the Earth view, opens Data Layers, switches Wind on from its real + * row button, cycles the wind fields/models, switches radar, satellite clouds, + * lightning and cyclones on, follows "View storm" and "View US radar", zooms + * into a regional view, a city view and a street view, replays history, and + * ends with real wheel/drag input. Every step records the enabled layers' + * diagnostics (imagery tiles loaded, shown observation time, wind geometry) + * and a 2 s `scene.postRender` count so a stalled renderer cannot pass as a + * healthy screenshot. + * + * Usage: + * node scripts/qa-weather-journey.mjs [--url http://localhost:4173] + * [--label google] [--headless] [--out qa-shots/weather-journey] + * + * Requires a running dev server. Screenshots and steps.json land in + * /