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:
German Khokhlov committed 2026-10-16 22:52:18 +04:00
1 parent 834d34296f
commit ec7dcc944e
11 files changed
+754 -126

No files matched your search

+71
View File
@@ -0,0 +1,71 @@
// QA fixture sources (only with allowQaRegistration, i.e. the dev server):
// `?qaFeed=flights:synthetic:10000,vessels:fixture` replaces those layers'
// live sources with seeded synthetic answers (src/bench/w1Feeds.js) served
// through the live sources' own parsers, so the layers see the same snapshot
// shape. Times are relative to now, so the objects stay fresh.
//
// flights:synthetic[:count] OpenSky states, `count` aircraft (8 000)
// vessels:fixture 12 000 AIS rows, or those within an area
import {
createFlightSource,
createVesselSource,
} from '../../sources/live/standalone.js';
import { syntheticFlights, syntheticVessels } from '../../bench/w1Feeds.js';
const KINDS = Object.freeze({
flights: new Set(['synthetic']),
vessels: new Set(['fixture']),
});
/** The qaFeed entries of a location search, or a TypeError. */
export function parseQaFeed(search = '') {
const value = new URLSearchParams(search).get('qaFeed');
if (!value) return [];
return value.split(',').map((item) => {
const [layer, kind, rawCount] = item.split(':');
const count = rawCount === undefined ? null : Number(rawCount);
if (
!KINDS[layer]?.has(kind) ||
(count !== null && !(Number.isInteger(count) && count > 0))
)
throw new TypeError(
`qaFeed: unknown entry "${item}" (flights:synthetic[:count], vessels:fixture)`,
);
return { layer, kind, count };
});
}
const json = (payload) =>
new Response(JSON.stringify(payload), {
status: 200,
headers: { 'content-type': 'application/json' },
});
/** Source overrides for createStandaloneLayerSources. */
export function createQaSources(entries, { now = () => Date.now() } = {}) {
const sources = {};
for (const { layer, count } of entries) {
if (layer === 'flights')
sources.flights = createFlightSource({
now,
fetchImpl: async () =>
json(syntheticFlights({ nowMs: now(), count: count ?? 8000 })),
});
if (layer === 'vessels')
sources.vessels = createVesselSource({
fetchImpl: async (url) => {
const params = new URL(url).searchParams;
const area = params.has('lat')
? {
lat: Number(params.get('lat')),
lon: Number(params.get('lon')),
radiusKm: Number(params.get('radius_km')),
}
: null;
return json(syntheticVessels({ nowMs: now(), area }));
},
});
}
return sources;
}
+44
View File
@@ -0,0 +1,44 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { createQaSources, parseQaFeed } from './qaSources.js';
test('qaFeed names fixture sources per layer', () => {
assert.deepEqual(
parseQaFeed('?qaFeed=flights:synthetic:10000,vessels:fixture'),
[
{ layer: 'flights', kind: 'synthetic', count: 10000 },
{ layer: 'vessels', kind: 'fixture', count: null },
],
);
assert.deepEqual(parseQaFeed('?engine=navara'), []);
assert.throws(() => parseQaFeed('?qaFeed=flights:live'), /qaFeed/);
assert.throws(() => parseQaFeed('?qaFeed=weather:fixture'), /qaFeed/);
assert.throws(() => parseQaFeed('?qaFeed=flights:synthetic:-3'), /qaFeed/);
});
test('fixture sources answer with the live sources’ snapshot shape', async () => {
const now = Date.UTC(2026, 9, 16, 12);
const sources = createQaSources(
parseQaFeed('?qaFeed=flights:synthetic:500,vessels:fixture'),
{ now: () => now },
);
const flights = await sources.flights.getSnapshot({});
assert.equal(flights.records.length, 500);
assert.ok(
flights.records.every((record) => Number.isFinite(record.latitude)),
);
// Seeded: the same aircraft every time.
const again = await sources.flights.getSnapshot({});
assert.deepEqual(
again.records.map(({ id }) => id),
flights.records.map(({ id }) => id),
);
const vessels = await sources.vessels.getSnapshot({ maxRows: 12000 });
assert.equal(vessels.records.length, 12000);
const near = await sources.vessels.getSnapshot({
maxRows: 12000,
area: { lat: 40.65724, lon: -73.78, radiusKm: 10 },
});
assert.ok(near.records.length > 10 && near.records.length < 12000);
assert.deepEqual(createQaSources([]), {});
});