Keep a Satellites setting the person changes while Space Missions holds its saved state

A setting such as "show orbits" changed by the person or by voice while
Space Missions keeps the Satellites state from before it (while it runs, or
after a restore that found Satellites busy) was overwritten when the mission
ended. It is now kept in that saved state, as their visibility choice is.

Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
Sameh KhamisandManjunath Paparaju committed 2026-11-18 17:36:15 -08:00
1 parent 3cf230b8b3
commit ab01345c7d
3 files changed
+56 -1

No files matched your search

+1 -1
View File
@@ -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) is kept through that restore, 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, 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.
+35
View File
@@ -708,6 +708,41 @@ test('a Satellites switch made between missions is what the next mission gives b
assert.equal(f.manager.isEnabled('satellites'), false);
});
test('a Satellites setting changed between missions survives the next one', 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.state.satelliteSettleTimeoutMs = 50;
const satellites = f.manager.layers.get('satellites').module;
const enable = satellites.enable;
const stuck = Promise.withResolvers();
satellites.enable = () => stuck.promise;
try {
await f.manager.setEnabled('satellites', false);
void f.manager.setEnabled('satellites', true);
await f.manager.setEnabled('rocket-launches', false, { origin: 'user' });
} finally {
satellites.enable = enable;
stuck.resolve();
}
await f.settle();
f.manager.setLayerParams(
'satellites',
{ showOrbits: false },
{ origin: 'user' },
);
await f.settle();
await f.manager.setEnabled('rocket-launches', true, { origin: 'user' });
await f.settle();
await f.manager.setEnabled('rocket-launches', false, { origin: 'user' });
await f.settle();
assert.equal(f.manager.getLayerParams('satellites').showOrbits, false);
});
test('a failed Satellites restore still clears the selected mission panel', async (t) => {
const f = await fixture(t);
f.upstream.status = 200;
+20
View File
@@ -93,6 +93,24 @@ export function createSatelliteIntents({ state: layerState }) {
return stop;
}
/**
* 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.
*/
function handleParams(change) {
if (
change?.type !== 'params' ||
change.layerId !== 'satellites' ||
!isExplicitOrigin(change.origin)
)
return;
const previous = layerState._satelliteStateBeforeMission;
const requested = change.requestedParams;
if (!previous || !requested || typeof requested !== 'object') return;
previous.params = { ...previous.params, ...requested };
}
/** Settle once a Satellites OFF has finished stopping Space Missions. */
function settled() {
return pendingStop ?? Promise.resolve(false);
@@ -108,6 +126,7 @@ export function createSatelliteIntents({ state: layerState }) {
manager.subscribeVisibilityRequests?.(recordRequest) ?? null;
const unsubscribeChanges =
manager.subscribe?.((change) => {
handleParams(change);
void handleVisibility(change);
}) ?? null;
unsubscribe = () => {
@@ -120,6 +139,7 @@ export function createSatelliteIntents({ state: layerState }) {
connect,
settled,
handleVisibility,
handleParams,
recordRequest,
offFollowsMissionsEntry,
};