mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 09:42:21 +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
@@ -13,10 +13,7 @@ const radioControlsSource = readRadioSource(new URL('./ui/radioControls.js', imp
|
||||
// - session bookkeeping ran AFTER the exit early-return, so the compensating
|
||||
// userAdded.delete never ran on the left-panel chip exit and restoration
|
||||
// resurrected the mission layer the user just disabled;
|
||||
// - the effective mode was read AFTER the entering flag was cleared, so the
|
||||
// entry layer's own enable event was judged against a null mode;
|
||||
// - a failed Space Missions START from the chip route cleared siblings with
|
||||
// no rollback;
|
||||
// - a failed direct Contacts START cleared siblings with no rollback;
|
||||
// - the right-rail entry ignored the activation result entirely.
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
@@ -33,25 +30,20 @@ test('context handler: session bookkeeping runs before the exit early-return', (
|
||||
assert.ok(record < exit, 'bookkeeping must precede the exit check');
|
||||
});
|
||||
|
||||
test('context handler: effective mode is read before the entering flag is cleared', () => {
|
||||
const effective = handler.indexOf('this._contextModeEntering || this._contextMode');
|
||||
const clear = handler.indexOf('this._contextModeEntering = null');
|
||||
assert.ok(effective > 0, 'effective-mode read present');
|
||||
assert.ok(clear > 0, 'entering-flag clear present');
|
||||
assert.ok(effective < clear, 'effective mode must be captured first');
|
||||
test('Space Missions is an ordinary layer the Context handler never enters', () => {
|
||||
assert.doesNotMatch(handler, /'space-missions'/);
|
||||
assert.doesNotMatch(handler, /_contextModeEntering = /);
|
||||
const attach = connectContextManager.toString();
|
||||
assert.doesNotMatch(attach, /rocket-launches|space-missions/);
|
||||
});
|
||||
|
||||
test('cancelled Space Missions entry resolves ownership before settled bookkeeping', () => {
|
||||
test('a cancelled visibility request returns before settled bookkeeping', () => {
|
||||
const cancelled = handler.indexOf("change?.type === 'visibility-cancelled'");
|
||||
const bookkeeping = handler.indexOf('recordContextSessionUserChange(');
|
||||
assert.ok(cancelled > 0, 'cancellation branch present');
|
||||
assert.ok(cancelled < bookkeeping, 'cancellation returns before settled session bookkeeping');
|
||||
const branch = handler.slice(cancelled, handler.indexOf("change?.type === 'visibility-blocked'"));
|
||||
assert.match(branch, /spaceMissionEntryCancellationDisposition\(\{/);
|
||||
assert.match(branch, /cancellationDisposition === 'replacement'[\s\S]*?_contextModeEntering = 'space-missions'[\s\S]*?entryIntent\.intentEpoch === change\.intentEpoch[\s\S]*?_contextModeReplacementIntent = \{[\s\S]*?intentEpoch: change\.successorIntentEpoch/);
|
||||
assert.match(branch, /cancellationDisposition === 'restore'[\s\S]*?_contextModeEntering = null/);
|
||||
assert.match(branch, /_restoreContextSessionAfterLayerSettles\(/);
|
||||
assert.match(branch, /return;/);
|
||||
assert.match(branch, /this\._syncContextModeButtons\(\);\s*return;/);
|
||||
});
|
||||
|
||||
test('direct Context entry captures on the synchronous request boundary', () => {
|
||||
@@ -60,18 +52,29 @@ test('direct Context entry captures on the synchronous request boundary', () =>
|
||||
attach,
|
||||
/subscribeVisibilityRequests\(\(change\) => \{[\s\S]*?shouldCaptureContextSession\(change\)/,
|
||||
);
|
||||
assert.match(
|
||||
attach,
|
||||
/_captureContextSessionSnapshot\(\{\s*excludeLayerIds:\s*\[change\.layerId\],?\s*\}\)/,
|
||||
);
|
||||
});
|
||||
|
||||
test('Clear All defers a newer explicit mission guard until its batch settles', () => {
|
||||
const attach = connectContextManager.toString();
|
||||
assert.match(attach, /shouldDeferContextEntryDuringClear\(\{/);
|
||||
assert.match(attach, /_contextModeDeferredEntryIntent = \{/);
|
||||
assert.match(attach, /await this\._clearSelectedLayersManagerPromise/);
|
||||
assert.match(attach, /await this\._clearLayersOutsideContextMode\(entryMode/);
|
||||
test('only a direct Contacts entry request snapshots the layers', () => {
|
||||
let request;
|
||||
const controls = new ContextControls({
|
||||
elements: {},
|
||||
installations: {},
|
||||
actions: { getCockpit: () => null },
|
||||
});
|
||||
const captures = [];
|
||||
controls._captureContextSessionSnapshot = (options) => captures.push(options);
|
||||
controls._syncContextModeButtons = () => {};
|
||||
controls.connect({
|
||||
subscribe: () => () => {},
|
||||
subscribeVisibilityRequests(listener) {
|
||||
request = listener;
|
||||
return () => {};
|
||||
},
|
||||
});
|
||||
for (const layerId of ['rocket-launches', 'military-awareness'])
|
||||
request({ type: 'visibility-requested', layerId, enabled: true, origin: 'user', intentEpoch: 1 });
|
||||
controls.stop();
|
||||
assert.deepEqual(captures, [{ excludeLayerIds: ['military-awareness'] }]);
|
||||
});
|
||||
|
||||
test('context restore replays explicit companion intent after the stale restore queue drains', () => {
|
||||
@@ -91,7 +94,7 @@ test('context restore settles the Contacts coordinator before dependency fanout'
|
||||
assert.ok(settle > 0, 'Contacts coordinator settlement is present');
|
||||
assert.ok(coordinatorOff > settle, 'Contacts OFF is awaited');
|
||||
assert.ok(fanout > coordinatorOff, 'snapshot fanout starts after Contacts settles');
|
||||
assert.match(restore, /excludeLayerIds: settleContactsCoordinator[\s\S]*?contactsCoordinatorId/);
|
||||
assert.match(restore, /excludeLayerIds: \[[\s\S]*?CONTEXT_INDEPENDENT_LAYER_IDS[\s\S]*?settleContactsCoordinator \? \[contactsCoordinatorId\]/);
|
||||
});
|
||||
|
||||
test('Clear All during the Contacts settle stops the snapshot coming back', () => {
|
||||
@@ -116,7 +119,7 @@ test('context handler: either failed direct Context-shell start rolls the sessio
|
||||
handler.indexOf("change?.type === 'visibility-failed'"),
|
||||
handler.indexOf("change?.type === 'visibility-will-change'"),
|
||||
);
|
||||
assert.match(failedBranch, /\['military-awareness', 'rocket-launches'\]\.includes\(change\.layerId\)/);
|
||||
assert.match(failedBranch, /change\.layerId === 'military-awareness' &&/);
|
||||
assert.match(
|
||||
failedBranch,
|
||||
/_restoreContextSessionAfterLayerSettles\(\s*change\.layerId,\s*\{\s*notificationToken,?\s*\},?\s*\)/,
|
||||
@@ -154,14 +157,14 @@ test('wrapped visibility blocks leave the accessible toast to the wrapper token
|
||||
|
||||
test('every user-facing Context exit route settles through the failure surface', () => {
|
||||
const initPanel = _initGlobalContextPanel.toString();
|
||||
assert.equal((initPanel.match(/void this\._runUserFacingContextAction/g) || []).length, 3);
|
||||
assert.equal((initPanel.match(/void this\._runUserFacingContextAction/g) || []).length, 2);
|
||||
assert.doesNotMatch(initPanel, /falseIsFailure:\s*false/);
|
||||
assert.doesNotMatch(initPanel, /void this\._selectContextMode/);
|
||||
|
||||
const deactivationCalls = [...handler.matchAll(
|
||||
/void this\._trackContextLayerReaction\(\s*this\._runUserFacingContextAction\(\(notificationToken\) =>\s*this\._deactivateContextForLayerChange\(\{ notificationToken \}\),?\s*\),?\s*\)/g,
|
||||
)];
|
||||
assert.equal(deactivationCalls.length, 4, 'dependency and primary layer exits share the caught restore path');
|
||||
assert.equal(deactivationCalls.length, 3, 'dependency and primary layer exits share the caught restore path');
|
||||
assert.doesNotMatch(handler, /void this\._deactivateContextForLayerChange\(\)/);
|
||||
});
|
||||
|
||||
@@ -193,10 +196,7 @@ test('right-rail context entry is transactional: activation result gates the mod
|
||||
const failureBlock = select.slice(activation);
|
||||
assert.match(failureBlock, /activated = await activationIntent\.promise/);
|
||||
assert.match(failureBlock, /catch \(error\) \{\s*activationError = error;/);
|
||||
assert.match(failureBlock, /_contextModeReplacementIntent\?\.generation === generation/);
|
||||
assert.match(failureBlock, /await this\._dataManager\._waitForVisibilityIntent\?\.\(/);
|
||||
assert.match(failureBlock, /outcome\?\.intentEpoch === replacementIntent\.intentEpoch[\s\S]*?outcome\.succeeded === true/);
|
||||
assert.match(failureBlock, /outcome\?\.cancellationReason === 'superseded'[\s\S]*?outcome\.successorEnabled === true[\s\S]*?outcome\.successorIntentEpoch > replacementIntent\.intentEpoch/);
|
||||
assert.match(failureBlock, /activationError\s*\|\|\s*activated === false\s*\|\|\s*!this\._dataManager\.isEnabled\(entryLayerId\)/);
|
||||
assert.match(failureBlock, /cancelledAndSettled\s*=\s*terminalIntentOutcome\?\.succeeded === false/);
|
||||
assert.match(failureBlock, /\['caller-abort', 'resource-abort', 'superseded'\]/);
|
||||
@@ -216,9 +216,11 @@ test('Context entry awaits isolation and direct shell routes isolate in the visi
|
||||
// rests on Context OFF; the honesty lives in the REPORT, not in a racy
|
||||
// attempt to put the prior mode back (see the note above
|
||||
// _restoreContextSessionAfterLayerSettles).
|
||||
const capture = select.indexOf('this._captureContextSessionSnapshot(');
|
||||
assert.ok(capture > 0, 'Context snapshot capture is missing');
|
||||
const crossMode = select.slice(
|
||||
select.indexOf('const crossModeSwitch = Boolean('),
|
||||
select.indexOf('this._captureContextSessionSnapshot();'),
|
||||
capture,
|
||||
);
|
||||
assert.ok(crossMode, 'cross-mode teardown block is missing');
|
||||
assert.doesNotMatch(crossMode, /if \(signal\?\.aborted\)[\s\S]*?await this\._restoreContextSession/);
|
||||
@@ -242,10 +244,10 @@ test('Context entry awaits isolation and direct shell routes isolate in the visi
|
||||
assert.match(ContextControls.prototype.stop.toString(), /this\._contextModeGeneration\+\+/);
|
||||
|
||||
const guard = connectContextManager.toString();
|
||||
assert.match(guard, /\['military-awareness', 'rocket-launches'\]\.includes\(change\.layerId\)/);
|
||||
assert.match(guard, /change\.layerId !== 'military-awareness'/);
|
||||
assert.match(guard, /const notificationToken\s*=\s*change\.notificationToken\s*\|\|\s*Symbol\('direct-context-shell-entry'\)/);
|
||||
assert.match(guard, /this\._userFacingContextNotificationTokens\.add\(notificationToken\)/);
|
||||
assert.match(guard, /await this\._clearLayersOutsideContextMode\(entryMode,\s*\{\s*notificationToken,?\s*\}\)/);
|
||||
assert.match(guard, /await this\._clearLayersOutsideContextMode\(null,\s*\{\s*notificationToken,?\s*\}\)/);
|
||||
assert.match(
|
||||
guard,
|
||||
/await this\._restoreContextSession\(\{\s*excludeLayerIds: \[change\.layerId\],\s*notificationToken,\s*\}\)/,
|
||||
|
||||
Reference in new issue
Block a user