fix(voice): Navara refusals reach speech, analyst queries and stop_tracking

Review of 10a (low):
- The spoken answer to set_layer_visibility on a layer this engine lacks is
  the refusal's own sentence (why, and the switch to ?engine=cesium), not
  only "Couldn't turn on".
- analyst_query naming layers the catalog left out (no viewer) refuses with
  UNAVAILABLE_ON_ENGINE and the layer ids instead of answering zero.
- stop_tracking skips layers the engine does not have, so with nothing
  tracked it is a no-op success on Navara (it reported the absent military
  and satellites layers as failures).
Tests for each (the old code fails the last two); Cesium unchanged.
This commit is contained in:
German Khokhlov committed 2026-10-17 01:18:12 +04:00
1 parent 443c581280
commit 1dd3220812
3 files changed
+86 -1

No files matched your search

+28 -1
View File
@@ -332,7 +332,9 @@ function unavailableOnEngine(
engine: engine?.kind ?? null,
feature: what,
suggestion: SWITCH_ENGINE_HINT,
error: `${what} is not available on ${engineName(engine)} yet. Switch to the Cesium engine (${SWITCH_ENGINE_HINT}) to use it.`,
error: /\blayers$/.test(what)
? `${what} are not available on ${engineName(engine)} yet. Switch to the Cesium engine (${SWITCH_ENGINE_HINT}) to use them.`
: `${what} is not available on ${engineName(engine)} yet. Switch to the Cesium engine (${SWITCH_ENGINE_HINT}) to use it.`,
};
}
@@ -1110,6 +1112,29 @@ export function createGevActionRunner({
}
if (name === 'analyst_query') {
// Layers this engine's catalog left out cannot be asked: say so rather
// than answer zero.
const missing = !viewer
? (Array.isArray(args.layers) ? args.layers : [])
.map(normalizeLayerId)
.filter(
(layerId) =>
layerId &&
voiceLayer(layerId) &&
!dataManager.layers.has(layerId),
)
: [];
if (missing.length)
return {
...unavailableOnEngine(
'analyst_query',
engine,
missing.length === 1
? `The ${missing[0]} layer`
: `The ${missing.join(', ')} layers`,
),
layerIds: missing,
};
return runAnalystQuery(
ensureAnalystEngine(),
dataManager,
@@ -2484,6 +2509,8 @@ function stopAllTracking(engine, dataManager) {
['military', 'selectedMilitaryTrackingId'],
['satellites', 'selectedSatTrackingId'],
]) {
// A layer this engine does not have tracks nothing to clear.
if (dataManager.layers && !dataManager.layers.has(layerId)) continue;
try {
if (
dataManager.setLayerParams(