mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
test(qa): an engine-neutral layer probe
- src/app/qaProbe.js → window.__godsEyeView.layers: list() (with
`available`), unavailable(), available(id), enable/disable(id) (a user
toggle through the layer manager), objects(id) → [{ id, label, position,
screen }], screenOf(id, objectId), selected(id), following(), movers(),
framesDrawn() - all through the engine and the catalog's availability, the
same on Cesium and Navara. Installed after the tools.
- src/app/layers/qaSources.js: `?qaFeed=flights:synthetic:10000,
vessels:fixture` (dev server only, allowQaRegistration) replaces those
sources with seeded synthetic answers served through the live sources'
own parsers (same snapshot shape; loaded with import() only then). The
pure generators moved from src/tooling/w1Feeds.js to src/bench/w1Feeds.js
(the browser graph may not reach src/tooling); the W1 recordings
re-export them.
- scripts/qa-w1-layers.mjs: the parity checklist's frame, --layer
--engine=cesium|navara with the fixture feeds, JSON per run and
--compare (objects on screen per pose, 5 known objects within 2 px).
Filled: 1 view, 8 idle, 9 errors/no leftover mover sets after 10
on/off; 2-7 report TODO for the layer tasks.
- qa-perf, qa-labels, qa-overlay-baseline and qa-label-readability take
--engine= and use the engine (camera, frames, render requests, tiles) and
the probe (layers, following, movers) instead of the viewer; checks whose
layers an engine lacks are SKIPPED with the reason (Navara today), as are
qa-perf's animated-style checks there (Cesium post stages).
Verdicts, Cesium, before → after: qa-perf 24/24 → 24/24, qa-labels 14/14 →
14/14, qa-overlay-baseline (datacenters, firms, detection-50) 2 measured +
1 skipped → the same. Navara: qa-perf 14 passed, 3 skipped; qa-labels 3/3,
1 skipped; qa-overlay-baseline 3 skipped; qa-w1-layers flights: Cesium 5/5
(10 000 synthetic aircraft), Navara skipped (no flights renderer yet).
This commit is contained in:
1 parent
834d34296f
commit
ec7dcc944e
11 files changed
+754
-126
No files matched your search
@@ -0,0 +1,162 @@
|
||||
// Seeded synthetic feed answers: the global /api/flights snapshot (OpenSky
|
||||
// states), 12 000 AIS vessels on /api/vessels (with and without an area) and
|
||||
// the local receivers' 1090 MHz and 978 MHz UAT aircraft near JFK, timed
|
||||
// relative to one instant, so every run sees the same objects at the same
|
||||
// places. Pure: Node and browser, no I/O. Used by the W1 baseline recordings
|
||||
// (src/tooling/w1Feeds.js) and the app's QA fixture sources
|
||||
// (src/app/layers/qaSources.js).
|
||||
|
||||
import { createSyntheticFlights } from './syntheticFlights.js';
|
||||
|
||||
/** The replay clock of the synthetic recordings: 2026-10-16T12:00:00Z. */
|
||||
export const W1_FROZEN_MS = Date.UTC(2026, 9, 16, 12);
|
||||
const JFK = { lat: 40.64, lng: -73.78 };
|
||||
|
||||
/** Small deterministic PRNG (as syntheticFlights). */
|
||||
function mulberry32(seed) {
|
||||
let state = seed >>> 0;
|
||||
return () => {
|
||||
state = (state + 0x6d2b79f5) >>> 0;
|
||||
let t = state;
|
||||
t = Math.imul(t ^ (t >>> 15), t | 1);
|
||||
t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
|
||||
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
||||
};
|
||||
}
|
||||
|
||||
const hex = (value, digits) => value.toString(16).padStart(digits, '0');
|
||||
|
||||
/** An OpenSky states payload: `count` aircraft, 2 000 of them near JFK. */
|
||||
export function syntheticFlights({
|
||||
nowMs = W1_FROZEN_MS,
|
||||
count = 8_000,
|
||||
seed = 11,
|
||||
} = {}) {
|
||||
const fleet = createSyntheticFlights({
|
||||
count,
|
||||
seed,
|
||||
near: { ...JFK, radiusM: 60_000, count: Math.min(2_000, count) },
|
||||
});
|
||||
const random = mulberry32(seed + 1);
|
||||
const nowSec = Math.floor(nowMs / 1000);
|
||||
const states = [];
|
||||
for (let index = 0; index < count; index++) {
|
||||
const age = Math.floor(random() * 10);
|
||||
states.push([
|
||||
hex(0xa00000 + index, 6),
|
||||
`GEV${String(index).padStart(4, '0')}`,
|
||||
'United States',
|
||||
nowSec - age,
|
||||
nowSec - Math.min(age, 2),
|
||||
Number(fleet.lon[index].toFixed(5)),
|
||||
Number(fleet.lat[index].toFixed(5)),
|
||||
Math.round(fleet.alt[index]),
|
||||
false,
|
||||
Number(fleet.speed[index].toFixed(1)),
|
||||
Number(fleet.heading[index].toFixed(1)),
|
||||
0,
|
||||
null,
|
||||
Math.round(fleet.alt[index]) + 30,
|
||||
null,
|
||||
false,
|
||||
0,
|
||||
index % 7 === 0 ? 1 : 3,
|
||||
]);
|
||||
}
|
||||
return { time: nowSec, states };
|
||||
}
|
||||
|
||||
const PORTS = [
|
||||
{ lat: 40.6, lon: -74.02, spread: 0.25 }, // New York harbour
|
||||
{ lat: 51.95, lon: 4.1, spread: 0.4 }, // Rotterdam
|
||||
{ lat: 29.7, lon: -95.0, spread: 0.3 }, // Houston
|
||||
{ lat: 1.26, lon: 103.8, spread: 0.4 }, // Singapore
|
||||
];
|
||||
|
||||
function allVessels(nowMs, seed) {
|
||||
const random = mulberry32(seed);
|
||||
const nowSec = Math.floor(nowMs / 1000);
|
||||
const rows = [];
|
||||
for (let index = 0; index < 12_000; index++) {
|
||||
const port = index < 4_000 ? PORTS[index % PORTS.length] : null;
|
||||
const lat = port
|
||||
? port.lat + (random() - 0.5) * port.spread
|
||||
: random() * 120 - 60;
|
||||
const lon = port
|
||||
? port.lon + (random() - 0.5) * port.spread * 1.5
|
||||
: random() * 360 - 180;
|
||||
rows.push({
|
||||
mmsi: String(200_000_000 + index),
|
||||
lat: Number(lat.toFixed(5)),
|
||||
lon: Number(lon.toFixed(5)),
|
||||
name: `GEV VESSEL ${index}`,
|
||||
imo: '',
|
||||
type: ['Cargo', 'Tanker', 'Passenger', 'Fishing', 'Tug'][index % 5],
|
||||
destination: '',
|
||||
speed: Number((random() * 18).toFixed(1)),
|
||||
course: Math.round(random() * 360),
|
||||
heading: Math.round(random() * 360),
|
||||
last_position_epoch: nowSec - Math.floor(random() * 120),
|
||||
});
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
const kmBetween = (a, b) => {
|
||||
const toRad = Math.PI / 180;
|
||||
const dLat = (b.lat - a.lat) * toRad;
|
||||
const dLon = (b.lon - a.lon) * toRad;
|
||||
const h =
|
||||
Math.sin(dLat / 2) ** 2 +
|
||||
Math.cos(a.lat * toRad) * Math.cos(b.lat * toRad) * Math.sin(dLon / 2) ** 2;
|
||||
return 2 * 6371 * Math.asin(Math.sqrt(h));
|
||||
};
|
||||
|
||||
/** The /api/vessels answer: 12 000 rows, or those within `area`. */
|
||||
export function syntheticVessels({
|
||||
nowMs = W1_FROZEN_MS,
|
||||
seed = 21,
|
||||
area = null,
|
||||
} = {}) {
|
||||
let rows = allVessels(nowMs, seed);
|
||||
if (area) rows = rows.filter((row) => kmBetween(area, row) <= area.radiusKm);
|
||||
return { rows, newestPositionAt: nowMs };
|
||||
}
|
||||
|
||||
/** The /api/local-receivers/aircraft answer: 1090 MHz and 978 MHz UAT aircraft. */
|
||||
export function syntheticLocalReceivers({
|
||||
nowMs = W1_FROZEN_MS,
|
||||
seed = 31,
|
||||
} = {}) {
|
||||
const random = mulberry32(seed);
|
||||
const records = [];
|
||||
for (let index = 0; index < 40; index++) {
|
||||
const uat = index % 4 === 0;
|
||||
records.push({
|
||||
icao: hex(0xad0000 + index, 6),
|
||||
callsign: `LCL${index}`,
|
||||
lat: Number((JFK.lat + (random() - 0.5) * 0.8).toFixed(5)),
|
||||
lon: Number((JFK.lng + (random() - 0.5) * 1.0).toFixed(5)),
|
||||
altitudeFt: Math.round(1_000 + random() * 20_000),
|
||||
groundSpeedKt: Math.round(80 + random() * 300),
|
||||
trackDeg: Math.round(random() * 360),
|
||||
verticalRateFpm: 0,
|
||||
onGround: false,
|
||||
category: uat ? 'A1' : 'A3',
|
||||
lastPositionAt: nowMs - Math.floor(random() * 2_000),
|
||||
lastMessageAt: nowMs - Math.floor(random() * 500),
|
||||
messageCount: 50,
|
||||
band: uat ? '978' : '1090',
|
||||
source: 'feed',
|
||||
});
|
||||
}
|
||||
return {
|
||||
configured: true,
|
||||
generatedAt: nowMs,
|
||||
feeds: [
|
||||
{ band: '1090', label: '1090 MHz', status: 'live', aircraft: 30 },
|
||||
{ band: '978', label: '978 MHz UAT', status: 'live', aircraft: 10 },
|
||||
],
|
||||
records,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user