mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
fix(voice): keep canonical analyst IDs out of display-text normalization
compactAnalystItem normalized every string field, including `id`. Bikeshare uses the raw station name as its ID, so a station with repeated spaces or a name over 180 code units was registered as a referent under a different key and a numbered fly_to_location reported it as no longer loaded. Normalize display fields only; layerKey, id, icao24, mmsi, noradId, registration and callsign pass through as the layer reports them. Adds an analyst_query -> referent -> fly_to_location test for repeated-space and long station names, and documents the rule in docs/CURRENT-STATE.md. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
445af0875b
commit
cbca6a228d
3 files changed
+65
-3
No files matched your search
+19
-1
@@ -4570,6 +4570,21 @@ const ANALYST_IDENTITY_FIELDS = Object.freeze([
|
||||
'noradId',
|
||||
]);
|
||||
|
||||
/**
|
||||
* Analyst item keys that identify a record rather than describe it: the
|
||||
* referent registry, track_entity and locateLayerEntity match on them, so
|
||||
* display-text normalization must leave them byte-for-byte unchanged.
|
||||
*/
|
||||
const ANALYST_CANONICAL_FIELDS = new Set([
|
||||
'layerKey',
|
||||
'id',
|
||||
'icao24',
|
||||
'mmsi',
|
||||
'noradId',
|
||||
'registration',
|
||||
'callsign',
|
||||
]);
|
||||
|
||||
/**
|
||||
* Compact one analyst record for the voice payload: identity, position (so a
|
||||
* follow-up can fly to it), distance, and that layer's manifest fields with
|
||||
@@ -4607,8 +4622,11 @@ function compactAnalystItem(r) {
|
||||
} else compact[key] = r[key];
|
||||
}
|
||||
if (present(r.ageHours)) compact.ageHours = r.ageHours;
|
||||
// Display text only: canonical keys are lookup identities (bikeshare uses
|
||||
// the raw station name as its id), so the referent registry and
|
||||
// locateLayerEntity must see them exactly as the layer reports them.
|
||||
for (const key of Object.keys(compact)) {
|
||||
if (typeof compact[key] === 'string')
|
||||
if (typeof compact[key] === 'string' && !ANALYST_CANONICAL_FIELDS.has(key))
|
||||
compact[key] = normalizeDisplayText(compact[key]);
|
||||
}
|
||||
return compact;
|
||||
|
||||
Reference in new issue
Block a user