mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Merge branch 'sameh/renderer-track' into sameh/renderer-seam
This commit is contained in:
commit
f65df05b62
4 files changed
+661
-277
No files matched your search
@@ -5750,7 +5750,7 @@ pins and share links already supply complete boxes.
|
||||
- Fleet model eligibility is distance-based with on-screen priority and hard caps (`MODEL_MAX`, `MODEL_MAX_ALL`) to avoid draw-call explosions. Each model owns its own `modelMatrix`; shared scratch matrices are forbidden because they caused stacking/flicker.
|
||||
- Tracked aircraft use standalone model primitives driven from the already-settled dead-reckoned display position, while the tracked Cesium entity remains billboard-backed so `viewer.trackedEntity` always has a ready bounding sphere.
|
||||
- Flights and military layers mirror the same tracking invariants: no warm-up freeze/jump, altitude-scaled framing, trail head glued to the displayed plane, no pull-out when switching targets, and no cross-layer orphan when switching between commercial and military tracks.
|
||||
- Regression surface: `npm run test:track` drives the real app headless with synthetic aircraft feeds and asserts the tracking invariants without depending on live OpenSky/adsb data. Arrival-rotation checks observe the settle frame and then the first reveal frame, each within a 500 ms wall-clock budget that sits inside the one-second idle fallback, rather than assuming the 80 ms fleet cadence fits inside four rendered frames; an incorrect first orientation fails immediately. Only an inconclusive timeout is retried (once); a timeout keeps every angle it measured (the settle frame before a reveal timeout, and the late frame itself, which is read before the deadline check), so a measured wrong angle fails without retry. `src/data/trackedModelRegime.test.mjs` pins the tracked contact's threshold math, the enter/exit asymmetry, and the default-on / cockpit / TR-3B / deselect wiring in both layers.
|
||||
- Regression surface: `npm run test:track` drives the real app headless with synthetic aircraft feeds and asserts the tracking invariants without depending on live OpenSky/adsb data. The harness reads what the app draws through its own seams: what the camera follows through `src/data/followed.js`, icons from the draw port's icon sets as the renderer holds them, and models by their `{set, id}` pick ids. Arrival-rotation checks read the drawn rows' course (the icon sets turn each icon along it on the GPU every frame, so there is no CPU rotation pass to repair a stale nose) and observe the settle frame and then the first reveal frame, each within a 500 ms wall-clock budget; an incorrect first orientation fails immediately. Only an inconclusive timeout is retried (once); a timeout keeps every angle it measured (the settle frame before a reveal timeout, and the late frame itself, which is read before the deadline check), so a measured wrong angle fails without retry. `src/data/trackedModelRegime.test.mjs` pins the tracked contact's threshold math, the enter/exit asymmetry, and the default-on / cockpit / TR-3B / deselect wiring in both layers.
|
||||
|
||||
### TR-3B conversion Easter egg (August 2026)
|
||||
|
||||
|
||||
+266
-69
@@ -65,6 +65,27 @@ const LINE_CLIP = { x: 390, y: 200, width: 510, height: 380 };
|
||||
const canvasShot = () =>
|
||||
page.screenshot({ clip: LINE_CLIP, type: 'png', encoding: 'base64' });
|
||||
|
||||
/**
|
||||
* `canvasShot` once the globe has no imagery or terrain tiles left to load
|
||||
* (bounded: a view that never settles is shot as it is, and the comparison
|
||||
* then reports what it sees). `globe.tilesLoaded` covers the globe only: a
|
||||
* 3D Tiles tileset on a keyed server can still be refining when it is true.
|
||||
*/
|
||||
async function settledCanvasShot() {
|
||||
await page
|
||||
.waitForFunction(
|
||||
() => {
|
||||
const scene = window.__godsEyeView.viewer.scene;
|
||||
scene.requestRender();
|
||||
return scene.globe.tilesLoaded;
|
||||
},
|
||||
{ timeout: 15_000, polling: 100 },
|
||||
)
|
||||
.catch(() => {});
|
||||
await wait(200);
|
||||
return canvasShot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Amber pixels in one shot that are not amber in another of the same view:
|
||||
* a mark's own pixels, apart from imagery and panels that both shots share.
|
||||
@@ -505,12 +526,26 @@ try {
|
||||
await page.click(rowControl(lineId, 'swatch'));
|
||||
await page.click(rowControl(lineId, 'color-amber'));
|
||||
await markReaches(lineId, { color: 'amber', alpha: 1 });
|
||||
// Only the Line is on the board for its shots. The area's fill pulses, and
|
||||
// under it borderline roofs drift into and out of amber between two shots
|
||||
// of an unchanged scene, on the old build as on this one.
|
||||
const others = await page.evaluate((id) => {
|
||||
const marks = window.__gevAnnotations.list();
|
||||
const ids = marks.filter((m) => m.id !== id && !m.hidden).map((m) => m.id);
|
||||
for (const other of ids) window.__gevAnnotations.setHidden(other, true);
|
||||
return ids;
|
||||
}, lineId);
|
||||
for (const other of others)
|
||||
await markReaches(other, { hidden: true, alpha: 0 });
|
||||
await wait(800);
|
||||
const shown = await canvasShot();
|
||||
// The fly-to above is still refining imagery near the camera at this
|
||||
// point; a tile that sharpens between the two shots repaints roofs into
|
||||
// and out of amber, so each shot waits for the globe to finish loading.
|
||||
const shown = await settledCanvasShot();
|
||||
await page.click(rowControl(lineId, 'toggle'));
|
||||
await markReaches(lineId, { hidden: true, alpha: 0 });
|
||||
await wait(800);
|
||||
const hiddenShot = await canvasShot();
|
||||
const hiddenShot = await settledCanvasShot();
|
||||
// Amber the shown line had and the hidden one lost; amber that appears
|
||||
// only once it is hidden is noise, and must stay small beside it.
|
||||
const gone = await amberOnlyIn(shown, hiddenShot);
|
||||
@@ -522,12 +557,24 @@ try {
|
||||
);
|
||||
await page.click(rowControl(lineId, 'toggle'));
|
||||
await wait(1200);
|
||||
const back = await amberOnlyIn(await canvasShot(), hiddenShot);
|
||||
const back = await amberOnlyIn(await settledCanvasShot(), hiddenShot);
|
||||
check(
|
||||
'and paints again when shown',
|
||||
back > gone * 0.5,
|
||||
`${back} of ${gone} line pixels back`,
|
||||
);
|
||||
await page.evaluate((ids) => {
|
||||
for (const other of ids) window.__gevAnnotations.setHidden(other, false);
|
||||
}, others);
|
||||
const restored = [];
|
||||
for (const other of others)
|
||||
if (await markReaches(other, { hidden: false, alpha: 1 }))
|
||||
restored.push(other);
|
||||
check(
|
||||
'the marks set aside for the Line shots are back on the board',
|
||||
restored.length === others.length,
|
||||
`${restored.length} of ${others.length} back`,
|
||||
);
|
||||
await shot('03-pins-and-shapes');
|
||||
|
||||
// ── Escape cancels the shape, a second Escape leaves draw mode ──────────
|
||||
@@ -575,32 +622,87 @@ try {
|
||||
: 'no CCTV camera or bundled site could be reached — the ownership case cannot be proved',
|
||||
);
|
||||
if (target) {
|
||||
// The camera pose the target was found at: a selecting click flies the
|
||||
// camera to what it picked, so the drawing click has to come back here
|
||||
// and find the target again, or it would land on plain ground.
|
||||
await page.evaluate(() => {
|
||||
const camera = window.__godsEyeView.viewer.camera;
|
||||
window.__qaTargetView = {
|
||||
destination: camera.positionWC.clone(),
|
||||
orientation: {
|
||||
heading: camera.heading,
|
||||
pitch: camera.pitch,
|
||||
roll: camera.roll,
|
||||
},
|
||||
};
|
||||
});
|
||||
await page.evaluate(clearSelection);
|
||||
await page.evaluate(startSelectionCount);
|
||||
await clickWorld(target.x, target.y, { settle: 900 });
|
||||
const selectedNormally = await page.evaluate(() =>
|
||||
Boolean(window.__godsEyeView.viewer.selectedEntity),
|
||||
);
|
||||
const normal = await page.evaluate(readSelectionCount, target.key);
|
||||
check(
|
||||
`clicking a ${target.layer} selects it when nothing owns the pointer`,
|
||||
selectedNormally,
|
||||
// The CCTV branch looks for `CAM-` Cesium entities and reads the
|
||||
// viewer's selection; neither build draws cameras that way any more, so
|
||||
// it is not reached and the bundled data centre is the target.
|
||||
normal.item > 0 || (target.layerId === 'cctv' && normal.entity),
|
||||
`${normal.item} selection(s) of ${target.key}, ${normal.all} in all, entity ${normal.entity}`,
|
||||
);
|
||||
await page.evaluate(clearSelection);
|
||||
await page.evaluate(() => {
|
||||
window.__godsEyeView.viewer.selectedEntity = undefined;
|
||||
const viewer = window.__godsEyeView.viewer;
|
||||
viewer.camera.cancelFlight?.();
|
||||
viewer.camera.setView(window.__qaTargetView);
|
||||
viewer.scene.requestRender();
|
||||
});
|
||||
await page.click('#draw-toggle');
|
||||
await page.click('.pp-mode-btn[data-shape="area"]');
|
||||
await clickWorld(target.x, target.y, { settle: 900 });
|
||||
const whileDrawing = await drawState();
|
||||
const selectedWhileDrawing = await page.evaluate(() =>
|
||||
Boolean(window.__godsEyeView.viewer.selectedEntity),
|
||||
await wait(1500);
|
||||
const again = await onScreen(
|
||||
target.belongs,
|
||||
target.contextPrefix,
|
||||
target.key,
|
||||
);
|
||||
check(
|
||||
`clicking the same ${target.layer} while drawing adds a vertex and selects nothing`,
|
||||
whileDrawing.vertices === 1 && selectedWhileDrawing === false,
|
||||
`vertices ${whileDrawing.vertices}, selected ${selectedWhileDrawing}`,
|
||||
`the ${target.layer} is picked again after the camera returns`,
|
||||
Boolean(again),
|
||||
again ? `at ${again.x},${again.y}` : 'not picked on screen any more',
|
||||
);
|
||||
await page.keyboard.press('Escape');
|
||||
await page.keyboard.press('Escape');
|
||||
await wait(150);
|
||||
if (again) {
|
||||
await page.click('#draw-toggle');
|
||||
await page.click('.pp-mode-btn[data-shape="area"]');
|
||||
// Draw mode's own panel must not have covered it: the drawing click has
|
||||
// to land on the same item, not on plain ground.
|
||||
const drawingSpot = await onScreen(
|
||||
target.belongs,
|
||||
target.contextPrefix,
|
||||
target.key,
|
||||
);
|
||||
check(
|
||||
`the ${target.layer} is still picked once draw mode is open`,
|
||||
Boolean(drawingSpot),
|
||||
drawingSpot
|
||||
? `at ${drawingSpot.x},${drawingSpot.y}`
|
||||
: 'not picked on screen in draw mode',
|
||||
);
|
||||
if (drawingSpot) {
|
||||
await page.evaluate(startSelectionCount);
|
||||
await clickWorld(drawingSpot.x, drawingSpot.y, { settle: 900 });
|
||||
const whileDrawing = await drawState();
|
||||
const drawingSelection = await page.evaluate(
|
||||
readSelectionCount,
|
||||
target.key,
|
||||
);
|
||||
check(
|
||||
`clicking the same ${target.layer} while drawing adds a vertex and selects nothing`,
|
||||
whileDrawing.vertices === 1 &&
|
||||
drawingSelection.all === 0 &&
|
||||
!drawingSelection.entity,
|
||||
`vertices ${whileDrawing.vertices}, ${drawingSelection.all} selection(s), entity ${drawingSelection.entity}`,
|
||||
);
|
||||
}
|
||||
await page.keyboard.press('Escape');
|
||||
await page.keyboard.press('Escape');
|
||||
await wait(150);
|
||||
}
|
||||
}
|
||||
|
||||
// ── what a reload actually does ─────────────────────────────────────────
|
||||
@@ -877,22 +979,24 @@ async function findClickableTarget() {
|
||||
viewer.scene.requestRender();
|
||||
}, camera);
|
||||
await wait(4000);
|
||||
const spot = await onScreen(
|
||||
(entity) => typeof entity.id === 'string' && entity.id.startsWith('CAM-'),
|
||||
);
|
||||
if (spot) return { ...spot, layer: 'CCTV camera' };
|
||||
const spot = await onScreen(cameraEntity);
|
||||
if (spot)
|
||||
return {
|
||||
...spot,
|
||||
layer: 'CCTV camera',
|
||||
layerId: 'cctv',
|
||||
belongs: cameraEntity,
|
||||
contextPrefix: null,
|
||||
};
|
||||
}
|
||||
|
||||
// Bundled infrastructure as the keyless fallback: a different guarded handler,
|
||||
// the same shared claim, and always present without a key.
|
||||
const site = await page
|
||||
.evaluate(async () => {
|
||||
const viewer = window.__godsEyeView.viewer;
|
||||
// The app registers each local feature's context as `<layer id>:<feature id>`.
|
||||
const isDataCentre = (entity) =>
|
||||
window.__godsEyeView.entityRecords
|
||||
.read(entity)
|
||||
?.contextId?.startsWith('local-datacenters:');
|
||||
// The app registers each local feature's context as `<layer id>:<feature id>`,
|
||||
// with its coordinates, whether the layer draws Cesium entities or
|
||||
// through the draw port.
|
||||
await window.__godsEyeView.dataManager.setEnabled(
|
||||
'local-datacenters',
|
||||
true,
|
||||
@@ -900,30 +1004,16 @@ async function findClickableTarget() {
|
||||
origin: 'user',
|
||||
},
|
||||
);
|
||||
const centreOf = (entity) => {
|
||||
const time = viewer.clock.currentTime;
|
||||
const point = entity.position?.getValue?.(time);
|
||||
if (point) return point;
|
||||
const hierarchy = entity.polygon?.hierarchy?.getValue?.(time);
|
||||
if (hierarchy?.positions?.length) return hierarchy.positions[0];
|
||||
const line = entity.polyline?.positions?.getValue?.(time);
|
||||
return line?.length ? line[0] : null;
|
||||
};
|
||||
for (let attempt = 0; attempt < 40; attempt += 1) {
|
||||
for (let i = 0; i < viewer.dataSources.length; i += 1) {
|
||||
for (const entity of viewer.dataSources.get(i).entities.values) {
|
||||
if (!isDataCentre(entity)) continue;
|
||||
const point = centreOf(entity);
|
||||
if (!point) continue;
|
||||
const carto = window.Cesium
|
||||
? window.Cesium.Cartographic.fromCartesian(point)
|
||||
: viewer.scene.globe.ellipsoid.cartesianToCartographic(point);
|
||||
if (!carto) continue;
|
||||
return {
|
||||
lon: (carto.longitude * 180) / Math.PI,
|
||||
lat: (carto.latitude * 180) / Math.PI,
|
||||
};
|
||||
}
|
||||
const records = window.__gevContextStore?.entities?.values() ?? [];
|
||||
for (const record of records) {
|
||||
if (!String(record?.id).startsWith('local-datacenters:')) continue;
|
||||
if (
|
||||
!Number.isFinite(record.latitude) ||
|
||||
!Number.isFinite(record.longitude)
|
||||
)
|
||||
continue;
|
||||
return { lon: record.longitude, lat: record.latitude };
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||
}
|
||||
@@ -945,23 +1035,97 @@ async function findClickableTarget() {
|
||||
viewer.scene.requestRender();
|
||||
}, site);
|
||||
await wait(4000);
|
||||
const spot = await onScreen((entity) =>
|
||||
const spot = await onScreen(dataCentre, 'local-datacenters:');
|
||||
return spot
|
||||
? {
|
||||
...spot,
|
||||
layer: 'data centre',
|
||||
layerId: 'local-datacenters',
|
||||
belongs: dataCentre,
|
||||
contextPrefix: 'local-datacenters:',
|
||||
}
|
||||
: null;
|
||||
}
|
||||
|
||||
/** A CCTV camera entity (runs in the page through `onScreen`). */
|
||||
function cameraEntity(entity) {
|
||||
return typeof entity.id === 'string' && entity.id.startsWith('CAM-');
|
||||
}
|
||||
|
||||
/**
|
||||
* A bundled data centre: a Cesium entity carrying its context, or a draw-port
|
||||
* pick id `{ set, id }` from a set named `<layer id>:<n>:<part>` (runs in the
|
||||
* page through `onScreen`).
|
||||
*/
|
||||
function dataCentre(entity) {
|
||||
return (
|
||||
window.__godsEyeView.entityRecords
|
||||
.read(entity)
|
||||
?.contextId?.startsWith('local-datacenters:'),
|
||||
?.contextId?.startsWith('local-datacenters:') ||
|
||||
(typeof entity?.set === 'string' &&
|
||||
entity.set.startsWith('local-datacenters:'))
|
||||
);
|
||||
return spot ? { ...spot, layer: 'data centre' } : null;
|
||||
}
|
||||
|
||||
/** Clear both selection slots (runs in the page). */
|
||||
function clearSelection() {
|
||||
window.__godsEyeView.viewer.selectedEntity = undefined;
|
||||
const store = window.__gevContextStore;
|
||||
if (store) store.selectedEntityId = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count click selections from now on (runs in the page). A layer selects
|
||||
* through the shared context store, which announces each selection with
|
||||
* `gev:entity-selected`; one drawn through the draw port has no Cesium entity
|
||||
* to set as the viewer's selection. Counting the announcements rather than
|
||||
* reading the slot keeps an earlier selection, or a tracking layer refilling
|
||||
* the slot without announcing, from deciding the result.
|
||||
*/
|
||||
function startSelectionCount() {
|
||||
const seen = [];
|
||||
window.removeEventListener('gev:entity-selected', window.__qaOnSelected);
|
||||
window.__qaSelections = seen;
|
||||
window.__qaOnSelected = (event) => seen.push(event.detail ?? null);
|
||||
window.addEventListener('gev:entity-selected', window.__qaOnSelected);
|
||||
}
|
||||
|
||||
/**
|
||||
* Selections since `startSelectionCount` (runs in the page): `all`, those of
|
||||
* the item whose context id is `key`, and whether the viewer holds a selected
|
||||
* Cesium entity.
|
||||
* @param {string} key
|
||||
* @returns {{ all: number, item: number, entity: boolean }}
|
||||
*/
|
||||
function readSelectionCount(key) {
|
||||
const seen = window.__qaSelections || [];
|
||||
return {
|
||||
all: seen.length,
|
||||
item: seen.filter((record) => record?.id === key).length,
|
||||
entity: Boolean(window.__godsEyeView.viewer.selectedEntity),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Canvas coordinates of the first entity matching `belongs` that is on screen
|
||||
* and clear of the side panels. Annotation marks and the draw tool's own
|
||||
* preview vertices are on screen too, so the predicate has to be specific.
|
||||
* With `contextPrefix`, the context store's records under that prefix are
|
||||
* candidates too (at their ground coordinates), for a layer drawn through the
|
||||
* draw port, which has no entities to walk; `belongs` then also receives the
|
||||
* draw-port pick id. Returns the spot and `key`, the picked item's context id
|
||||
* (from the entity's record or the draw-port item's `meta`; without a prefix,
|
||||
* the entity's own id); with `wantKey`, only that item counts.
|
||||
*/
|
||||
async function onScreen(belongs, timeout = 20_000) {
|
||||
async function onScreen(
|
||||
belongs,
|
||||
contextPrefix = null,
|
||||
wantKey = null,
|
||||
timeout = 20_000,
|
||||
) {
|
||||
return page
|
||||
.waitForFunction(
|
||||
(belongsSource) => {
|
||||
(belongsSource, prefix, want) => {
|
||||
// eslint-disable-next-line no-new-func
|
||||
const belongsTo = new Function(`return (${belongsSource})`)();
|
||||
const viewer = window.__godsEyeView.viewer;
|
||||
@@ -972,29 +1136,62 @@ async function onScreen(belongs, timeout = 20_000) {
|
||||
if (source?.name === 'gev-draw-preview') continue;
|
||||
collections.push(source.entities);
|
||||
}
|
||||
const candidates = [];
|
||||
for (const source of collections) {
|
||||
for (const entity of source.values) {
|
||||
if (!belongsTo(entity)) continue;
|
||||
const position = entity.position?.getValue?.(
|
||||
viewer.clock.currentTime,
|
||||
);
|
||||
if (!position) continue;
|
||||
const window2d = scene.cartesianToCanvasCoordinates(position);
|
||||
if (!window2d) continue;
|
||||
const { x, y } = window2d;
|
||||
if (!(x > 300 && x < 900 && y > 180 && y < 600)) continue;
|
||||
// Projecting into the window is not the same as being clickable:
|
||||
// the entity may be beyond the horizon or behind a building. Only a
|
||||
// spot where the scene actually picks it proves the control case.
|
||||
const hit = scene.pick({ x: Math.round(x), y: Math.round(y) });
|
||||
if (!hit?.id || !belongsTo(hit.id)) continue;
|
||||
return { x: Math.round(x), y: Math.round(y) };
|
||||
if (position) candidates.push(position);
|
||||
}
|
||||
}
|
||||
if (prefix) {
|
||||
const ellipsoid = scene.globe.ellipsoid;
|
||||
for (const record of window.__gevContextStore?.entities?.values() ??
|
||||
[]) {
|
||||
if (!String(record?.id).startsWith(prefix)) continue;
|
||||
if (
|
||||
!Number.isFinite(record.latitude) ||
|
||||
!Number.isFinite(record.longitude)
|
||||
)
|
||||
continue;
|
||||
candidates.push(
|
||||
ellipsoid.cartographicToCartesian({
|
||||
longitude: (record.longitude * Math.PI) / 180,
|
||||
latitude: (record.latitude * Math.PI) / 180,
|
||||
height: 0,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
for (const position of candidates) {
|
||||
const window2d = scene.cartesianToCanvasCoordinates(position);
|
||||
if (!window2d) continue;
|
||||
const { x, y } = window2d;
|
||||
if (!(x > 300 && x < 900 && y > 180 && y < 600)) continue;
|
||||
// Projecting into the window is not the same as being clickable:
|
||||
// the entity may be beyond the horizon or behind a building. Only a
|
||||
// spot where the scene actually picks it proves the control case.
|
||||
const hit = scene.pick({ x: Math.round(x), y: Math.round(y) });
|
||||
if (!hit?.id || !belongsTo(hit.id)) continue;
|
||||
// The picked item's context id: an entity's own record, or that of
|
||||
// the object a draw-port item carries as its `meta`.
|
||||
const pickId = hit.id;
|
||||
const records = window.__godsEyeView.entityRecords;
|
||||
const key =
|
||||
records.read(pickId)?.contextId ||
|
||||
records.read(pickId.meta)?.contextId ||
|
||||
(prefix ? null : String(pickId.id));
|
||||
if (!key || (want && key !== want)) continue;
|
||||
return { x: Math.round(x), y: Math.round(y), key };
|
||||
}
|
||||
return false;
|
||||
},
|
||||
{ timeout, polling: 500 },
|
||||
belongs.toString(),
|
||||
contextPrefix,
|
||||
wantKey,
|
||||
)
|
||||
.then(
|
||||
(handle) => handle.jsonValue(),
|
||||
|
||||
@@ -8,13 +8,16 @@
|
||||
* 1. exact-viewport revisit (traffic module's full-road cache),
|
||||
* 2. adjacent 0.4–2 km pan (new exact bbox with heavy spatial overlap),
|
||||
* 3. cold city (no traffic-module entry for that city),
|
||||
* 4. degraded upstream (synthetic delay on `/api/overpass` only).
|
||||
* 4. degraded upstream (synthetic delay on the road requests: OpenFreeMap's
|
||||
* host, which only traffic reads in this capture, or the Overpass proxy).
|
||||
*
|
||||
* The proxy's actual `X-Overpass-Cache` result is printed for every network
|
||||
* pass, so HIT/DISK/MISS/STALE/INFLIGHT is evidence rather than inference.
|
||||
* The degraded leg delays request release in Puppeteer; it exercises the same
|
||||
* fetch-start→response boundary without adding a failure switch to the
|
||||
* application or proxy. Pass `--degraded-delay-ms 0` to skip that leg.
|
||||
* Keyless roads come from OpenFreeMap vector tiles (`tiles.openfreemap.org`);
|
||||
* a build that still reads them through the Overpass proxy has its
|
||||
* `X-Overpass-Cache` result printed for every network pass, so
|
||||
* HIT/DISK/MISS/STALE/INFLIGHT is evidence rather than inference ("—" for
|
||||
* tiles). The degraded leg delays the road requests' release in Puppeteer;
|
||||
* it exercises the same fetch-start→response boundary without adding a
|
||||
* failure switch to the application or proxy. Pass `--degraded-delay-ms 0` to skip that leg.
|
||||
* TomTom status is intercepted as keyless so no live-flow key is required and
|
||||
* the capture isolates the OSM road-to-visible-dot chain.
|
||||
*
|
||||
@@ -93,9 +96,42 @@ function debugUrl(rawUrl) {
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
/** Position the camera and explicitly raise the boundaries the layer observes. */
|
||||
/**
|
||||
* Let the camera report a move the way a user's does: traffic hears the
|
||||
* camera port's `changed` at its own 5% threshold (layers/traffic/policy.js
|
||||
* CAMERA_CHANGED_THRESHOLD), which the port measures on every scene tick
|
||||
* (the first measurement after a listener subscribes only records its
|
||||
* baseline pose). Waiting for two drawn frames after the move is the sync
|
||||
* point that the port has measured it. Cesium's own moveEnd (500 ms after
|
||||
* stillness) is left to Cesium, as in the app; traffic re-checks the view
|
||||
* on it. Installed in the page as `window.__qaRenderAfterMove`; throws when
|
||||
* the frames do not draw within 5 s.
|
||||
*/
|
||||
function installRenderAfterMove() {
|
||||
window.__qaRenderAfterMove = (gev) => new Promise((resolve, reject) => {
|
||||
const scene = gev.viewer.scene;
|
||||
let frames = 0;
|
||||
let remove = null;
|
||||
const timer = setTimeout(() => {
|
||||
remove();
|
||||
reject(new Error(`the camera move rendered ${frames} frame(s) in 5 s`));
|
||||
}, 5000);
|
||||
remove = scene.postRender.addEventListener(() => {
|
||||
if (++frames >= 2) {
|
||||
clearTimeout(timer);
|
||||
remove();
|
||||
resolve(frames);
|
||||
return;
|
||||
}
|
||||
scene.requestRender();
|
||||
});
|
||||
scene.requestRender();
|
||||
});
|
||||
}
|
||||
|
||||
/** Position the camera and render, so the layer hears the move as it would a user's. */
|
||||
async function moveCamera(page, view) {
|
||||
return page.evaluate((v) => {
|
||||
return page.evaluate(async (v) => {
|
||||
const gev = window.__godsEyeView;
|
||||
const module = gev.dataManager.layers.get('traffic').module;
|
||||
const beforeLastUpdate = module.getStats().lastUpdate;
|
||||
@@ -115,13 +151,7 @@ async function moveCamera(page, view) {
|
||||
roll: 0,
|
||||
},
|
||||
});
|
||||
// setView normally propagates through Cesium's render loop. Raising these
|
||||
// explicitly makes the capture boundary deterministic across GPU speeds.
|
||||
// Traffic hears the synthetic moveEnd through the camera port and loads at
|
||||
// once; the port measures its own `changed` on the next rendered tick, so
|
||||
// the synthetic camera.changed reaches only the layers still on Cesium.
|
||||
gev.viewer.camera.changed.raiseEvent();
|
||||
gev.viewer.camera.moveEnd.raiseEvent();
|
||||
await window.__qaRenderAfterMove(gev);
|
||||
return { beforeLastUpdate, boundaryTime };
|
||||
}, view);
|
||||
}
|
||||
@@ -160,14 +190,29 @@ function readTrafficMeasures(page, boundaryTime) {
|
||||
})), boundaryTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Road requests the page sent, counted by the request interceptor: `sent` is
|
||||
* every road request that reached the network, `delayed` those it held for
|
||||
* the degraded leg. `requestRoads()` can be answered from decoded tiles
|
||||
* already in memory, so a `fetch-to-response` measure alone does not prove
|
||||
* the network was used.
|
||||
*/
|
||||
const roadRequests = { sent: 0, delayed: 0 };
|
||||
|
||||
/** Drive one measured state and return its raw User Timing measures. */
|
||||
async function captureState(page, name, view, setDelay) {
|
||||
setDelay(name === 'degraded-upstream' ? DEGRADED_DELAY_MS : 0);
|
||||
const before = { ...roadRequests };
|
||||
const { beforeLastUpdate, boundaryTime } = await moveCamera(page, view);
|
||||
await waitForTrafficCapture(page, beforeLastUpdate, boundaryTime);
|
||||
const measures = await readTrafficMeasures(page, boundaryTime);
|
||||
setDelay(0);
|
||||
return { name, measures };
|
||||
return {
|
||||
name,
|
||||
measures,
|
||||
sent: roadRequests.sent - before.sent,
|
||||
delayed: roadRequests.delayed - before.delayed,
|
||||
};
|
||||
}
|
||||
|
||||
/** Format a duration without hiding zero-duration measurements. */
|
||||
@@ -319,13 +364,14 @@ async function main() {
|
||||
const page = await browser.newPage();
|
||||
await page.setViewport({ width: 1440, height: 900 });
|
||||
await page.evaluateOnNewDocument(() => localStorage.clear());
|
||||
await page.evaluateOnNewDocument(installRenderAfterMove);
|
||||
page.on('console', (message) => {
|
||||
if (message.type() === 'error') consoleErrors.push(message.text());
|
||||
});
|
||||
page.on('pageerror', (error) => consoleErrors.push(error.message));
|
||||
|
||||
// Force keyless traffic and optionally hold Overpass requests to model a
|
||||
// degraded proxy/upstream. No server key or proxy debug endpoint is needed.
|
||||
// Force keyless traffic and optionally hold the road requests to model a
|
||||
// degraded upstream. No server key or proxy debug endpoint is needed.
|
||||
await page.setRequestInterception(true);
|
||||
page.on('request', async (request) => {
|
||||
if (request.url().includes('/api/tomtom/status')) {
|
||||
@@ -336,7 +382,11 @@ async function main() {
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (activeProxyDelayMs > 0 && request.url().includes('/api/overpass')) {
|
||||
const roadRequest = request.url().includes('/api/overpass')
|
||||
|| new URL(request.url()).hostname === 'tiles.openfreemap.org';
|
||||
if (roadRequest) roadRequests.sent += 1;
|
||||
if (activeProxyDelayMs > 0 && roadRequest) {
|
||||
roadRequests.delayed += 1;
|
||||
await sleep(activeProxyDelayMs);
|
||||
}
|
||||
try { await request.continue(); } catch { /* page closed or already handled */ }
|
||||
@@ -364,8 +414,9 @@ async function main() {
|
||||
orientation: { heading: 0, pitch: -Math.PI / 2, roll: 0 },
|
||||
});
|
||||
await gev.dataManager.setEnabled('traffic', true);
|
||||
gev.viewer.camera.changed.raiseEvent();
|
||||
gev.viewer.camera.moveEnd.raiseEvent();
|
||||
// Also records the baseline pose traffic's new `changed` listener
|
||||
// measures the first measured move against.
|
||||
await window.__qaRenderAfterMove(gev);
|
||||
}, VIEWS.austin);
|
||||
await sleep(500);
|
||||
|
||||
@@ -387,7 +438,7 @@ async function main() {
|
||||
|
||||
// Clear the last-bounds gate without clearing the module's road cache, then
|
||||
// revisit the byte-identical camera pose for a true client-cache hit.
|
||||
await page.evaluate((view) => {
|
||||
await page.evaluate(async (view) => {
|
||||
const gev = window.__godsEyeView;
|
||||
const ellipsoid = gev.viewer.scene.globe.ellipsoid;
|
||||
const radians = Math.PI / 180;
|
||||
@@ -399,8 +450,7 @@ async function main() {
|
||||
}),
|
||||
orientation: { heading: 0, pitch: -Math.PI / 2, roll: 0 },
|
||||
});
|
||||
gev.viewer.camera.changed.raiseEvent();
|
||||
gev.viewer.camera.moveEnd.raiseEvent();
|
||||
await window.__qaRenderAfterMove(gev);
|
||||
}, VIEWS.austin);
|
||||
await sleep(500);
|
||||
|
||||
@@ -429,7 +479,7 @@ async function main() {
|
||||
}
|
||||
for (const capture of captures.slice(1)) {
|
||||
if (!capture.measures.some((entry) => entry.detail?.segment === 'fetch-to-response')) {
|
||||
throw new Error(`${capture.name} did not issue an Overpass request`);
|
||||
throw new Error(`${capture.name} did not issue a road request`);
|
||||
}
|
||||
}
|
||||
if (DEGRADED_DELAY_MS > 0) {
|
||||
@@ -439,20 +489,35 @@ async function main() {
|
||||
&& entry.duration >= DEGRADED_DELAY_MS * 0.9
|
||||
));
|
||||
if (!delayed) throw new Error('degraded-upstream leg did not observe the synthetic delay');
|
||||
// The delay has to come from held road requests, not from processing
|
||||
// that happened to run long.
|
||||
if (!degraded.delayed) throw new Error('degraded-upstream leg sent no road request to hold');
|
||||
}
|
||||
// A city the client has never seen has no tiles in memory: it must reach
|
||||
// the network. The other legs may legitimately be answered from tiles
|
||||
// already decoded, so their counts are reported, not asserted.
|
||||
const cold = captures.find((capture) => capture.name === 'cold city (client)');
|
||||
if (!cold?.sent) throw new Error('cold city leg sent no road request to the network');
|
||||
|
||||
const rows = captures.flatMap(rowsForCapture);
|
||||
if (!rows.length) throw new Error('no measured traffic renders were captured');
|
||||
console.log('\nCausal segments (one row per visible major/full pass)');
|
||||
console.table(rows);
|
||||
console.log('\nRoad requests sent to the network per leg (held by the degraded leg)');
|
||||
console.table(captures.map((capture) => ({
|
||||
State: capture.name,
|
||||
Sent: capture.sent,
|
||||
Held: capture.delayed,
|
||||
})));
|
||||
console.log('\nNotes:');
|
||||
console.log(' - Render→postRender is the first visible-frame boundary used by Phase 0.');
|
||||
console.log(' - Proxy cache is read from X-Overpass-Cache; “—” means the client cache avoided fetch.');
|
||||
console.log(' - response.json includes both body transfer and JSON decoding; the production path does not split them.');
|
||||
console.log(' - Last change→fetch is approximately the 320 ms FETCH_DEBOUNCE for the first fetch by construction.');
|
||||
console.log(' - Proxy cache is read from X-Overpass-Cache; “—” means the client cache avoided fetch, or the roads came from OpenFreeMap tiles.');
|
||||
console.log(' - Through the Overpass proxy, Fetch→response is the HTTP response and response.json is body transfer plus JSON decoding.');
|
||||
console.log(' - From OpenFreeMap tiles, Fetch→response spans the tile requests, body reads, decoding and composition, and response.json only hands back the built object; a held leg can stack the delay over tiles fetched in turn.');
|
||||
console.log(' - Last change→fetch is the 320 ms FETCH_DEBOUNCE for the first fetch by construction, plus timer and main-thread latency (larger under SwiftShader).');
|
||||
console.log(' - Full-pass Last change→fetch also includes the intentionally sequential major pass.');
|
||||
console.log(' - Cesium moveEnd is a diagnostic raised ~500 ms after stillness, typically after fetch starts; fetch never waits for it.');
|
||||
console.log(' - Synthetic events bypass camera percentageChanged/inertia but use the same camera.changed schedule-time anchor as natural captures.');
|
||||
console.log(' - Cesium moveEnd is raised ~500 ms after stillness, typically after fetch starts; fetch never waits for it, and traffic only re-checks the view on it.');
|
||||
console.log(' - Moves are setView plus rendered frames: the camera port measures traffic\'s own 5% changed threshold as for a user move (inertia is bypassed).');
|
||||
console.log(' - The keyless capture zeroes Flow race and Heat lines work; live-keyed numbers will differ.');
|
||||
console.log(' - Measurement caveat: timings include instrumentation overhead (observer effect) and browser clock-floor quantization.');
|
||||
console.log(' - Per-road clock observations inside road-parse-total/waypoint-materialization slightly overstate production work.');
|
||||
|
||||
+299
-177
@@ -33,7 +33,8 @@
|
||||
* moves the camera — it stays in the follow band).
|
||||
* 3. NO CROSS-LAYER — tracking military then commercial (and vice versa)
|
||||
* ORPHAN clears the FIRST layer (its getTrackedInfo()===null),
|
||||
* via the per-layer viewer.trackedEntityChanged listener.
|
||||
* via each layer's follow-changed listener (the follow
|
||||
* service, data/followed.js: onFollowChanged).
|
||||
* 4. INIT CLEAN — app loads, all 12 layers present, no console errors,
|
||||
* [Detection] Initialized + [TrackedReadout] Initialized.
|
||||
*
|
||||
@@ -43,8 +44,8 @@
|
||||
* NO-OP (no deselect, no camera spike).
|
||||
* M3. AGE-OUT RELEASE — when the tracked plane's fixes stop arriving
|
||||
* (3 missed polls via the shim), tracking clears and
|
||||
* the camera is RELEASED IN PLACE: viewer.trackedEntity
|
||||
* undefined, NO jump (owner decision 2026-07-02 —
|
||||
* the camera is RELEASED IN PLACE: the camera follows
|
||||
* nothing (data/followed.js), NO jump (owner decision 2026-07-02 —
|
||||
* the old ~80 km overview flyTo is gone).
|
||||
*
|
||||
* And the landing-ghost polish (2026-07-02): a LOW+SLOW (landed) plane that
|
||||
@@ -73,11 +74,16 @@
|
||||
* the TRACKED grounded plane gets the standalone tracked model too (the
|
||||
* owner's "tracked SWA143 at 0 kts showed a 2D billboard" case).
|
||||
*
|
||||
* And arrival-rotation freshness (2026-07-03 ground-polish): camera.moveEnd
|
||||
* forces a full rotation pass on the next frame (fly-to settles the
|
||||
* pose-signature gate can eat), and a billboard flipping INTO view while the
|
||||
* camera idles re-aims the same tick instead of wearing a stale nose for up
|
||||
* to ROTATION_REFRESH_MS. Both layers.
|
||||
* And arrival-rotation freshness (2026-07-03 ground-polish): the nose is right
|
||||
* on the first settled frame after a camera move and on the first frame a
|
||||
* hidden contact is shown again. Both layers. (The CPU rotation passes that
|
||||
* once guaranteed it are gone: the icon sets turn every icon along its drawn
|
||||
* course on the GPU each frame, so the group reads the drawn rows.)
|
||||
*
|
||||
* The probes read what the app draws through its own seams: what the camera
|
||||
* follows through the follow service (data/followed.js), icons from the draw
|
||||
* port's icon sets as the renderer holds them, models by their `{set, id}`
|
||||
* pick ids.
|
||||
*
|
||||
* Run: npm run test:track (assumes dev server already up on :4173)
|
||||
* node scripts/track-regression.mjs
|
||||
@@ -264,6 +270,98 @@ async function main() {
|
||||
try {
|
||||
const page = await browser.newPage();
|
||||
await page.evaluateOnNewDocument((base) => { window.__gevQaSourceBase = base; }, SOURCE_BASE);
|
||||
// What the camera follows, read through the app's follow service
|
||||
// (data/followed.js) rather than Cesium's `trackedEntity`: the follow
|
||||
// camera runs through the renderer's camera port, whose Cesium adapter
|
||||
// tracks a hidden helper entity, and the tracked aircraft is no longer an
|
||||
// entity at all. `__qaFollowed()` is null until the app is up (and the
|
||||
// module loaded), so every wait that reads it simply keeps polling.
|
||||
await page.evaluateOnNewDocument(() => {
|
||||
window.__qaFollowed = () => {
|
||||
// A probe that cannot read the follow service must not read as
|
||||
// "follows nothing".
|
||||
if (window.__qaFollowedError) throw new Error(`followed.js: ${window.__qaFollowedError}`);
|
||||
return window.__qaFollowedOf?.(window.__godsEyeView?.viewer) ?? null;
|
||||
};
|
||||
const timer = setInterval(() => {
|
||||
if (!window.__godsEyeView?.viewer) return;
|
||||
clearInterval(timer);
|
||||
import(`${window.__gevQaSourceBase || '/src'}/data/followed.js`)
|
||||
.then((module) => { window.__qaFollowedOf = module.followedOf; })
|
||||
.catch((error) => { window.__qaFollowedError = String(error?.message || error); });
|
||||
}, 100);
|
||||
// A contact's id from a drawn model's pick id: the draw port's models
|
||||
// carry `{set, id}`; older builds stamped the bare id.
|
||||
window.__qaModelIcao = (model) => {
|
||||
const id = model?.id;
|
||||
if (id && typeof id === 'object') return id.id == null ? null : String(id.id);
|
||||
return id == null ? null : String(id);
|
||||
};
|
||||
// A contact's FLEET icon as the renderer draws it, shaped like the
|
||||
// billboard the probes below were written against: `show`, `scale`,
|
||||
// `color` (the row's colour with its alpha column applied; focus and
|
||||
// limb recession, which the shader also folds in, are not),
|
||||
// `disableDepthTestDistance` and `position` (where the last frame drew
|
||||
// it). The draw port's icon sets draw on the GPU (one IconSetPrimitive
|
||||
// per set, rows keyed by item id; before the draw port, one a layer
|
||||
// drew itself); a set off the GPU draws Cesium
|
||||
// billboards whose pick id is `{set, id}`. The tracked icon's own set
|
||||
// (`<layer>-tracked-icon:<n>`) is left out: the fleet icon is what these
|
||||
// probes always read.
|
||||
window.__qaFindIcon = (wanted) => {
|
||||
const scene = window.__godsEyeView?.viewer?.scene;
|
||||
if (!scene) return null;
|
||||
const trackedSet = (setId) => typeof setId === 'string' && setId.includes('-tracked-icon:');
|
||||
let found = null;
|
||||
const walk = (coll) => {
|
||||
const n = coll.length;
|
||||
for (let i = 0; i < n; i++) {
|
||||
let p;
|
||||
try { p = coll.get(i); } catch { continue; }
|
||||
if (!p) continue;
|
||||
if (typeof p.length === 'number' && typeof p.get === 'function') { walk(p); continue; }
|
||||
if (p.set && typeof p.set.row === 'function' && typeof p.set.has === 'function') {
|
||||
if (!p.set.has(wanted)) continue;
|
||||
// A primitive a layer drew itself (before the draw port) names
|
||||
// no set.
|
||||
const setId = typeof p._pickObject === 'function'
|
||||
? p._pickObject(wanted, p.set, p)?.id?.set ?? null
|
||||
: null;
|
||||
if (trackedSet(setId)) continue;
|
||||
const set = p.set;
|
||||
const row = set.row(wanted);
|
||||
const color = set.color(row);
|
||||
color.alpha *= set.alpha(row);
|
||||
// (A set without the column draws over depth by default.)
|
||||
const depth = typeof set.depthTestDistance === 'function'
|
||||
? set.depthTestDistance(row)
|
||||
: Number.POSITIVE_INFINITY;
|
||||
found = {
|
||||
id: wanted,
|
||||
setId,
|
||||
show: set.shown(row),
|
||||
scale: set.scale(row),
|
||||
color,
|
||||
disableDepthTestDistance: depth >= 1e30 ? Number.POSITIVE_INFINITY : depth,
|
||||
position: set.position(row, p._tau),
|
||||
// Degrees clockwise from north: the course the last frame
|
||||
// turned the icon along (its rotation is derived from it on
|
||||
// the GPU each frame).
|
||||
course: set.course(row, p._tau),
|
||||
// Whether the row turns along that course at all (ICON_ROTATES
|
||||
// in data/iconSet.js); one that does not is drawn upright.
|
||||
rotates: (set.flags(row) & 2) !== 0,
|
||||
};
|
||||
} else if (p.image !== undefined && p.alignedAxis !== undefined) {
|
||||
const id = p.id && typeof p.id === 'object' ? p.id : { id: p.id };
|
||||
if (id.id === wanted && !trackedSet(id.set)) found = p;
|
||||
}
|
||||
}
|
||||
};
|
||||
walk(scene.primitives);
|
||||
return found;
|
||||
};
|
||||
});
|
||||
await page.setViewport({ width: 1280, height: 800 });
|
||||
await page.setRequestInterception(true);
|
||||
page.on('request', (request) => {
|
||||
@@ -701,7 +799,7 @@ async function main() {
|
||||
const tracked = manager?.layers?.get('flights')?.module?.getTrackedInfo?.();
|
||||
return manager?.isEnabled?.('flights')
|
||||
&& tracked?.icao24 === 'aaa001'
|
||||
&& window.__godsEyeView.entityRecords.read(window.__godsEyeView.viewer.trackedEntity)?.trackedId === 'flights:aaa001';
|
||||
&& window.__qaFollowed()?.key === 'flights:aaa001';
|
||||
},
|
||||
{ timeout: 30000, polling: 100 },
|
||||
);
|
||||
@@ -712,7 +810,7 @@ async function main() {
|
||||
flightsEnabled: manager.isEnabled('flights'),
|
||||
trackedId: flights.getTrackedInfo()?.icao24 || null,
|
||||
durableId: flights.getParams()?.selectedFlightsTrackingId || null,
|
||||
viewerTrackedId: window.__godsEyeView.entityRecords.read(window.__godsEyeView.viewer.trackedEntity)?.trackedId || null,
|
||||
viewerTrackedId: window.__qaFollowed()?.key || null,
|
||||
};
|
||||
});
|
||||
record(
|
||||
@@ -742,7 +840,7 @@ async function main() {
|
||||
const tracked = manager?.layers?.get('flights')?.module?.getTrackedInfo?.();
|
||||
return manager?.isEnabled?.('flights')
|
||||
&& tracked?.icao24 === 'aaa001'
|
||||
&& window.__godsEyeView.entityRecords.read(window.__godsEyeView.viewer.trackedEntity)?.trackedId === 'flights:aaa001';
|
||||
&& window.__qaFollowed()?.key === 'flights:aaa001';
|
||||
},
|
||||
{ timeout: 30000, polling: 100 },
|
||||
);
|
||||
@@ -753,7 +851,7 @@ async function main() {
|
||||
flightsEnabled: manager.isEnabled('flights'),
|
||||
trackedId: flights.getTrackedInfo()?.icao24 || null,
|
||||
durableId: flights.getParams()?.selectedFlightsTrackingId || null,
|
||||
viewerTrackedId: window.__godsEyeView.entityRecords.read(window.__godsEyeView.viewer.trackedEntity)?.trackedId || null,
|
||||
viewerTrackedId: window.__qaFollowed()?.key || null,
|
||||
};
|
||||
});
|
||||
record(
|
||||
@@ -815,7 +913,7 @@ async function main() {
|
||||
const latchedShare = await evalPage(() => ({
|
||||
tracked: window.__godsEyeView.dataManager.layers
|
||||
.get('flights').module.getTrackedInfo()?.icao24 || null,
|
||||
viewerTrackedId: window.__godsEyeView.entityRecords.read(window.__godsEyeView.viewer.trackedEntity)?.trackedId || null,
|
||||
viewerTrackedId: window.__qaFollowed()?.key || null,
|
||||
}));
|
||||
record(
|
||||
'share-v2: the pending subject latches on when it arrives on a later poll',
|
||||
@@ -1329,8 +1427,8 @@ async function main() {
|
||||
);
|
||||
}
|
||||
|
||||
// NOTE: we do NOT manually reposition the camera. Tracking sets
|
||||
// viewer.trackedEntity + a calibrated viewFrom, so the follow camera lands
|
||||
// NOTE: we do NOT manually reposition the camera. Tracking follows the
|
||||
// plane with a calibrated viewFrom, so the follow camera lands
|
||||
// in the few-km band (altitude*1.1+2500, clamped 3–30 km) — far below the
|
||||
// MODEL_ALT_CEIL_M = 800 km ceiling, so _modelRegimeActive() is true and the
|
||||
// standalone tracked model renders. That's the exact path the invariants
|
||||
@@ -1375,12 +1473,12 @@ async function main() {
|
||||
// report the neighbor's id even though the correct tracked model is up.
|
||||
const trackedInfo = fl.getTrackedInfo();
|
||||
const exactPickModel = trackedInfo
|
||||
? pool.find((model) => String(model.id) === trackedInfo.icao24)
|
||||
? pool.find((model) => window.__qaModelIcao(model) === trackedInfo.icao24)
|
||||
: null;
|
||||
if (exactPickModel) return exactPickModel;
|
||||
const ent = window.__godsEyeView.viewer.trackedEntity;
|
||||
const followed = window.__qaFollowed();
|
||||
let tracked = null;
|
||||
if (ent && typeof window.__godsEyeView.entityRecords.read(ent)?.displayPosition === 'function') tracked = window.__godsEyeView.entityRecords.read(ent)?.displayPosition();
|
||||
if (typeof followed?.displayPosition === 'function') tracked = followed.displayPosition();
|
||||
if (!tracked) return pool[0];
|
||||
let best = null, bestD = Infinity;
|
||||
for (const m of pool) {
|
||||
@@ -1398,7 +1496,7 @@ async function main() {
|
||||
};
|
||||
});
|
||||
|
||||
// Track a synthetic commercial plane. Tracking sets viewer.trackedEntity +
|
||||
// Track a synthetic commercial plane. Tracking follows it with a
|
||||
// viewFrom, so the follow camera lands in the few-km band and the standalone
|
||||
// 3D model renders (model regime active below the 800 km ceiling).
|
||||
const trackedIcao = SYNTH.flights[0].icao;
|
||||
@@ -1413,7 +1511,7 @@ async function main() {
|
||||
const ti = fl.getTrackedInfo();
|
||||
if (!ti || ti.icao24 !== icao) return false;
|
||||
const found = window.__findTrackedModel ? window.__findTrackedModel() : null;
|
||||
return !!(found && found.ready && found.show && String(found.id) === icao);
|
||||
return !!(found && found.ready && found.show && window.__qaModelIcao(found) === icao);
|
||||
}, { timeout: 60000, polling: 250 }, trackedIcao).then(() => true).catch(() => false);
|
||||
record('3D: tracked commercial model becomes ready through the DISPLAY toggle', modelUp,
|
||||
modelUp ? `ready+shown id=${trackedIcao}` : 'tracked product model never became ready+shown');
|
||||
@@ -1426,8 +1524,8 @@ async function main() {
|
||||
jitterResult = await sampleFrames(page, 30, (icao) => {
|
||||
const dm = window.__godsEyeView.dataManager;
|
||||
const fl = dm.layers.get('flights').module;
|
||||
const ent = window.__godsEyeView.viewer.trackedEntity;
|
||||
const disp = ent && typeof window.__godsEyeView.entityRecords.read(ent)?.displayPosition === 'function' ? window.__godsEyeView.entityRecords.read(ent)?.displayPosition() : null;
|
||||
const followed = window.__qaFollowed();
|
||||
const disp = typeof followed?.displayPosition === 'function' ? followed.displayPosition() : null;
|
||||
const dets = fl.getDetectableObjects({ maxCount: 1000 });
|
||||
const me = dets.find((d) => d.id === icao || d.id === (fl.getTrackedInfo() && fl.getTrackedInfo().callsign));
|
||||
if (!disp || !me || !me.position) return null;
|
||||
@@ -1572,7 +1670,7 @@ async function main() {
|
||||
mil.trackById(hex);
|
||||
await new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(r)));
|
||||
const milTrackedBefore = !!mil.getTrackedInfo();
|
||||
fl.trackById(icao); // tracking commercial flips viewer.trackedEntity → military listener fires
|
||||
fl.trackById(icao); // tracking commercial changes what the camera follows → military listener fires
|
||||
await new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(r)));
|
||||
return {
|
||||
milTrackedBefore,
|
||||
@@ -1627,16 +1725,22 @@ async function main() {
|
||||
const ti = fl.getTrackedInfo();
|
||||
if (!ti || ti.icao24 !== icao) return false;
|
||||
const found = window.__findTrackedModel ? window.__findTrackedModel() : null;
|
||||
return !!(found && found.ready && found.show && String(found.id) === icao);
|
||||
return !!(found && found.ready && found.show && window.__qaModelIcao(found) === icao);
|
||||
}, { timeout: 60000, polling: 250 }, h1Icao).then(() => true).catch(() => false);
|
||||
|
||||
if (h1ModelUp) {
|
||||
const modelPickId = await evalPage(() => {
|
||||
const m = window.__findTrackedModel();
|
||||
return m && m.id !== undefined && m.id !== null ? String(m.id) : null;
|
||||
if (!m || m.id === undefined || m.id === null) return null;
|
||||
// The draw port's pick id is `{set, id}`: the click resolver keys on
|
||||
// both, so the set must be this layer's tracked model set.
|
||||
if (typeof m.id === 'object') return { set: String(m.id.set), id: String(m.id.id) };
|
||||
return { set: null, id: String(m.id) };
|
||||
});
|
||||
record('H1: tracked standalone model exposes its pick id', modelPickId === h1Icao,
|
||||
`model.id=${JSON.stringify(modelPickId)} (want "${h1Icao}")`);
|
||||
record('H1: tracked standalone model exposes its pick id',
|
||||
modelPickId?.id === h1Icao
|
||||
&& (modelPickId.set === null || modelPickId.set.startsWith('flights-tracked-model:')),
|
||||
`model.id=${JSON.stringify(modelPickId)} (want id "${h1Icao}" in the flights tracked-model set)`);
|
||||
} else if (!glbBackendCapable) {
|
||||
skip('H1: tracked standalone model exposes its pick id',
|
||||
`independent GLB control unavailable (${glbControlDetail})`);
|
||||
@@ -1655,15 +1759,21 @@ async function main() {
|
||||
const fl = window.__godsEyeView.dataManager.layers.get('flights').module;
|
||||
const ti = fl.getTrackedInfo();
|
||||
if (!ti) return null;
|
||||
const ent = v.trackedEntity;
|
||||
const disp = ent && typeof window.__godsEyeView.entityRecords.read(ent)?.displayPosition === 'function' ? window.__godsEyeView.entityRecords.read(ent)?.displayPosition() : null;
|
||||
const followed = window.__qaFollowed();
|
||||
const disp = typeof followed?.displayPosition === 'function' ? followed.displayPosition() : null;
|
||||
const pos = disp || ti.position;
|
||||
if (!pos) return null;
|
||||
const center = v.scene.cartesianToCanvasCoordinates(pos);
|
||||
if (!center) return null;
|
||||
// The tracked plane is drawn by the layer's own tracked icon and
|
||||
// tracked model sets; a pick on either names `{set, id}`.
|
||||
const isTrackedPick = (picked) => {
|
||||
if (!picked) return null;
|
||||
if (picked.id === ent) return 'entity';
|
||||
const hit = picked.id && typeof picked.id === 'object' ? picked.id : null;
|
||||
if (hit && String(hit.id) === ti.icao24 && typeof hit.set === 'string') {
|
||||
if (hit.set.startsWith('flights-tracked-icon:')) return 'tracked-icon';
|
||||
if (hit.set.startsWith('flights-tracked-model:')) return 'tracked-model';
|
||||
}
|
||||
const raw = typeof picked.id === 'string' ? picked.id : (picked.primitive && picked.primitive.id);
|
||||
return raw === ti.icao24 ? 'icao-pick' : null;
|
||||
};
|
||||
@@ -1721,7 +1831,7 @@ async function main() {
|
||||
}, 45);
|
||||
const h1StillTracking = await evalPage((icao) => {
|
||||
const ti = window.__godsEyeView.dataManager.layers.get('flights').module.getTrackedInfo();
|
||||
return !!(ti && ti.icao24 === icao) && !!window.__godsEyeView.viewer.trackedEntity;
|
||||
return !!(ti && ti.icao24 === icao) && !!window.__qaFollowed();
|
||||
}, h1Icao);
|
||||
record('H1: click on tracked plane keeps tracking (no deselect)', h1StillTracking,
|
||||
`picked via ${h1ClickPoint.via}; still tracking=${h1StillTracking}`);
|
||||
@@ -1733,8 +1843,8 @@ async function main() {
|
||||
// ============================================================
|
||||
// REGRESSION M3 (rewritten 2026-07-02 — deliberate behavior change):
|
||||
// when the TRACKED plane ages out (3 missed polls), tracking must clear
|
||||
// and the camera must be RELEASED IN PLACE — viewer.trackedEntity
|
||||
// undefined and NO jump (the old contract flew an ~80 km overview; the
|
||||
// and the camera must be RELEASED IN PLACE — following nothing
|
||||
// and NO jump (the old contract flew an ~80 km overview; the
|
||||
// owner field-ruled that wrong: "it randomly zooms way up and loses my
|
||||
// context"). The M3 ordering fix stays: tracking is cleared BEFORE the
|
||||
// removal loop deletes the plane's state, so we never sit mid-follow
|
||||
@@ -1770,14 +1880,14 @@ async function main() {
|
||||
beforeTracking,
|
||||
atAgeOut,
|
||||
stillTrackedAfter: !!fl.getTrackedInfo(),
|
||||
viewerStillTracking: !!v.trackedEntity,
|
||||
viewerStillTracking: !!window.__qaFollowed(),
|
||||
};
|
||||
}, m3Icao);
|
||||
|
||||
record('M3: tracking cleared after the tracked plane ages out (getTrackedInfo null)',
|
||||
m3.beforeTracking && !m3.stillTrackedAfter,
|
||||
`before=${m3.beforeTracking} trackedAfter=${m3.stillTrackedAfter}`);
|
||||
record('M3: camera released after age-out (viewer.trackedEntity undefined)',
|
||||
record('M3: camera released after age-out (the camera follows nothing)',
|
||||
!m3.viewerStillTracking,
|
||||
`viewerTracked=${m3.viewerStillTracking}`);
|
||||
|
||||
@@ -1902,16 +2012,17 @@ async function main() {
|
||||
const v = window.__godsEyeView.viewer;
|
||||
const fl = window.__godsEyeView.dataManager.layers.get('flights').module;
|
||||
const labelText = () => {
|
||||
const ent = v.trackedEntity;
|
||||
const ent = window.__qaFollowed();
|
||||
if (!ent) return null;
|
||||
// Post overlay-unification the tracked text lives in the host
|
||||
// presentation model (entities are asserted native-label-free);
|
||||
// the native read stays as a fallback so this probe still fails
|
||||
// loudly if BOTH surfaces are ever absent.
|
||||
const model = window.__godsEyeView.entityRecords.read(ent)?.labelModel;
|
||||
const model = ent.labelModel;
|
||||
if (model) return [model.title, ...(model.details || [])].filter(Boolean).join('\n');
|
||||
if (!ent.label || !ent.label.text) return null;
|
||||
const t = ent.label.text;
|
||||
const label = ent.entity?.label;
|
||||
if (!label || !label.text) return null;
|
||||
const t = label.text;
|
||||
return typeof t === 'string' ? t : (t.getValue ? String(t.getValue(v.clock.currentTime)) : null);
|
||||
};
|
||||
// Track a cruise plane that IS in the feed (aaa003: 8700 m, 250 m/s —
|
||||
@@ -1956,19 +2067,7 @@ async function main() {
|
||||
const fl = dm.layers.get('flights').module;
|
||||
const mil = dm.layers.get('military').module;
|
||||
const findBB = (id) => {
|
||||
let found = null;
|
||||
const walk = (coll) => {
|
||||
const n = coll.length;
|
||||
for (let i = 0; i < n; i++) {
|
||||
let p;
|
||||
try { p = coll.get(i); } catch { continue; }
|
||||
if (!p) continue;
|
||||
if (typeof p.length === 'number' && typeof p.get === 'function') { walk(p); continue; }
|
||||
if (p.image !== undefined && p.alignedAxis !== undefined && p.id === id) found = p;
|
||||
}
|
||||
};
|
||||
walk(v.scene.primitives);
|
||||
return found;
|
||||
return window.__qaFindIcon(id);
|
||||
};
|
||||
const snap = (id) => {
|
||||
const bb = findBB(id);
|
||||
@@ -2249,19 +2348,7 @@ async function main() {
|
||||
await fl.update(v);
|
||||
await mil.update(v);
|
||||
const findBB = (id) => {
|
||||
let found = null;
|
||||
const walk = (coll) => {
|
||||
const n = coll.length;
|
||||
for (let i = 0; i < n; i++) {
|
||||
let p;
|
||||
try { p = coll.get(i); } catch { continue; }
|
||||
if (!p) continue;
|
||||
if (typeof p.length === 'number' && typeof p.get === 'function') { walk(p); continue; }
|
||||
if (p.image !== undefined && p.alignedAxis !== undefined && p.id === id) found = p;
|
||||
}
|
||||
};
|
||||
walk(v.scene.primitives);
|
||||
return found;
|
||||
return window.__qaFindIcon(id);
|
||||
};
|
||||
const flBB = findBB('aaa077');
|
||||
const milBB = findBB('bbb177');
|
||||
@@ -2296,7 +2383,7 @@ async function main() {
|
||||
try { p = coll.get(i); } catch { continue; }
|
||||
if (!p) continue;
|
||||
if (typeof p.length === 'number' && typeof p.get === 'function') { walk(p); continue; }
|
||||
if (p.modelMatrix && typeof p.ready !== 'undefined' && p.id === id) found = p;
|
||||
if (p.modelMatrix && typeof p.ready !== 'undefined' && window.__qaModelIcao(p) === id) found = p;
|
||||
}
|
||||
};
|
||||
walk(v.scene.primitives);
|
||||
@@ -2325,19 +2412,7 @@ async function main() {
|
||||
const g3dState = await evalPage(() => {
|
||||
const v = window.__godsEyeView.viewer;
|
||||
const findBB = (id) => {
|
||||
let found = null;
|
||||
const walk = (coll) => {
|
||||
const n = coll.length;
|
||||
for (let i = 0; i < n; i++) {
|
||||
let p;
|
||||
try { p = coll.get(i); } catch { continue; }
|
||||
if (!p) continue;
|
||||
if (typeof p.length === 'number' && typeof p.get === 'function') { walk(p); continue; }
|
||||
if (p.image !== undefined && p.alignedAxis !== undefined && p.id === id) found = p;
|
||||
}
|
||||
};
|
||||
walk(v.scene.primitives);
|
||||
return found;
|
||||
return window.__qaFindIcon(id);
|
||||
};
|
||||
const modelRadius = (id) => {
|
||||
const m = window.__g3dFindModel(id);
|
||||
@@ -2561,7 +2636,7 @@ async function main() {
|
||||
// dead-reckoned position rather than having been quietly repurposed.
|
||||
if (g3dTrackedUp) {
|
||||
const trackedWeld = await evalPage(() => {
|
||||
const ent = window.__godsEyeView.viewer.trackedEntity;
|
||||
const ent = window.__qaFollowed();
|
||||
const m = window.__g3dFindModel('aaa077');
|
||||
if (!m) return { error: 'no tracked model' };
|
||||
const matrix = m.modelMatrix;
|
||||
@@ -2580,10 +2655,10 @@ async function main() {
|
||||
const at = (p) => (p ? Math.hypot(
|
||||
p.x - anchor.x, p.y - anchor.y, p.z - anchor.z,
|
||||
) : null);
|
||||
const visual = typeof window.__godsEyeView.entityRecords.read(ent)?.visualPosition === 'function' ? window.__godsEyeView.entityRecords.read(ent)?.visualPosition() : null;
|
||||
const display = typeof window.__godsEyeView.entityRecords.read(ent)?.displayPosition === 'function' ? window.__godsEyeView.entityRecords.read(ent)?.displayPosition() : null;
|
||||
const visual = typeof ent?.visualPosition === 'function' ? ent?.visualPosition() : null;
|
||||
const display = typeof ent?.displayPosition === 'function' ? ent?.displayPosition() : null;
|
||||
return {
|
||||
hasVisualAccessor: typeof window.__godsEyeView.entityRecords.read(ent)?.visualPosition === 'function',
|
||||
hasVisualAccessor: typeof ent?.visualPosition === 'function',
|
||||
visualDelta: at(visual),
|
||||
displayDelta: at(display),
|
||||
};
|
||||
@@ -2688,6 +2763,21 @@ async function main() {
|
||||
// CHANGE 4 (2026-07-03): arrival rotation freshness. Field test: "planes
|
||||
// look weird when you first come to them — rotations are weird". Two
|
||||
// repaired holes, both layers:
|
||||
//
|
||||
// SINCE THE GPU ICON SETS (2c4c66c71) there is no CPU rotation pass to
|
||||
// tamper with or repair: each frame the shader turns every icon along the
|
||||
// course its row's motion segment carries at that frame's time. The
|
||||
// invariant — the nose is right on the first settled frame after a
|
||||
// camera move and on the first frame a hidden contact is shown again —
|
||||
// is now observed on the drawn rows: the on-screen nose the drawn course
|
||||
// projects to, against the one the plane's feed course projects to, at
|
||||
// the same position, on exactly those two frames (same 10° bound, same
|
||||
// per-frame budgets). That the shader turns an icon to the screen angle
|
||||
// its course projects to is the renderer's own contract, which the
|
||||
// renderer conformance reference scenes draw (course-rotated arrows,
|
||||
// top and tilted views); a CPU readback cannot see the GPU's rotation. The reveal hides and re-shows the row through the
|
||||
// layer's own icon book, the only thing that hides a fleet icon.
|
||||
// The two holes the passes repaired, for the record:
|
||||
// (a) SETTLE PASS — camera.moveEnd forces a full rotation pass on the
|
||||
// next frame (the pose-signature gate can eat a fly-to's settle:
|
||||
// the final easing frames land inside one 10 m/0.06° quantization
|
||||
@@ -2696,39 +2786,25 @@ async function main() {
|
||||
// idles gets its rotation refreshed the same tick (it used to
|
||||
// reappear wearing its stale/creation-north nose for up to 1 s).
|
||||
// Staged deterministically: park the camera nadir over the synthetic
|
||||
// cluster, let rotations settle, TAMPER a billboard's rotation, then
|
||||
// trigger each path with the camera idle. The fleet runs every 80 ms,
|
||||
// independently of rendered FPS. Observe the first completed settle frame
|
||||
// within 500 ms of forcing moveEnd and the first reveal frame within
|
||||
// 500 ms of that settle frame: each budget sits inside the 1 s idle
|
||||
// rotation refresh that could otherwise repair an incorrect first reveal,
|
||||
// and a ~300 ms headless SwiftShader frame fits inside each of them.
|
||||
// cluster, let it settle, then trigger each path with the camera idle.
|
||||
// Observe the first completed settle frame within 500 ms of forcing
|
||||
// moveEnd and the first reveal frame within 500 ms of that settle frame
|
||||
// (the budgets once sat inside the 1 s idle rotation refresh; they are
|
||||
// kept as they were).
|
||||
// ============================================================
|
||||
console.log('\nChange 4 — arrival rotation: moveEnd settle pass + horizon-reveal pass');
|
||||
console.log('\nChange 4 — arrival rotation: the drawn nose on the settle frame and the first reveal');
|
||||
const arrival = await evalPage(async () => {
|
||||
const v = window.__godsEyeView.viewer;
|
||||
const dm = window.__godsEyeView.dataManager;
|
||||
const { screenProjectedRotation } = await import(`${window.__gevQaSourceBase || '/src'}/data/iconOrientation.js`);
|
||||
const { observeArrivalRotationWithRetry } = await import(`${window.__gevQaSourceBase || '/src'}/tooling/trackArrivalObservation.mjs`);
|
||||
// 3D models OFF for this phase: a model-handed-off billboard is hidden
|
||||
// and skips rotation updates entirely — the probes need live billboards
|
||||
// (this is also the app's default state the field report came from).
|
||||
// 3D models OFF for this phase: a model-handed-off icon is hidden, and
|
||||
// the probes need shown icons (this is also the app's default state the
|
||||
// field report came from).
|
||||
dm.layers.get('flights').module.setParams({ models3d: false });
|
||||
dm.layers.get('military').module.setParams({ models3d: false });
|
||||
const findBB = (id) => {
|
||||
let found = null;
|
||||
const walk = (coll) => {
|
||||
const n = coll.length;
|
||||
for (let i = 0; i < n; i++) {
|
||||
let p;
|
||||
try { p = coll.get(i); } catch { continue; }
|
||||
if (!p) continue;
|
||||
if (typeof p.length === 'number' && typeof p.get === 'function') { walk(p); continue; }
|
||||
if (p.image !== undefined && p.alignedAxis !== undefined && p.id === id) found = p;
|
||||
}
|
||||
};
|
||||
walk(v.scene.primitives);
|
||||
return found;
|
||||
return window.__qaFindIcon(id);
|
||||
};
|
||||
const nextFrames = (n) => new Promise((res) => {
|
||||
let count = 0;
|
||||
@@ -2752,8 +2828,8 @@ async function main() {
|
||||
});
|
||||
// Park the camera straight above the flights cluster (lift a live
|
||||
// billboard's position radially — no Cesium global needed in-page) so
|
||||
// every probe plane projects on-screen, then let rotations settle at
|
||||
// the new pose (the setView pose change forces a pass on the next tick).
|
||||
// every probe plane projects on-screen, then let a few frames draw at
|
||||
// the new pose.
|
||||
// aaa002 — aaa001 was evicted for good by the M3 age-out phase.
|
||||
const anchor = findBB('aaa002');
|
||||
if (!anchor) return { error: 'anchor aaa002 missing' };
|
||||
@@ -2767,62 +2843,91 @@ async function main() {
|
||||
});
|
||||
await nextFrames(3);
|
||||
const angDiff = (a, b) => Math.abs(Math.atan2(Math.sin(a - b), Math.cos(a - b)));
|
||||
const probe = async (id, course) => {
|
||||
const probe = async (layer, id, course) => {
|
||||
const bb = findBB(id);
|
||||
if (!bb || !bb.show) return { error: `${id} missing/hidden` };
|
||||
const r0 = bb.rotation; // settled tamper origin; correctness uses a fresh projection below
|
||||
if (!Number.isFinite(bb.course) && !Number.isFinite(bb.rotation)) {
|
||||
return { error: `${id} has no drawn course or rotation` };
|
||||
}
|
||||
const setIconShown = layer.testing?._setIconForTest;
|
||||
if (typeof setIconShown !== 'function') return { error: `${id}: the layer has no icon test seam` };
|
||||
// The on-screen nose the drawn row shows now, against the feed's.
|
||||
const drawnError = () => {
|
||||
const now = findBB(id);
|
||||
if (!now) return { shown: false, rotationError: NaN };
|
||||
// A GPU row is turned along its drawn course, or drawn upright; a
|
||||
// billboard carries its screen rotation itself.
|
||||
const drawn = Number.isFinite(now.course)
|
||||
? (now.rotates ? screenProjectedRotation(v.scene, now.position, now.course, null) : 0)
|
||||
: now.rotation;
|
||||
return {
|
||||
shown: !!now.show,
|
||||
rotationError: angDiff(drawn, screenProjectedRotation(v.scene, now.position, course, null)),
|
||||
};
|
||||
};
|
||||
const hasModel = !!(window.__g3dFindModel && window.__g3dFindModel(id));
|
||||
// A wall-clock timeout is inconclusive, not a wrong angle: the frame
|
||||
// landed where the 1 s idle refresh could already have repaired it
|
||||
// (seen once on headless SwiftShader: a 926 ms first frame). Such an
|
||||
// observation gets one more attempt; one that measured a wrong angle —
|
||||
// a wrong first reveal, or a wrong settle frame before a reveal
|
||||
// timeout — never does.
|
||||
// The settle/reveal budgets and the retry were written for the removed
|
||||
// CPU passes (a frame late enough for the 1 s idle refresh to repair
|
||||
// it was inconclusive); they are kept unchanged as a guard. A
|
||||
// wall-clock timeout gets one more attempt; one that measured a wrong
|
||||
// angle — a wrong first reveal, or a wrong settle frame before a
|
||||
// reveal timeout — never does.
|
||||
//
|
||||
// The reveal: the row is hidden right after the settle frame, a frame
|
||||
// must actually draw it hidden, and only then is it shown again, so
|
||||
// the frame measured is the first one that draws it after a hidden
|
||||
// frame.
|
||||
let revealArmed = false;
|
||||
let hiddenFrames = 0;
|
||||
const observed = await observeArrivalRotationWithRetry({
|
||||
async prepare() {
|
||||
// Freshen both layers' rotation passes right before the probe, so
|
||||
// the settle frame is measured against a pass that just ran rather
|
||||
// than one left over from the previous probe — with the camera
|
||||
// idle, a layer otherwise runs a pass only every
|
||||
// ROTATION_REFRESH_MS.
|
||||
// One settled camera move and a frame before each attempt, as the
|
||||
// passes once needed (the layers' moveEnd now runs their fleet
|
||||
// pass on the next frame).
|
||||
revealArmed = false;
|
||||
hiddenFrames = 0;
|
||||
v.camera.moveEnd.raiseEvent();
|
||||
await nextFrames(1);
|
||||
},
|
||||
scene: v.scene,
|
||||
startMoveEnd() {
|
||||
// Only moveEnd can repair the tampered angle at the idle pose.
|
||||
bb.rotation = r0 + 1.5;
|
||||
v.camera.moveEnd.raiseEvent();
|
||||
},
|
||||
startReveal() {
|
||||
// Hide immediately after the confirmed settle frame. The next
|
||||
// eligible fleet tick must reveal AND re-aim in that same tick.
|
||||
bb.rotation = r0 + 1.5;
|
||||
bb.show = false;
|
||||
// Hide immediately after the confirmed settle frame, through the
|
||||
// layer's icon book (written to the draw set as this task ends).
|
||||
setIconShown(id, { shown: false });
|
||||
revealArmed = true;
|
||||
},
|
||||
read() {
|
||||
return {
|
||||
shown: bb.show,
|
||||
rotationError: angDiff(bb.rotation,
|
||||
screenProjectedRotation(v.scene, bb.position, course, null)),
|
||||
};
|
||||
const sample = drawnError();
|
||||
// A frame drew it hidden: show it again for the next one.
|
||||
if (revealArmed && sample.shown === false) {
|
||||
hiddenFrames += 1;
|
||||
revealArmed = false;
|
||||
setIconShown(id, { shown: true });
|
||||
}
|
||||
return sample;
|
||||
},
|
||||
});
|
||||
return { r0, ...observed, hasModel };
|
||||
// A reveal is only one after a frame drew the row hidden.
|
||||
if (!observed.error && hiddenFrames === 0) {
|
||||
return { ...observed, error: 'no frame drew the row hidden before its reveal', hasModel };
|
||||
}
|
||||
return { ...observed, hiddenFrames, hasModel };
|
||||
};
|
||||
const flightCourse = window.__SYNTH.flights.find((f) => f.icao === 'aaa002')?.track ?? 0;
|
||||
const militaryCourse = window.__SYNTH.military.find((m) => m.hex === 'bbb101')?.track ?? 0;
|
||||
return {
|
||||
flights: await probe('aaa002', flightCourse),
|
||||
military: await probe('bbb101', militaryCourse),
|
||||
flights: await probe(dm.layers.get('flights').module, 'aaa002', flightCourse),
|
||||
military: await probe(dm.layers.get('military').module, 'bbb101', militaryCourse),
|
||||
};
|
||||
});
|
||||
const fmtArr = (a) => (!a ? `no result (${arrival?.error || 'phase error'})` : a.error ? `${a.error}; ${arrivalAngleViolated(a) ? 'angle violation (not retried); ' : ''}${Number.isFinite(a.dMoveEnd) ? `settle-err=${(a.dMoveEnd * 180 / Math.PI).toFixed(1)}° ` : ''}${Number.isFinite(a.dReveal) ? `reveal-err=${(a.dReveal * 180 / Math.PI).toFixed(1)}° ` : ''}elapsed=${Number(a.elapsedMs).toFixed(1)} ms attempts=${a.attempts}`
|
||||
: `settle-err=${(a.dMoveEnd * 180 / Math.PI).toFixed(1)}° reveal-err=${(a.dReveal * 180 / Math.PI).toFixed(1)}° shown=${a.shown} flipFrame=${a.flipFrame} settle=${a.moveEndMs.toFixed(1)} ms reveal=${a.revealMs.toFixed(1)} ms total=${a.elapsedMs.toFixed(1)} ms attempts=${a.attempts} hasModel=${a.hasModel}`);
|
||||
const TAMPER_DEG = 1.5 * 180 / Math.PI; // ≈ 86° — an uncorrected nose stays this far off
|
||||
record(`arrival: moveEnd + first reveal both re-aim before idle refresh, flights (tamper was ${TAMPER_DEG.toFixed(0)}°)`,
|
||||
record('arrival: the drawn nose is right on the settle frame and the first reveal, flights',
|
||||
arrivalRotationPassed(arrival.flights), fmtArr(arrival.flights));
|
||||
record(`arrival: moveEnd + first reveal both re-aim before idle refresh, military (tamper was ${TAMPER_DEG.toFixed(0)}°)`,
|
||||
record('arrival: the drawn nose is right on the settle frame and the first reveal, military',
|
||||
arrivalRotationPassed(arrival.military), fmtArr(arrival.military));
|
||||
|
||||
// ============================================================
|
||||
@@ -2883,18 +2988,7 @@ async function main() {
|
||||
};
|
||||
fl.setParams({ models3d: false }); // billboards own the visual (T7 gate open)
|
||||
window.__dfFindBB = (id) => {
|
||||
let found = null;
|
||||
const walk = (coll) => {
|
||||
const n = coll.length;
|
||||
for (let i = 0; i < n; i++) {
|
||||
let p; try { p = coll.get(i); } catch { continue; }
|
||||
if (!p) continue;
|
||||
if (typeof p.length === 'number' && typeof p.get === 'function') { walk(p); continue; }
|
||||
if (p.image !== undefined && p.alignedAxis !== undefined && p.id === id) found = p;
|
||||
}
|
||||
};
|
||||
walk(v.scene.primitives);
|
||||
return found;
|
||||
return window.__qaFindIcon(id);
|
||||
};
|
||||
window.__dfCarto = (pos) => {
|
||||
const c = Cesium.Cartographic.fromCartesian(pos, Cesium.Ellipsoid.WGS84);
|
||||
@@ -2980,7 +3074,7 @@ async function main() {
|
||||
if (!p) continue;
|
||||
if (typeof p.length === 'number' && typeof p.get === 'function') { walk(p); continue; }
|
||||
if (p.activeAnimations !== undefined && p.minimumPixelSize !== undefined) {
|
||||
if (icao !== undefined && p.id !== icao) continue;
|
||||
if (icao !== undefined && window.__qaModelIcao(p) !== icao) continue;
|
||||
if (p.show) {
|
||||
shown += 1;
|
||||
if (p.ready === true) rendering += 1;
|
||||
@@ -3005,7 +3099,7 @@ async function main() {
|
||||
if (!p) continue;
|
||||
if (typeof p.length === 'number' && typeof p.get === 'function') { walk(p); continue; }
|
||||
if (p.activeAnimations !== undefined && p.minimumPixelSize !== undefined
|
||||
&& p.id === icao && p.modelMatrix) {
|
||||
&& window.__qaModelIcao(p) === icao && p.modelMatrix) {
|
||||
const m = p.modelMatrix;
|
||||
// Cesium's default is the IDENTITY matrix — translation (0,0,0),
|
||||
// the Earth's centre, which `Cartographic.fromCartesian` refuses.
|
||||
@@ -3405,7 +3499,7 @@ async function main() {
|
||||
// the sensor value the data APIs report, at whatever regime the camera
|
||||
// is currently in.
|
||||
const readTracked = () => {
|
||||
const pos = v.trackedEntity?.position?.getValue(Cesium.JulianDate.now());
|
||||
const pos = window.__qaFollowed()?.position?.();
|
||||
if (!pos) return null;
|
||||
const c = window.__dfCarto(pos);
|
||||
const info = fl.getTrackedInfo();
|
||||
@@ -3480,19 +3574,19 @@ async function main() {
|
||||
for (let i = 0; i < collection.length; i++) {
|
||||
const item = collection.get(i);
|
||||
if (typeof item?.get === 'function' && typeof item.length === 'number') walk(item);
|
||||
else if (item?.id === 'aaa097' && item.activeAnimations !== undefined
|
||||
else if (window.__qaModelIcao(item) === 'aaa097' && item.activeAnimations !== undefined
|
||||
&& item.minimumPixelSize !== undefined) found = item;
|
||||
}
|
||||
};
|
||||
walk(v.scene.primitives);
|
||||
return found;
|
||||
};
|
||||
const trackedEntity = v.trackedEntity;
|
||||
const trackedEntity = window.__qaFollowed();
|
||||
const trackedModel = findOwnModel();
|
||||
const achievedOut = await window.__dfZoomAbove(window.__dfRegime.exit + 5000);
|
||||
const zoomedOut = await window.__dfObserveTrackedExit({
|
||||
scene: v.scene, trackedEntity, trackedModel, getTrackedModel: findOwnModel,
|
||||
getTrackedEntity: () => v.trackedEntity,
|
||||
getTrackedEntity: () => window.__qaFollowed(),
|
||||
getTrackedId: () => fl.getTrackedInfo()?.icao24,
|
||||
getCameraHeight: window.__dfCamH, exitHeight: window.__dfRegime.exit,
|
||||
read: readTracked,
|
||||
@@ -3660,7 +3754,7 @@ async function main() {
|
||||
return { skipped: 'no tracked model rendered in this browser' };
|
||||
}
|
||||
// While the model IS the visual the clamp must stand aside (T7).
|
||||
const entWith = v.trackedEntity?.position?.getValue(Cesium.JulianDate.now());
|
||||
const entWith = window.__qaFollowed()?.position?.();
|
||||
const withModelH = entWith ? window.__dfCarto(entWith).h : null;
|
||||
// Close the deterministic skin again for the rest of the group. The
|
||||
// model is up on a snap that is already cached, so it stays up until the
|
||||
@@ -3675,7 +3769,7 @@ async function main() {
|
||||
// contact's primitive, and an unrelated model in the scene must not be
|
||||
// able to answer it either way.
|
||||
const afterOut = window.__dfCountModels('aaa097');
|
||||
const ent = v.trackedEntity?.position?.getValue(Cesium.JulianDate.now());
|
||||
const ent = window.__qaFollowed()?.position?.();
|
||||
const c = ent ? window.__dfCarto(ent) : null;
|
||||
// Plant a floor above wherever it now renders so "floored" is decisive.
|
||||
// Mesh cells latch ONE-SHOT, so the earlier scenario's seed would win
|
||||
@@ -3696,7 +3790,7 @@ async function main() {
|
||||
// from mistaking a cached same-frame position for a failed clamp.
|
||||
v.scene.requestRender();
|
||||
await window.__dfSettle(900);
|
||||
const ent2 = v.trackedEntity?.position?.getValue(Cesium.JulianDate.now());
|
||||
const ent2 = window.__qaFollowed()?.position?.();
|
||||
const c2 = ent2 ? window.__dfCarto(ent2) : null;
|
||||
const out = {
|
||||
toggleOff,
|
||||
@@ -3788,7 +3882,7 @@ async function main() {
|
||||
let p; try { p = coll.get(i); } catch { continue; }
|
||||
if (!p) continue;
|
||||
if (typeof p.length === 'number' && typeof p.get === 'function') { walk(p); continue; }
|
||||
if (p.activeAnimations !== undefined && p.minimumPixelSize !== undefined && p.id === id) found = p;
|
||||
if (p.activeAnimations !== undefined && p.minimumPixelSize !== undefined && window.__qaModelIcao(p) === id) found = p;
|
||||
}
|
||||
};
|
||||
walk(v.scene.primitives);
|
||||
@@ -3804,19 +3898,30 @@ async function main() {
|
||||
fl.setParams({ models3d: false });
|
||||
return { skipped: 'no fleet model for aaa097 in this browser' };
|
||||
}
|
||||
// The layer decides who owns the visual from its OWN record of the
|
||||
// model (data/modelRecord.js: `ready` from the draw set's ready event,
|
||||
// `show` as it last sent it), not from the renderer's model object, so
|
||||
// the shown-but-not-ready state is planted on that record. The record
|
||||
// is the registered layer's own, reached through its test seam.
|
||||
const fleetRecord = await fl.testing?._ensureFleetModelForTest?.('aaa097');
|
||||
if (!fleetRecord || typeof fleetRecord !== 'object') {
|
||||
fl.setParams({ models3d: false });
|
||||
return { error: 'the flights layer has no model record for aaa097' };
|
||||
}
|
||||
// Accessors with SWALLOWING setters, not data properties: the fleet tick
|
||||
// assigns `model.show = false` for a not-ready model, and assigning to a
|
||||
// assigns `show = false` for a not-ready model, and assigning to a
|
||||
// non-writable own property throws in strict mode — which lands inside
|
||||
// Cesium's render loop and stops rendering for the rest of the run.
|
||||
const priorReady = Object.getOwnPropertyDescriptor(fleetModel, 'ready');
|
||||
const priorShow = Object.getOwnPropertyDescriptor(fleetModel, 'show');
|
||||
// the render loop and stops rendering for the rest of the run.
|
||||
const priorReady = Object.getOwnPropertyDescriptor(fleetRecord, 'ready');
|
||||
const priorShow = Object.getOwnPropertyDescriptor(fleetRecord, 'show');
|
||||
let armed = false;
|
||||
let processedFrame = null;
|
||||
let sample = null;
|
||||
let sampledRecord = null;
|
||||
let removePostRender = null;
|
||||
try {
|
||||
Object.defineProperty(fleetModel, 'ready', { get: () => false, set: () => {}, configurable: true });
|
||||
Object.defineProperty(fleetModel, 'show', {
|
||||
Object.defineProperty(fleetRecord, 'ready', { get: () => false, set: () => {}, configurable: true });
|
||||
Object.defineProperty(fleetRecord, 'show', {
|
||||
get: () => true,
|
||||
set: (value) => {
|
||||
// Both the not-ready handoff and horizon cull clear show AFTER
|
||||
@@ -3830,7 +3935,10 @@ async function main() {
|
||||
});
|
||||
const bb = window.__dfFindBB('aaa097');
|
||||
if (!bb) return { error: 'aaa097 billboard missing' };
|
||||
bb.show = true; // the handoff would not have hidden it: the model is not ready
|
||||
// (The icon is not forced shown here, as the old billboard fixture did:
|
||||
// the renderer draws what the layer sends, so the handoff the record
|
||||
// drives is the only thing that decides it.)
|
||||
const sameIcon = (a, b) => !!a && !!b && (a === b || (a.setId === b.setId && a.id === b.id));
|
||||
const d0 = window.__dfCarto(bb.position);
|
||||
gf._clearMeshFloorCellsForTest();
|
||||
// Earlier display-floor scenarios deliberately leave this contact's
|
||||
@@ -3853,13 +3961,18 @@ async function main() {
|
||||
sample = {
|
||||
fleetTickCompleted: true,
|
||||
fleetFrame: v.scene.frameState.frameNumber,
|
||||
fleetModelReady: fleetModel.ready,
|
||||
fleetModelShow: fleetModel.show,
|
||||
fleetModelReady: fleetRecord.ready,
|
||||
fleetModelShow: fleetRecord.show,
|
||||
fleetBillboardVisible: !!currentBb?.show,
|
||||
fleetSeeded: seededFleet,
|
||||
fleetH: currentBb ? window.__dfCarto(currentBb.position).h : null,
|
||||
};
|
||||
if (currentBb !== bb || currentModel !== fleetModel || fleetModel.isDestroyed()
|
||||
// (An older build's seam answers asynchronously: its answer is
|
||||
// checked once the frame is done, below.)
|
||||
const currentRecord = fl.testing._ensureFleetModelForTest('aaa097');
|
||||
if (typeof currentRecord?.then === 'function') sampledRecord = currentRecord;
|
||||
else if (currentRecord !== fleetRecord) sample.error = 'fleet loading fixture changed before its completed frame';
|
||||
if (!sameIcon(currentBb, bb) || currentModel !== fleetModel || fleetModel.isDestroyed()
|
||||
|| fl.getTrackedInfo()) sample.error = 'fleet loading fixture changed before its completed frame';
|
||||
});
|
||||
armed = true;
|
||||
@@ -3870,14 +3983,17 @@ async function main() {
|
||||
await window.__dfSettle(50);
|
||||
} while (!sample && Date.now() < tickDeadline);
|
||||
if (!sample) return { error: 'fleet loading fixture did not complete an aircraft update within 5000 ms' };
|
||||
if (sampledRecord && (await sampledRecord) !== fleetRecord) {
|
||||
sample.error = 'fleet loading fixture changed before its completed frame';
|
||||
}
|
||||
Object.assign(out, sample);
|
||||
} finally {
|
||||
armed = false;
|
||||
removePostRender?.();
|
||||
if (priorReady) Object.defineProperty(fleetModel, 'ready', priorReady);
|
||||
else delete fleetModel.ready;
|
||||
if (priorShow) Object.defineProperty(fleetModel, 'show', priorShow);
|
||||
else delete fleetModel.show;
|
||||
if (priorReady) Object.defineProperty(fleetRecord, 'ready', priorReady);
|
||||
else delete fleetRecord.ready;
|
||||
if (priorShow) Object.defineProperty(fleetRecord, 'show', priorShow);
|
||||
else delete fleetRecord.show;
|
||||
fl.setParams({ models3d: false });
|
||||
}
|
||||
await window.__dfSettle(400);
|
||||
@@ -3888,7 +4004,7 @@ async function main() {
|
||||
// it finishes. Sample within that window.
|
||||
if (!fl.trackById('aaa097')) return { ...out, error: 'trackById(aaa097) failed' };
|
||||
await window.__dfSettle(500);
|
||||
const entBefore = v.trackedEntity?.position?.getValue(Cesium.JulianDate.now());
|
||||
const entBefore = window.__qaFollowed()?.position?.();
|
||||
const cBefore = entBefore ? window.__dfCarto(entBefore) : null;
|
||||
gf._clearMeshFloorCellsForTest();
|
||||
fl._clearDisplayFloorStateForTest();
|
||||
@@ -3910,7 +4026,7 @@ async function main() {
|
||||
// billboard-owned. The shared helper keys models by their pick id and
|
||||
// uses the production ownership pair (`show && ready`).
|
||||
out.renderingModelsDuringLoad = window.__dfCountModels('aaa097').rendering;
|
||||
const entLoad = v.trackedEntity?.position?.getValue(Cesium.JulianDate.now());
|
||||
const entLoad = window.__qaFollowed()?.position?.();
|
||||
out.trackedSeeded = seededTracked;
|
||||
out.trackedLoadH = entLoad ? window.__dfCarto(entLoad).h : null;
|
||||
fl.setParams({ models3d: false });
|
||||
@@ -4030,7 +4146,12 @@ async function main() {
|
||||
const taxiCarto = window.__dfCarto(taxiPos);
|
||||
const baseMeshM = gfns?.cachedMeshFloor?.(baseCarto.lat, baseCarto.lon) ?? null;
|
||||
const taxiMeshM = gfns?.cachedMeshFloor?.(taxiCarto.lat, taxiCarto.lon) ?? null;
|
||||
// The layer writes its icon changes to the draw set together once the
|
||||
// current task's microtasks run (data/aircraftIconLayer.js), so the
|
||||
// drawn row is read after that write, with no frame in between.
|
||||
const iconWrites = () => Promise.resolve();
|
||||
const heldOwns = ns._driveFleetModelHandoffForTest({ icao24: holdIcao, position: taxiPos, course: 90 });
|
||||
await iconWrites();
|
||||
const heldH = window.__dfModelHeight(holdIcao);
|
||||
const heldBb = !!window.__dfFindBB(holdIcao)?.show;
|
||||
|
||||
@@ -4038,6 +4159,7 @@ async function main() {
|
||||
// been. It is released rather than stretched, and the gate takes over.
|
||||
const farPos = Cesium.Cartesian3.fromDegrees(base.lon + 0.004, base.lat, base.h);
|
||||
const releasedOwns = ns._driveFleetModelHandoffForTest({ icao24: holdIcao, position: farPos, course: 90 });
|
||||
await iconWrites();
|
||||
const releasedBb = !!window.__dfFindBB(holdIcao)?.show;
|
||||
|
||||
fl.setParams({ models3d: false });
|
||||
|
||||
Reference in new issue
Block a user