Delete dead render code and consolidate QA helpers

Remove code that nothing in the app, the runners or CI uses:
- the one-off migration compare, look and bench scripts and the vector
  ground prototype they measured, with the bench tables in the docs;
- the unused Navara-named shared render modules (polygons, ground picks,
  mover bank, ground ring);
- the Cesium-shaped aircraft and vessel test renderers, and the trail,
  engineFromViewer and horizon-occluder helpers only they kept alive.
  Their tests now run on the production displays over the fake engine;
- Navara's unread diagnostics, fallback ports, dead exports and
  parameters, stale effect-chain anchors and the unread capability flags.

The QA scripts share one keyless guard and readiness wait, the session
harness reuses the strict harness's browser flags and block list, and the
harness honours QA_ANGLE and QA_RESERVED_PORTS. The bikeshare fixture
keeps only what its scenario reads. The docs name the engine picker where
it is (VISUAL PRESETS) and drop dated run results.

No behaviour changes on either engine. Navara layer renderer lines fall
from 189 to 0 and viewer lines from 891 to 849.
This commit is contained in:
German Khokhlov committed 2026-11-08 17:05:38 +04:00
1 parent 18f69c2699
commit 371d848eec
130 files changed
+633 -4542

No files matched your search

+14 -194
View File
@@ -1,25 +1,7 @@
import { cameras as alprCameras, cameraTile } from './alpr.mjs';
import { cameras as cctvCameras, cameraFrame } from './cctv.mjs';
import { stations as radioStations } from './radio.mjs';
import { earthquakePerformanceFixture } from './earthquakes.mjs';
export const COMBINED_EPOCH = Date.parse('2026-10-28T18:00:00Z');
export const COMBINED_ORIGIN = { lat: 42.3554, lon: -71.0605 };
const ORIGIN = { lat: 42.3554, lon: -71.0605 };
const grid = (i, cols, spacing) => ({
lat: COMBINED_ORIGIN.lat + (Math.floor(i / cols) - cols / 2) * spacing,
lon: COMBINED_ORIGIN.lon + ((i % cols) - cols / 2) * spacing,
});
const radio = radioStations.map((r, i) => ({ ...r, ...grid(i, 28, 0.001) }));
const cctv = cctvCameras.map((r, i) => ({
...r,
...grid(i, 5, 0.002),
cityId: 'boston',
city: 'Boston',
groundElevationM: 20,
}));
const alpr = alprCameras.map((r, i) => {
const p = grid(i, 19, 0.001);
return { ...r, latitude: p.lat, longitude: p.lon };
lat: ORIGIN.lat + (Math.floor(i / cols) - cols / 2) * spacing,
lon: ORIGIN.lon + ((i % cols) - cols / 2) * spacing,
});
const bikes = Array.from({ length: 200 }, (_, i) => ({
station_id: `w2-bike-${i}`,
@@ -27,154 +9,24 @@ const bikes = Array.from({ length: 200 }, (_, i) => ({
capacity: 20,
...grid(i, 15, 0.0015),
}));
const earthquakes = earthquakePerformanceFixture(500);
earthquakes.features = earthquakes.features.map((r, i) => {
const p = grid(i, 23, 0.002);
return {
...r,
properties: { ...r.properties, time: COMBINED_EPOCH - 3600000 },
geometry:
i < 5 ? { ...r.geometry, coordinates: [p.lon, p.lat, 5] } : r.geometry,
};
});
const fires = Array.from({ length: 6000 }, (_, i) => ({
...grid(i, 78, 0.001),
frp: 5 + (i % 120),
confidence: ['low', 'nominal', 'high'][i % 3],
brightness: 280 + (i % 90),
daynight: i % 2 ? 'N' : 'D',
acqDate: '2026-10-28',
acqTime: '1730',
instrument: 'VIIRS',
satellite: 'NOAA-20',
}));
const elements = Array.from({ length: 20 }, (_, i) => {
const p = grid(i, 5, 0.006),
d = 0.0007;
return {
type: 'way',
id: 980000 + i,
center: p,
tags: { military: 'airfield', name: `W2 facility ${i}` },
bounds: {
minlat: p.lat - d,
minlon: p.lon - d,
maxlat: p.lat + d,
maxlon: p.lon + d,
},
geometry: [
[p.lon - d, p.lat - d],
[p.lon + d, p.lat - d],
[p.lon + d, p.lat + d],
[p.lon - d, p.lat + d],
[p.lon - d, p.lat - d],
].map(([lon, lat]) => ({ lon, lat })),
};
});
export const combinedPayloads = {
radio,
cctv,
alpr,
bikes,
earthquakes,
fires,
elements,
};
export const combinedPayloads = { bikes };
/** One source transport fixture, shared unchanged by both engines. */
export async function installCombinedFixture(
page,
{ denseQuakes = false } = {},
) {
const quakePayload = denseQuakes
? {
...earthquakes,
features: earthquakes.features.map((r, i) => {
const p = grid(i, 23, 0.002);
return {
...r,
geometry: { ...r.geometry, coordinates: [p.lon, p.lat, 5] },
};
}),
}
: earthquakes;
const frame = await cameraFrame(),
requests = [];
/** Bikeshare and startup feed fixtures shared by both engines. */
export async function installCombinedFixture(page) {
const requests = [];
const session = await page.createCDPSession();
await session.send('Fetch.enable', {
patterns: [
...['127.0.0.1', 'localhost'].map((host) => ({
urlPattern: `http://${host}:*/api/*`,
})),
{ urlPattern: 'https://earthquake.usgs.gov/*all_day.geojson' },
{ urlPattern: 'https://tiles.dontgetflocked.com/*' },
{ urlPattern: '*://*.earthdata.nasa.gov/*' },
],
patterns: ['127.0.0.1', 'localhost'].map((host) => ({
urlPattern: `http://${host}:*/api/*`,
})),
});
let disposed = false;
session.on('Fetch.requestPaused', async (event) => {
try {
const u = new URL(event.request.url);
let body,
type = 'application/json';
let body;
const p = u.pathname;
if (u.hostname === 'earthquake.usgs.gov') body = quakePayload;
else if (u.hostname === 'tiles.dontgetflocked.com') {
if (p.endsWith('.json'))
body = {
tiles: [
'https://tiles.dontgetflocked.com/cameras-us-hourly/{z}/{x}/{y}.mvt',
],
bounds: [-160, 17, -64, 59],
};
else {
const m = p.match(/\/(\d+)\/(\d+)\/(\d+)\.mvt$/);
body = m
? cameraTile(...m.slice(1).map(Number), alpr)
: Buffer.alloc(0);
type = 'application/x-protobuf';
}
} else if (u.hostname === 'cmr.earthdata.nasa.gov')
body = {
hits: 2,
items: ['2026-10-28', '2026-10-27'].map((day) => ({
umm: {
TemporalExtent: {
RangeDateTime: { BeginningDateTime: `${day}T12:00:00Z` },
},
AdditionalAttributes: [{ Name: 'CLOUD_COVERAGE', Values: ['0'] }],
SpatialExtent: {
HorizontalSpatialDomain: {
Geometry: {
BoundingRectangles: [
{
WestBoundingCoordinate: -72,
EastBoundingCoordinate: -70,
SouthBoundingCoordinate: 41,
NorthBoundingCoordinate: 43,
},
],
},
},
},
},
})),
};
else if (u.hostname.endsWith('.earthdata.nasa.gov')) {
body = frame;
type = 'image/png';
} else if (p === '/api/firms')
body = { fires, fetchedAt: COMBINED_EPOCH - 120000, stale: false };
else if (p === '/api/radio/stations')
body = {
stations: radio,
updatedAt: new Date(COMBINED_EPOCH).toISOString(),
stale: false,
degraded: false,
acceptedGeneration: 1,
catalogInstance: 'w2-combined-fixture',
};
else if (p.startsWith('/api/gbfs/'))
if (p.startsWith('/api/gbfs/'))
body = {
version: '3.0',
data: {
@@ -189,40 +41,11 @@ export async function installCombinedFixture(
})),
},
};
else if (p === '/api/military-installations')
body = {
status: 'ready',
retrievedAt: new Date(COMBINED_EPOCH).toISOString(),
saturated: false,
elements,
};
else if (p === '/api/cctv/sources') body = { sources: cctv };
else if (p === '/api/cctv/health')
body = {
cameras: cctv.map(({ id }) => ({
id,
status: 'online',
sourceKind: 'image',
updatedAt: COMBINED_EPOCH,
})),
};
else if (p.startsWith('/api/cctv/frame/')) {
body = frame;
type = 'image/png';
} else if (p.startsWith('/api/transit/'))
body = {
fetchedAt: COMBINED_EPOCH,
vehicles: [],
fixes: [],
epochs: [],
};
else if (p === '/api/flights') body = { states: [] };
else if (p === '/api/military') body = { ac: [] };
else if (p === '/api/vessels') body = { connected: false, vessels: [] };
else if (p === '/api/google/nearby-places') body = { places: [] };
else if (p === '/api/setup/status') body = { ready: true };
else if (p === '/api/openai/hud-summary')
body = { summary: 'W2 performance fixture' };
else if (p === '/api/terrain/heights')
body = {
results: (u.searchParams.get('points') || '')
@@ -244,15 +67,12 @@ export async function installCombinedFixture(
requestId: event.requestId,
responseCode: 200,
responseHeaders: [
{ name: 'Content-Type', value: type },
{ name: 'Content-Type', value: 'application/json' },
{ name: 'Access-Control-Allow-Origin', value: '*' },
{ name: 'Access-Control-Expose-Headers', value: 'Data-Present' },
{ name: 'Data-Present', value: 'true' },
],
body: (Buffer.isBuffer(body)
? body
: Buffer.from(JSON.stringify(body))
).toString('base64'),
body: Buffer.from(JSON.stringify(body)).toString('base64'),
});
} catch (error) {
if (
-83
View File
@@ -1,83 +0,0 @@
// USGS-shaped fixed observations; source parsers remain the production ones.
export const W2_EPOCH_MS = 1792152000000;
export function earthquakeFixture() {
const features = [];
for (const [region, lon, lat] of [
['sf', -122.42, 37.77],
['austin', -97.74, 30.27],
['alaska', -150.4, 61.0],
]) {
for (let i = 0; i < 5; i++) {
features.push({
type: 'Feature',
id: `qa-${region}-${i}`,
geometry: {
type: 'Point',
coordinates: [
lon + (i - 2) * 0.24,
lat + (i % 2) * 0.3,
[8, 70, 300, 301, 45][i],
],
},
properties: {
mag: [2.5, 3, 4, 5, 5.5][i],
place: `W2 ${region} event ${i}`,
time: W2_EPOCH_MS - i * 60000,
},
});
}
}
features.push({
type: 'Feature',
id: 'qa-below',
geometry: { type: 'Point', coordinates: [-122.42, 37.77, 5] },
properties: { mag: 2.4 },
});
features.push({
type: 'Feature',
id: 'qa-missing-mag',
geometry: { type: 'Point', coordinates: [-122.4, 37.7, 5] },
properties: { mag: null },
});
return {
type: 'FeatureCollection',
metadata: { generated: W2_EPOCH_MS },
features,
};
}
/** Dense regional and worldwide USGS-shaped load, separate from the oracle. */
export function earthquakePerformanceFixture(count = 500) {
let seed = 17;
const random = () => {
seed = (Math.imul(seed, 1664525) + 1013904223) >>> 0;
return seed / 4294967296;
};
return {
type: 'FeatureCollection',
features: Array.from({ length: count }, (_, i) => ({
type: 'Feature',
id: `perf-quake-${i}`,
properties: {
mag: 2.5 + (i % 7) * 0.5,
place: `Recorded performance event ${i}`,
time: W2_EPOCH_MS - i * 1000,
},
geometry: {
type: 'Point',
coordinates:
i < Math.min(100, count)
? [
-122.42 + (random() - 0.5),
37.77 + (random() - 0.5),
[8, 70, 301][i % 3],
]
: [
-180 + random() * 360,
-70 + random() * 140,
[8, 70, 301][i % 3],
],
},
})),
};
}