From 88ad6aa0284e4763f3a5e4577b0542da439fe643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Sun, 25 Oct 2026 20:30:20 +0100 Subject: [PATCH] test(daemon): make the apps runtimeFacts override reach every cell The helper advertised a Partial override of the whole operations record, but the spread sat before unavailableDeploymentSnapshotAndShutdownOperationFacts and applicationLifecycleOperationFacts, so an override for a cell either map states was dropped in silence. No caller hit it yet: the only user so far overrides listApps, one of the fixed cells before the spread. Move the spread last, where an override wins over anything the fixture hardcoded, and add the fixture-level assertion the bug lacked: overriding findText, a cell the deployment map states, now reaches the result. Narrowing the parameter instead would restate in a type which cells the two maps cover, a list that goes stale when the maps change. Co-Authored-By: Claude --- .../__tests__/session-inventory-apps-runtime.test.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/daemon/src/sessions/session-lifecycle/internal/__tests__/session-inventory-apps-runtime.test.ts b/packages/daemon/src/sessions/session-lifecycle/internal/__tests__/session-inventory-apps-runtime.test.ts index 2a505e95d0..d51818cca4 100644 --- a/packages/daemon/src/sessions/session-lifecycle/internal/__tests__/session-inventory-apps-runtime.test.ts +++ b/packages/daemon/src/sessions/session-lifecycle/internal/__tests__/session-inventory-apps-runtime.test.ts @@ -68,7 +68,6 @@ function runtimeFacts( ensureReady: appsAvailable, bootTarget: unavailable, bootTargetHeadless: unavailable, - ...overrides, ...unavailableDeploymentSnapshotAndShutdownOperationFacts, ...applicationLifecycleOperationFacts({ resolveOpenTarget: unavailable, @@ -81,11 +80,15 @@ function runtimeFacts( prepareAppleRunner: unavailable, configureProviderPortReverse: unavailable, }), + // Last, so a caller can override any cell above. Earlier it sat before the two fixed fact + // maps, which quietly dropped an override for a cell either map already stated. + ...overrides, }, }; } const inspectFactsImpl: InspectDeviceRuntimeFacts = async () => runtimeFacts(); + const inspectFacts = vi.fn(inspectFactsImpl); const ensureReady = vi.fn(async () => MACOS_DEVICE); const listApps = vi.fn(async () => [{ id: 'com.example.app', name: 'Example' }]); @@ -114,6 +117,13 @@ beforeEach(() => { bindCount = 0; }); +test('a runtimeFacts override reaches a cell the fixed fact maps state', () => { + // `unavailableDeploymentSnapshotAndShutdownOperationFacts` states findText. An override spread + // before that map was dropped, which is how the helper came to lie about its own parameter. + const overridden = { available: true } as const; + expect(runtimeFacts({ findText: overridden }).operations.findText).toBe(overridden); +}); + test('macOS apps consumes generic readiness and app inventory through one runtime bind', async () => { const sessionName = 'macos-apps'; const sessionStore = makeSessionStore();