From 29d0fa6e0b39cece96dd1db761dd498d19ba9741 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Wed, 18 Nov 2026 17:54:28 -0800 Subject: [PATCH] Keep satellite tracking stopped by a place search through the Space Missions restore A place search or fly-to stops satellite tracking with the tool origin, which the saved Satellites state did not take in, so a satellite tracked by voice during the mission was tracked again when Space Missions ended. The saved state now takes in every deliberate Satellites setting (person, voice or tool), as the layer state does. Co-authored-by: Manjunath Paparaju --- docs/CURRENT-STATE.md | 2 +- src/layers/launches/failedEntry.test.mjs | 29 ++++++++++++++++++++++++ src/layers/launches/satelliteIntents.js | 18 +++++++++++---- 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 6c31ba08c0..f707354ef6 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -7338,7 +7338,7 @@ silently demoting every later lookup for the session. - Context is set for reading in every theme: mode, standby and action labels are 10 px, and the panel draws no glow halo. The two modes form one segmented control, the standby guidance is plain left-aligned text rather than a dashed placeholder, and the panel's section titles share the side panels' dock-label colour. - The expanded desktop header omits the redundant `ON` label; the active mode button carries state. Expanded Contact results also omit the duplicate `GLOBAL CONTEXT` / `CONTEXT ONLY` status row and begin with the selected subject and its 250 km scope. Global Context does not fabricate a selected-entity model preview: the provisional hand-authored aircraft wireframe was removed because it was not geometry extracted from the selected entity's actual asset. - Dependency ownership is reversible: disabling Global Context releases only dependencies it enabled, while user-enabled layers remain on. This also removes the Military-layer suppression handoff when Global Context owned Military, allowing an already-enabled civilian Flights layer to resume its normal mixed rendering. If OpenSky is unavailable and has no last-good cache, Flights requests a capped 250 nm adsb.lol point snapshot around the current view anchor and labels that provenance explicitly; it never relabels military-feed rows as civilian data. If both inputs fail, Flights remains `UNKNOWN`. -- Space Missions is an ordinary layer, not a Context mode. It neither isolates the globe nor refuses other layers, opens no Context session, and runs beside Contacts. Turning it on enables its Satellites dependency in the temporary dense/hidden mode and turning it off restores Satellites' exact prior visibility and parameters; an explicit Satellites action taken while it runs (by the person or by voice), a visibility switch or a changed setting, is kept through that restore (also while a restore that found Satellites busy keeps the saved state, for the next Space Missions start, which switches Satellites on again), and such a Satellites OFF asked for after the newest Space Missions ON ends Space Missions (request order, not settle order, decides; `src/layers/launches/satelliteIntents.js`). A scene, story, preset or other programmatic Satellites change does neither (owner decision). Contacts leaves Satellites as it is. The first mission-index load is part of the enable: an HTTP error, timeout, network failure or malformed payload before any index has loaded fails the enable, the camera returns to its pre-entry view unless navigation took it, and a toast says the mission index could not load. A valid empty index still enables, and a refresh failure after an index loaded keeps its records. Turning the layer on by hand, choosing it at first run, asking for it by voice (`set_context_mode` still accepts `space-missions` and switches the layer), or picking a mission on the globe opens the Space Missions panel; on desktop, opening it closes Context and the other right-rail panels, and opening Context closes it. Voice `set_panel_open` refuses to open the panel while the layer is off and says to turn Space Missions on first. +- Space Missions is an ordinary layer, not a Context mode. It neither isolates the globe nor refuses other layers, opens no Context session, and runs beside Contacts. Turning it on enables its Satellites dependency in the temporary dense/hidden mode and turning it off restores Satellites' exact prior visibility and parameters; an explicit Satellites action taken while it runs (by the person or by voice), a visibility switch or a changed setting (also a place search that stops tracking a satellite), is kept through that restore (also while a restore that found Satellites busy keeps the saved state, for the next Space Missions start, which switches Satellites on again), and such a Satellites OFF asked for after the newest Space Missions ON ends Space Missions (request order, not settle order, decides; `src/layers/launches/satelliteIntents.js`). A scene, story, preset or other programmatic Satellites change does neither (owner decision). Contacts leaves Satellites as it is. The first mission-index load is part of the enable: an HTTP error, timeout, network failure or malformed payload before any index has loaded fails the enable, the camera returns to its pre-entry view unless navigation took it, and a toast says the mission index could not load. A valid empty index still enables, and a refresh failure after an index loaded keeps its records. Turning the layer on by hand, choosing it at first run, asking for it by voice (`set_context_mode` still accepts `space-missions` and switches the layer), or picking a mission on the globe opens the Space Missions panel; on desktop, opening it closes Context and the other right-rail panels, and opening Context closes it. Voice `set_panel_open` refuses to open the panel while the layer is off and says to turn Space Missions on first. - Enabled Data Layer controls report normalized feed health on the button (`LOADING`, `DEGRADED`, `STALE`, `FALLBACK`, or `UNAVAILABLE`) while the metadata line retains the source and reason. A partial CelesTrak group failure keeps the usable catalog and reports `DEGRADED`; a total outage keeps last-good catalog data visible but reports `UNAVAILABLE`. - On activation it focuses the nearest currently observed aircraft across the civilian and military feeds, with military winning an exact distance tie; if none are available, it focuses an observed AIS vessel. The aircraft search is deliberately uncapped and one refresh-tick retry handles initially empty feeds. This is an attention-priority navigation shortcut, not a high-risk, affiliation, or threat classification. - A selected aircraft, AIS vessel, or mapped installation gets a 250 km **context window** with nearby cohort counts, nearest examples, source labels, and stale/unavailable reasons. It emits `NEARBY` or `UNKNOWN`; no detection, engagement, affiliation, or sensor-activity conclusion is calculated. diff --git a/src/layers/launches/failedEntry.test.mjs b/src/layers/launches/failedEntry.test.mjs index 71bdec3c5d..40436d7a9e 100644 --- a/src/layers/launches/failedEntry.test.mjs +++ b/src/layers/launches/failedEntry.test.mjs @@ -743,6 +743,35 @@ test('a Satellites setting changed between missions survives the next one', asyn assert.equal(f.manager.getLayerParams('satellites').showOrbits, false); }); +test('tracking stopped by a place search during a mission stays stopped after it', async (t) => { + const f = await fixture(t); + f.upstream.status = 200; + assert.equal( + await f.manager.setEnabled('rocket-launches', true, { origin: 'user' }), + true, + ); + await f.settle(); + f.manager.setLayerParams( + 'satellites', + { selectedSatTrackingId: 25544 }, + { origin: 'voice' }, + ); + await f.settle(); + // A place search stops tracking with the tool origin. + f.manager.setLayerParams( + 'satellites', + { selectedSatTrackingId: null }, + { origin: 'tool' }, + ); + await f.settle(); + await f.manager.setEnabled('rocket-launches', false, { origin: 'user' }); + await f.settle(); + assert.equal( + f.manager.getLayerParams('satellites').selectedSatTrackingId ?? null, + null, + ); +}); + test('a failed Satellites restore still clears the selected mission panel', async (t) => { const f = await fixture(t); f.upstream.status = 200; diff --git a/src/layers/launches/satelliteIntents.js b/src/layers/launches/satelliteIntents.js index 63290e22ce..0870dc351b 100644 --- a/src/layers/launches/satelliteIntents.js +++ b/src/layers/launches/satelliteIntents.js @@ -16,6 +16,15 @@ function isExplicitOrigin(origin) { return origin === 'user' || origin === 'voice'; } +/** + * A setting changed on purpose: by the person, by voice, or by a tool such + * as a place search (the layer state's own rule, isExplicitLayerStateOrigin + * in src/data/layerState.js). + */ +function isDeliberateOrigin(origin) { + return isExplicitOrigin(origin) || origin === 'tool'; +} + export function createSatelliteIntents({ state: layerState }) { const requestOrder = new Map(); let sequence = 0; @@ -94,15 +103,16 @@ export function createSatelliteIntents({ state: layerState }) { } /** - * Keep a Satellites setting the person changed while Space Missions holds - * its saved state ("show orbits" off): it survives the mission teardown, - * as their visibility choice does. + * Keep a Satellites setting changed on purpose while Space Missions holds + * its saved state ("show orbits" off, tracking a satellite, or a place + * search that stops tracking): it survives the mission teardown, as a + * visibility choice does. */ function handleParams(change) { if ( change?.type !== 'params' || change.layerId !== 'satellites' || - !isExplicitOrigin(change.origin) + !isDeliberateOrigin(change.origin) ) return; const previous = layerState._satelliteStateBeforeMission;