Tighten failed-entry comments and docs

This commit is contained in:
German Khokhlov committed 2026-11-06 20:20:11 +04:00
1 parent e1ea524b68
commit 8917eebe12
7 files changed
+11 -23

No files matched your search

+1 -1
View File
@@ -12,7 +12,7 @@ export function createControls({ state: layerState, services, parts, source }) {
/** Release only Space Mission camera ownership, preserving layer and selection state. */
releaseCameraOwnership() {
// A failed entry no longer gives back the view it replaced.
// Navigation takes the camera; a failed entry must not restore the old view.
layerState._entryCameraView = null;
parts.panel.clearMissionRosterHover();
parts.replay.stopMissionReplay();
+4 -9
View File
@@ -1,8 +1,5 @@
// A Space Missions entry whose mission index never loads must not commit the
// mode. The real manager, Context coordinator and launches ingestion run
// against a local /api/launches that answers 429, so the test follows the
// same failure the browser sees: isolation clears the other layers, the first
// update fails, and the entry rolls back to the layers and view it replaced.
// The real manager, Context coordinator and launches ingestion run against a
// local /api/launches, so a failed first load takes the browser's path.
import test from 'node:test';
import assert from 'node:assert/strict';
import http from 'node:http';
@@ -137,8 +134,7 @@ async function fixture(t) {
dataSources: new Cesium.DataSourceCollection(),
scene: { canvas, preRender: new Cesium.Event(), drillPick: () => [] },
};
// Scene presentation is inert; source, ingestion, lifecycle, panel views
// and the satellites dependency run unchanged.
// Only scene presentation is stubbed.
const parts = {
overlays: {
shortMissionLabel: (name) => name,
@@ -281,7 +277,6 @@ test('a direct Space Missions entry that gets HTTP 429 rolls back instead of iso
assert.deepEqual(f.view(), before, 'the pre-entry view comes back');
assert.ok(f.camera.cancelled > 0, 'the full-globe flight is cancelled');
// Nothing is left isolating the workspace.
assert.equal(
await f.manager.setEnabled('wind', true, { origin: 'user' }),
true,
@@ -454,7 +449,7 @@ test('a refresh failure after a loaded index keeps the mode and its records', as
assert.equal(f.missions.getStats().error, 'HTTP 429');
assert.equal(f.rosters.at(-1).entries.length, 1);
// Leaving a mode that loaded keeps today's camera behaviour.
// Leaving a loaded mode does not restore the pre-entry view.
await f.manager.setEnabled('rocket-launches', false, { origin: 'user' });
await f.settle();
assert.deepEqual(f.view(), framed);
+2 -3
View File
@@ -229,9 +229,8 @@ export function createIngestion({
if (layerState._enabled && token === layerState._lifecycleToken) {
layerState._lastError = error.message;
console.warn('[Data:RocketLaunches] Fetch error:', error);
// Without one usable index there is no mode to enter: report the
// failure so the manager fails the enable closed and Context rolls
// back. A refresh after a loaded index keeps its records instead.
// No index yet: fail the enable so Context rolls back.
// After a loaded index, a failed refresh keeps its records.
if (layerState._lastUpdate === null) {
parts.panel.renderMissionRoster();
throw error;
+1 -4
View File
@@ -139,10 +139,7 @@ function sameCameraView(camera, view) {
);
}
/**
* Return to the pose before entry while the entry's full-globe flight still
* holds the camera: in flight, or landed with nothing moved since.
*/
/** Restore the pre-entry view if the entry flight still holds the camera. */
function restoreCameraView(viewer, view, landedView) {
const camera = viewer?.camera;
if (!camera) return;
+1 -4
View File
@@ -263,10 +263,7 @@ export function createPanel({ state: layerState, services, parts, source }) {
publishPanel();
}
/**
* The roster entries as the list shows them; null while the first index
* is still loading, and an empty failed roster once that load failed.
*/
/** The roster as listed; null until the first index loads or fails. */
function presentRoster() {
if (layerState._lastUpdate === null && !layerState._launches.length) {
if (!layerState._lastError) return null;
+1 -1
View File
@@ -314,7 +314,7 @@ export function createReplay({ state: layerState, services, parts, source }) {
layerState._replayCameraToken++;
if (layerState._replayCameraRemover) layerState._replayCameraRemover();
layerState._replayCameraRemover = null;
// Without a replay the camera is not ours: leave other flights running.
// Cancel only a replay's flight; any other flight runs on.
if (stoppedLaunchId && layerState._viewer?.camera) {
layerState._viewer.camera.cancelFlight();
layerState._viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);