mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 01:32:19 +00:00
Make Space Missions an ordinary layer with its own panel
Space Missions no longer runs as a Context mode. The launches layer owns its Satellites dependency, including the rule that a Satellites off asked for after Space Missions was switched on ends it (request order decides), and a small controller connects the layer to its own panel and store. Context no longer isolates, snapshots or restores Space Missions or Satellites, so Contacts and Space Missions run together in either order, and scene playback no longer exits an isolating mode. Settled by the owner: Contacts leaves Satellites as it is, and only a person's or voice Satellites off ends Space Missions; a scene, story, preset or other programmatic off does not. Turning the layer on by hand or by voice, choosing it at first run, or picking a mission on the globe opens the Space Missions panel, and on a phone its Missions sheet. Asking voice to open the panel while the layer is off is refused with a reason, and voice never opens it while the Cockpit owns the screen. With no Context mode on, a voice Context off switches Space Missions off. A failed Satellites restore no longer cuts the layer's teardown short. Mission labels on the globe select their mission. The layer names a failed first index load itself, so the Context toast no longer imports Space Missions code. Also carries the satellites request ordering and DataLayerManager.waitForLayerIdle, the share token for the panel, voice panel ids, Cockpit folding the panel away and the phone tab ellipsis. The panel shares the rail gutters and hover border of the other side panels. On top of the Omnibar: "open space missions panel" reaches the new panel, and Open Context no longer answers to "missions". Co-authored-by: Sameh Khamis <[email protected]>
This commit is contained in:
1 parent
8b2ca602e5
commit
0a6fd5f43f
101 files changed
+2885
-1673
No files matched your search
+63
-111
@@ -5,7 +5,6 @@ import {
|
||||
orbitEntryAllowed,
|
||||
cockpitEntryAllowed,
|
||||
contextAllowedLayerIds,
|
||||
contextLayerEnableBlockReason,
|
||||
contextRestoreLayerIds,
|
||||
isExplicitUserIntentOrigin,
|
||||
mergeContextTransitionErrors,
|
||||
@@ -17,9 +16,7 @@ import {
|
||||
settleContextIntentReplay,
|
||||
settleUserFacingContextAction,
|
||||
shouldCaptureContextSession,
|
||||
shouldDeferContextEntryDuringClear,
|
||||
shouldExitContextForLayerChange,
|
||||
spaceMissionEntryCancellationDisposition,
|
||||
} from './contextModePolicy.js';
|
||||
|
||||
test('Context transition errors preserve primary identity and aggregate failed layers', () => {
|
||||
@@ -119,11 +116,6 @@ test('user-enabled layers are additive and do not exit Context', () => {
|
||||
globalContextEnabled: true,
|
||||
change: userEnable('earthquakes'),
|
||||
}), false);
|
||||
assert.equal(shouldExitContextForLayerChange({
|
||||
contextMode: 'space-missions',
|
||||
globalContextEnabled: false,
|
||||
change: userEnable('traffic'),
|
||||
}), false);
|
||||
assert.equal(shouldExitContextForLayerChange({
|
||||
contextMode: null,
|
||||
globalContextEnabled: true,
|
||||
@@ -133,48 +125,16 @@ test('user-enabled layers are additive and do not exit Context', () => {
|
||||
|
||||
test('programmatic Context dependencies and direct mode setup remain allowed', () => {
|
||||
assert.equal(shouldExitContextForLayerChange({
|
||||
contextMode: 'space-missions',
|
||||
contextMode: 'flights',
|
||||
globalContextEnabled: true,
|
||||
change: { ...userEnable('satellites'), origin: 'programmatic' },
|
||||
change: { ...userEnable('military'), enabled: false, origin: 'programmatic' },
|
||||
}), false);
|
||||
});
|
||||
|
||||
test('Space Missions cancellation retains only a newer authoritative ON entry', () => {
|
||||
const cancelledEntry = {
|
||||
type: 'visibility-cancelled',
|
||||
layerId: 'rocket-launches',
|
||||
enabled: true,
|
||||
intentEpoch: 8,
|
||||
cancellationReason: 'superseded',
|
||||
successorIntentEpoch: 9,
|
||||
successorEnabled: true,
|
||||
successorOrigin: 'programmatic',
|
||||
};
|
||||
assert.equal(spaceMissionEntryCancellationDisposition({
|
||||
change: cancelledEntry,
|
||||
}), 'replacement');
|
||||
assert.equal(spaceMissionEntryCancellationDisposition({
|
||||
change: { ...cancelledEntry, successorEnabled: false },
|
||||
}), 'restore', 'a newer OFF releases the entry shell');
|
||||
assert.equal(spaceMissionEntryCancellationDisposition({
|
||||
change: {
|
||||
...cancelledEntry,
|
||||
cancellationReason: 'caller-abort',
|
||||
successorIntentEpoch: undefined,
|
||||
successorEnabled: undefined,
|
||||
},
|
||||
}), 'restore', 'caller abort at the same epoch restores the isolated session');
|
||||
assert.equal(spaceMissionEntryCancellationDisposition({
|
||||
change: { ...cancelledEntry, enabled: false },
|
||||
currentIntentEpoch: 9,
|
||||
effectivelyEnabled: true,
|
||||
}), 'ignore');
|
||||
});
|
||||
|
||||
test('only explicit user-owned shell enables capture a Context restoration snapshot', () => {
|
||||
const userMissionEnable = {
|
||||
type: 'visibility-requested',
|
||||
layerId: 'rocket-launches',
|
||||
layerId: 'military-awareness',
|
||||
enabled: true,
|
||||
origin: 'user',
|
||||
};
|
||||
@@ -186,40 +146,25 @@ test('only explicit user-owned shell enables capture a Context restoration snaps
|
||||
assert.equal(shouldCaptureContextSession({ ...userMissionEnable, origin: 'context-restore' }), false);
|
||||
assert.equal(shouldCaptureContextSession({ ...userMissionEnable, enabled: false }), false);
|
||||
assert.equal(shouldCaptureContextSession({ ...userMissionEnable, layerId: 'satellites' }), false);
|
||||
assert.equal(
|
||||
shouldCaptureContextSession({ ...userMissionEnable, layerId: 'rocket-launches' }),
|
||||
false,
|
||||
'Space Missions is an ordinary layer, not a Context entry',
|
||||
);
|
||||
});
|
||||
|
||||
test('voice dependency OFF exits Space Missions like the equivalent UI action', () => {
|
||||
test('voice dependency OFF exits Contacts like the equivalent UI action', () => {
|
||||
assert.equal(shouldExitContextForLayerChange({
|
||||
contextMode: 'space-missions',
|
||||
contextMode: 'flights',
|
||||
globalContextEnabled: false,
|
||||
change: { type: 'visibility', layerId: 'satellites', enabled: false, origin: 'voice' },
|
||||
change: { type: 'visibility', layerId: 'flights', enabled: false, origin: 'voice' },
|
||||
}), true);
|
||||
});
|
||||
|
||||
test('only a newer explicit mission request is deferred during Clear All', () => {
|
||||
const change = {
|
||||
type: 'visibility-requested',
|
||||
layerId: 'rocket-launches',
|
||||
enabled: true,
|
||||
origin: 'voice',
|
||||
intentEpoch: 12,
|
||||
};
|
||||
assert.equal(shouldDeferContextEntryDuringClear({ change, clearInFlight: true }), true);
|
||||
assert.equal(shouldDeferContextEntryDuringClear({ change, clearInFlight: false }), false);
|
||||
assert.equal(shouldDeferContextEntryDuringClear({
|
||||
change: { ...change, origin: 'programmatic' },
|
||||
clearInFlight: true,
|
||||
}), false);
|
||||
assert.equal(shouldDeferContextEntryDuringClear({
|
||||
change: { ...change, enabled: false },
|
||||
clearInFlight: true,
|
||||
}), false);
|
||||
});
|
||||
|
||||
test('a rapid re-entry snapshots the settled restore target, not partial manager state', () => {
|
||||
assert.deepEqual(
|
||||
[...contextSnapshotLayerIds(
|
||||
new Set(['rocket-launches', 'earthquakes']),
|
||||
new Set(['cctv', 'earthquakes']),
|
||||
new Set(['flights', 'traffic']),
|
||||
)],
|
||||
['flights', 'traffic'],
|
||||
@@ -230,31 +175,15 @@ test('a rapid re-entry snapshots the settled restore target, not partial manager
|
||||
);
|
||||
assert.deepEqual(
|
||||
[...contextSnapshotLayerIds(
|
||||
new Set(['rocket-launches', 'satellites']),
|
||||
new Set(['military-awareness', 'cctv']),
|
||||
null,
|
||||
['rocket-launches'],
|
||||
['military-awareness'],
|
||||
)],
|
||||
['satellites'],
|
||||
['cctv'],
|
||||
'the synchronous entry intent is not part of the pre-entry snapshot',
|
||||
);
|
||||
});
|
||||
|
||||
test('Space Missions blocks unrelated layer enables before replay data can mix', () => {
|
||||
const change = { layerId: 'flights', enabled: true, origin: 'user' };
|
||||
assert.match(
|
||||
contextLayerEnableBlockReason({ contextMode: 'space-missions', change, layerName: 'Live Flights' }),
|
||||
/Exit the mode to enable Live Flights/,
|
||||
);
|
||||
assert.equal(contextLayerEnableBlockReason({
|
||||
contextMode: 'space-missions',
|
||||
change: { ...change, layerId: 'satellites' },
|
||||
}), null);
|
||||
assert.equal(contextLayerEnableBlockReason({
|
||||
contextMode: 'flights',
|
||||
change,
|
||||
}), null, 'live cockpit keeps additive user layers');
|
||||
});
|
||||
|
||||
test('the Global Context shell and layers selected while Context is off remain allowed', () => {
|
||||
assert.equal(shouldExitContextForLayerChange({
|
||||
contextMode: null,
|
||||
@@ -275,14 +204,38 @@ test('manually disabling a mode dependency exits that Context bundle', () => {
|
||||
change: { ...userEnable('military'), enabled: false },
|
||||
}), true);
|
||||
assert.equal(shouldExitContextForLayerChange({
|
||||
contextMode: 'space-missions',
|
||||
contextMode: 'flights',
|
||||
globalContextEnabled: false,
|
||||
change: { ...userEnable('satellites'), enabled: false },
|
||||
}), true);
|
||||
}), false, 'Satellites is not a Contacts dependency');
|
||||
});
|
||||
|
||||
test('Context never isolates, snapshots, restores or bookkeeps Space Missions and Satellites', () => {
|
||||
for (const layerId of ['rocket-launches', 'satellites']) {
|
||||
assert.equal(contextAllowedLayerIds('flights').has(layerId), true);
|
||||
const snapshot = { userAdded: new Set(), userRemoved: new Set() };
|
||||
for (const enabled of [true, false]) {
|
||||
assert.equal(recordContextSessionUserChange({
|
||||
snapshot,
|
||||
change: { type: 'visibility', origin: 'user', layerId, enabled },
|
||||
effectiveContextMode: 'flights',
|
||||
}), false);
|
||||
const restoreState = { enabledLayerIds: new Set() };
|
||||
assert.equal(recordContextRestoreExplicitChange({
|
||||
restoreState,
|
||||
change: { type: 'visibility', origin: 'user', layerId, enabled },
|
||||
}), false);
|
||||
}
|
||||
assert.equal(snapshot.userAdded.size + snapshot.userRemoved.size, 0);
|
||||
}
|
||||
assert.deepEqual(
|
||||
[...contextSnapshotLayerIds(new Set(['rocket-launches', 'satellites', 'cctv']))],
|
||||
['cctv'],
|
||||
);
|
||||
});
|
||||
|
||||
test('Radio remains an independent companion across Context transitions', () => {
|
||||
for (const contextMode of ['flights', 'space-missions']) {
|
||||
for (const contextMode of ['flights', null]) {
|
||||
for (const enabled of [true, false]) {
|
||||
assert.equal(shouldExitContextForLayerChange({
|
||||
contextMode,
|
||||
@@ -292,21 +245,17 @@ test('Radio remains an independent companion across Context transitions', () =>
|
||||
}
|
||||
assert.equal(contextAllowedLayerIds(contextMode).has('radio'), true);
|
||||
}
|
||||
assert.equal(contextLayerEnableBlockReason({
|
||||
contextMode: 'space-missions',
|
||||
change: { type: 'visibility', origin: 'user', layerId: 'radio', enabled: true },
|
||||
layerName: 'Radio',
|
||||
}), null);
|
||||
});
|
||||
|
||||
test('each Context mode exposes only its shell and dependencies', () => {
|
||||
assert.deepEqual(
|
||||
[...contextAllowedLayerIds(null)],
|
||||
['military-awareness', 'radio'],
|
||||
['military-awareness', 'radio', 'rocket-launches', 'satellites'],
|
||||
);
|
||||
assert.deepEqual(
|
||||
[...contextAllowedLayerIds('space-missions')],
|
||||
['rocket-launches', 'satellites', 'radio'],
|
||||
['military-awareness', 'radio', 'rocket-launches', 'satellites'],
|
||||
'Space Missions is not a Context mode',
|
||||
);
|
||||
});
|
||||
|
||||
@@ -332,7 +281,7 @@ test('Context restoration honors an explicit companion disable', () => {
|
||||
});
|
||||
|
||||
test('the latest explicit Radio state wins across a Context session', () => {
|
||||
for (const effectiveContextMode of [null, 'flights', 'space-missions']) {
|
||||
for (const effectiveContextMode of [null, 'flights']) {
|
||||
for (const origin of ['user', 'voice']) {
|
||||
const snapshot = { userAdded: new Set(), userRemoved: new Set() };
|
||||
const record = (enabled) => recordContextSessionUserChange({
|
||||
@@ -368,7 +317,7 @@ test('only direct UI and voice origins count as explicit Context intent', () =>
|
||||
assert.equal(recordContextSessionUserChange({
|
||||
snapshot,
|
||||
change: { type: 'visibility', origin, layerId: 'radio', enabled: true },
|
||||
effectiveContextMode: 'space-missions',
|
||||
effectiveContextMode: 'flights',
|
||||
}), false);
|
||||
assert.equal(snapshot.userAdded.size, 0);
|
||||
}
|
||||
@@ -526,16 +475,8 @@ test('the teardown guard re-publishes on the way out, so a mid-flight exit is no
|
||||
|
||||
test('the session-starting entry layer is never bookkept as user-added (chip ON→OFF restores exactly)', () => {
|
||||
const snapshot = { enabledLayerIds: new Set(['flights', 'ais-live-vessels']), userAdded: new Set() };
|
||||
// The exact left-panel regression: the rockets enable event lands while the
|
||||
// mode is still being entered (or even null); it must not survive its own exit.
|
||||
for (const effectiveContextMode of ['space-missions', null]) {
|
||||
recordContextSessionUserChange({
|
||||
snapshot,
|
||||
change: { type: 'visibility', layerId: 'rocket-launches', enabled: true, origin: 'user' },
|
||||
effectiveContextMode,
|
||||
});
|
||||
assert.equal(snapshot.userAdded.has('rocket-launches'), false);
|
||||
}
|
||||
// The entry layer's enable event lands while the mode is still being
|
||||
// entered; it must not survive its own exit.
|
||||
recordContextSessionUserChange({
|
||||
snapshot,
|
||||
change: { type: 'visibility', layerId: 'military-awareness', enabled: true, origin: 'user' },
|
||||
@@ -559,10 +500,21 @@ test('mid-session user additions are recorded, removed on disable, and judged ag
|
||||
// A dependency of the mode being ENTERED is not a user addition.
|
||||
recordContextSessionUserChange({
|
||||
snapshot,
|
||||
change: { type: 'visibility', layerId: 'satellites', enabled: true, origin: 'user' },
|
||||
effectiveContextMode: 'space-missions',
|
||||
change: { type: 'visibility', layerId: 'military', enabled: true, origin: 'user' },
|
||||
effectiveContextMode: 'flights',
|
||||
});
|
||||
assert.equal(snapshot.userAdded.has('satellites'), false);
|
||||
assert.equal(snapshot.userAdded.has('military'), false);
|
||||
// Space Missions is not Context's: it is never bookkept.
|
||||
recordContextSessionUserChange({
|
||||
snapshot,
|
||||
change: { type: 'visibility', layerId: 'rocket-launches', enabled: true, origin: 'user' },
|
||||
effectiveContextMode: 'flights',
|
||||
});
|
||||
assert.equal(
|
||||
snapshot.userAdded.has('rocket-launches'),
|
||||
false,
|
||||
'Space Missions is not Context state',
|
||||
);
|
||||
// Disabling a recorded addition removes it before any exit restore reads it.
|
||||
recordContextSessionUserChange({
|
||||
snapshot,
|
||||
|
||||
Reference in new issue
Block a user