Keep tracked-entity state in app records instead of on Cesium entities

Flights, military, satellites, installations, local ADS-B and ALPR hung
gevTrackedId, gevDisplayPosition, gevVisualPosition, gevSelectionOrigin and
gevLabelModel on the Cesium entities they draw, and the tracked readout,
follow camera, cockpit, share links and awareness read them back. They now
live in src/data/entityRecords.js, an app-owned record per entity: layers
write entityRecord(entity), readers use readEntityRecord(entity). Nothing
changes on screen. This is the first slice of the renderer plan's state
mirror (P1).

The module is exported as ./data/entity-records so callers can read the
same records, and window.__godsEyeView.entityRecords gives the QA scripts
the same access from the page.
This commit is contained in:
Sameh Khamis committed 2026-11-03 08:09:00 -08:00
1 parent ea69bb4ce2
commit 65587f6c08
53 files changed
+408 -291

No files matched your search

+5 -4
View File
@@ -33,6 +33,7 @@ import militaryFlightsLayer, {
import { findCompatibleHistoryIndex } from './militaryAwareness.js';
import { createGevActionRunner } from '../voice/gevActions.js';
import { ANALYST_LAYERS, createAnalystEngine } from './analystEngine.js';
import { readEntityRecord, withEntityRecord } from './entityRecords.js';
/** Strip block and line comments so source pins scan CODE, not prose. */
function stripComments(source) {
@@ -149,7 +150,7 @@ test('a conversion survives a poll refresh, in both the billboard and the tracke
const icao24 = 'a1b2c3';
setTr3b(icao24, true);
const entity = { gevLabelModel: { title: 'OLD', details: [] } };
const entity = withEntityRecord({}, { labelModel: { title: 'OLD', details: [] } });
const billboard = {
position: Cesium.Cartesian3.fromDegrees(-97.7, 30.2, 9_000),
color: Cesium.Color.WHITE,
@@ -212,11 +213,11 @@ test('a conversion survives a poll refresh, in both the billboard and the tracke
assert.equal(billboard.image, aircraftIcon('tr3b'),
'the poll reconciler re-images through the TR-3B resolver, not the raw class');
// Live telemetry keeps flowing; only the class label is the operator's fiction.
assert.match(entity.gevLabelModel.title, /^DAL123 · FL350 · 486 kts$/);
assert.deepEqual(entity.gevLabelModel.details.slice(0, 1), ['TR-3B'],
assert.match(readEntityRecord(entity)?.labelModel.title, /^DAL123 · FL350 · 486 kts$/);
assert.deepEqual(readEntityRecord(entity)?.labelModel.details.slice(0, 1), ['TR-3B'],
'the tracked card class line reports TR-3B, replacing operator/type');
assert.equal(
[entity.gevLabelModel.title, ...entity.gevLabelModel.details].join(' · ').includes('Southwest'),
[readEntityRecord(entity)?.labelModel.title, ...readEntityRecord(entity)?.labelModel.details].join(' · ').includes('Southwest'),
false,
'the real operator is not shown alongside the TR-3B classification',
);