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

+82
View File
@@ -0,0 +1,82 @@
// The engine-neutral QA probe: window.__godsEyeView.layers. QA scripts ask
// it what a layer shows and where, the same way on Cesium and Navara,
// instead of reading Cesium objects. Read-only apart from enable/disable,
// which go through the layer manager as a user toggle would.
//
// list() [{ id, name, enabled, available }] (the catalog)
// unavailable() [{ id, name }] layers this engine leaves out
// available(id) whether this engine can show layer `id`
// enable(id) / disable(id) → Promise<boolean>
// objects(id, max?) [{ id, label, position, screen }] (position a
// plain { x, y, z }, screen a window point or null)
// screenOf(id, objectId) the window point of one object, or null
// selected(id) the layer's tracked/selected info, or null
// following() { label, native } of engine.camera.following()
// movers() engine.movers.list()
// framesDrawn() frames drawn since the probe started
const plain = (position) =>
position ? { x: position.x, y: position.y, z: position.z } : null;
/**
* @param {{
* engine: import('../globe/contract.js').GlobeEngine,
* dataManager: object,
* availability: import('./layers/renderers.js').LayerAvailability,
* }} options
*/
export function createQaProbe({ engine, dataManager, availability }) {
let frames = 0;
const removeFrames = engine.frames.postRender.addEventListener(() => {
frames++;
});
const moduleOf = (layerId) => dataManager.layers.get(layerId)?.module;
const screenOf = (position) => {
if (!position || !engine.projector.horizonVisible(position)) return null;
const screen = engine.projector.worldToWindow(position);
return screen ? { x: screen.x, y: screen.y } : null;
};
const objects = (layerId, max = 500) => {
const rows = moduleOf(layerId)?.getAllPositions?.(max) ?? [];
return rows.map((row) => ({
id: row.id,
label: row.label ?? null,
position: plain(row.position),
screen: screenOf(row.position),
}));
};
return {
list: () =>
dataManager.getAll().map(({ id, name, enabled }) => ({
id,
name,
enabled: Boolean(enabled),
available: availability.isAvailable(id),
})),
unavailable: () => availability.unavailable(),
available: (layerId) => availability.isAvailable(layerId),
enable: (layerId) =>
dataManager.setEnabled(layerId, true, { origin: 'user' }),
disable: (layerId) =>
dataManager.setEnabled(layerId, false, { origin: 'user' }),
objects,
screenOf(layerId, objectId) {
const row = (moduleOf(layerId)?.getAllPositions?.(1_000_000) ?? []).find(
({ id }) => String(id) === String(objectId),
);
return row ? screenOf(row.position) : null;
},
selected: (layerId) => moduleOf(layerId)?.getTrackedInfo?.() ?? null,
following() {
const handle = engine.camera.following();
if (!handle) return null;
return {
label: handle.label?.id ?? null,
native: handle.native?.id ?? null,
};
},
movers: () => engine.movers.list(),
framesDrawn: () => frames,
destroy: () => removeFrames(),
};
}