From 07ef1039f2fd923760b9f47272adf924e73c6d8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 24 Sep 2026 21:02:18 +0200 Subject: [PATCH] test(daemon): remove daemon pins that cannot fire MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Four daemon tests asserted things no production change could contradict. - `session-relaunch-guards.test.ts`: "…for active sessions before device refresh" was byte-identical to the test above it (`diff` empty). Its ordering claim is not observable through any mock in this harness — on the existing-session path the refresh is `refreshSessionDeviceIfNeeded`, which returns early for a non-iOS device — so the test only re-asserted the message. Deleted. - `session-relaunch-guards.test.ts`: "…before resolving a new device" was byte-identical to the first binary-path test, but its name promises something real and fixable: the pre-resolved guard at `session-open.ts:262` runs before `resolveTargetDeviceSelection` at :269. It now asserts `mockResolveTargetDevice` was not called, which makes the name true. Proven: hoisting the selection above the guard while leaving the messages untouched fails exactly this test (`1 failed | 7 passed`) — every sibling stays green because they only read the message. - `response-views.test.ts`: three `typeof x === 'function'` tests, each immediately followed by a test that calls that same view and asserts its digest — the `!` is erased at runtime, so an unregistered view throws there first. Entailment is exact. The five matching `typeof` lines inside the shared-view tests go too; the `findView === getView` and `press === click === fill === longpress` identity pins stay, since splitting a shared view really does redden those. - `providers-plugin-routing-parity.test.ts`: `assert.equal(getPlugin('apple'), getPlugin('apple'))` compares one `Map.get` call to itself, and its comment claimed an ios/macos alias the collapsed `PLATFORMS` union no longer has. The exact-array assertions in that block are kept — they are the only thing that catches a facet listing a resolver twice, which the membership scan above cannot see. - `interaction-response-construction-guard.test.ts`: a positive control run over a file-local fixture with no production file in scope. The ADR 0011 guard's real positive control scans the actual dispatcher; and the fixture case is already entailed by the negative controls, each of which mutates one case and asserts a one-element violation array, proving every other case contributes nothing. --- .../providers-plugin-routing-parity.test.ts | 5 ++- src/daemon/__tests__/response-views.test.ts | 17 +--------- .../__tests__/session-relaunch-guards.test.ts | 34 +------------------ ...action-response-construction-guard.test.ts | 4 --- 4 files changed, 4 insertions(+), 56 deletions(-) diff --git a/src/daemon/__tests__/providers-plugin-routing-parity.test.ts b/src/daemon/__tests__/providers-plugin-routing-parity.test.ts index 5d5c273088..c00bc2a493 100644 --- a/src/daemon/__tests__/providers-plugin-routing-parity.test.ts +++ b/src/daemon/__tests__/providers-plugin-routing-parity.test.ts @@ -124,9 +124,8 @@ test('providers.platformGatedResolvers facet is byte-identical to the former han }); test('every family carries the providers facet with the resolvers it owns', () => { - // Apple owns ios + macos (SAME plugin instance). Unlike appLog/perf, EVERY family - // owns at least one platform-specific resolver, so all four carry the facet. - assert.equal(getPlugin('apple'), getPlugin('apple')); + // The exact-array form (not the membership scan above) is what catches a facet listing a + // resolver twice. Harmonyos carries no facet at all, so five families are asserted here. assert.deepEqual([...getPlugin('apple').providers!.platformGatedResolvers].sort(), [ 'appleRunnerProvider', 'appleToolProvider', diff --git a/src/daemon/__tests__/response-views.test.ts b/src/daemon/__tests__/response-views.test.ts index 4b3a103026..8db7d045d3 100644 --- a/src/daemon/__tests__/response-views.test.ts +++ b/src/daemon/__tests__/response-views.test.ts @@ -20,10 +20,6 @@ const SNAPSHOT_DATA: DaemonResponseData = { appName: 'Demo', // a non-cheap field that the digest intentionally drops }; -test('snapshot view is registered', () => { - expect(typeof snapshotView).toBe('function'); -}); - test('digest collapses the node tree to count + actionable refs + cheap signals', () => { const digest = snapshotView!(SNAPSHOT_DATA, 'digest'); expect(digest).toEqual({ @@ -122,10 +118,6 @@ const SCREENSHOT_DATA: DaemonResponseData = { ], // cheap retrieval handle — preserved }; -test('screenshot view is registered', () => { - expect(typeof screenshotView).toBe('function'); -}); - test('digest collapses overlay geometry to count + leveled refs, keeps cheap fields', () => { const digest = screenshotView!(SCREENSHOT_DATA, 'digest'); expect(digest).toEqual({ @@ -235,9 +227,7 @@ const COMPACT_NODE = { hittable: true, }; -test('find and get views are registered (shared selector-read view)', () => { - expect(typeof findView).toBe('function'); - expect(typeof getView).toBe('function'); +test('find and get share one selector-read view', () => { expect(findView).toBe(getView); }); @@ -388,7 +378,6 @@ const SETTLE_DATA: DaemonResponseData = { }; test('interaction settle views are registered for all four touch commands', () => { - expect(typeof RESPONSE_VIEWS.press).toBe('function'); expect(RESPONSE_VIEWS.press).toBe(RESPONSE_VIEWS.click); expect(RESPONSE_VIEWS.press).toBe(RESPONSE_VIEWS.fill); expect(RESPONSE_VIEWS.press).toBe(RESPONSE_VIEWS.longpress); @@ -571,10 +560,6 @@ const NETWORK_DATA: DaemonResponseData = { artifacts: [{ field: 'path', artifactType: 'app-log', artifactId: 'artifact-network-log' }], }; -test('network view is registered', () => { - expect(typeof networkView).toBe('function'); -}); - test('network digest keeps the whole dump + every entry identity, dropping only payload material', () => { const digest = networkView!(NETWORK_DATA, 'digest'); // Top-level dump is preserved verbatim. diff --git a/src/daemon/handlers/__tests__/session-relaunch-guards.test.ts b/src/daemon/handlers/__tests__/session-relaunch-guards.test.ts index 3909cf06d6..e4ac9574d0 100644 --- a/src/daemon/handlers/__tests__/session-relaunch-guards.test.ts +++ b/src/daemon/handlers/__tests__/session-relaunch-guards.test.ts @@ -137,39 +137,6 @@ test('open --relaunch rejects Android app binary paths for active sessions', asy ); }); -test('open --relaunch rejects Android app binary paths for active sessions before device refresh', async () => { - const sessionStore = makeSessionStore(); - const session = makeSession('default', { - platform: 'android', - id: 'emulator-5554', - name: 'Pixel', - kind: 'emulator', - booted: true, - }); - session.appName = 'com.example.app'; - session.appBundleId = 'com.example.app'; - sessionStore.set('default', session); - - const response = await handleSessionCommands({ - req: { - token: 't', - session: 'default', - command: 'open', - positionals: ['/tmp/app-debug.apk'], - flags: { relaunch: true, platform: 'android' }, - }, - sessionName: 'default', - logPath: path.join(mkdtempForTestSync('daemon'), 'daemon.log'), - sessionStore, - invoke: noopInvoke, - }); - - assertInvalidArgsMessage( - response, - 'Android runtime hints require an installed package name, not "/tmp/app-debug.apk". Install or reinstall the app first, then relaunch by package.', - ); -}); - test('open --relaunch rejects Android app binary paths before resolving a new device', async () => { const sessionStore = makeSessionStore(); const response = await handleSessionCommands({ @@ -190,6 +157,7 @@ test('open --relaunch rejects Android app binary paths before resolving a new de response, 'Android runtime hints require an installed package name, not "/tmp/app-debug.apk". Install or reinstall the app first, then relaunch by package.', ); + expect(mockResolveTargetDevice).not.toHaveBeenCalled(); }); test('open on in-use device returns DEVICE_IN_USE before readiness checks', async () => { diff --git a/src/daemon/interaction/internal/__tests__/interaction-response-construction-guard.test.ts b/src/daemon/interaction/internal/__tests__/interaction-response-construction-guard.test.ts index fdffe26275..fa98d3bb1b 100644 --- a/src/daemon/interaction/internal/__tests__/interaction-response-construction-guard.test.ts +++ b/src/daemon/interaction/internal/__tests__/interaction-response-construction-guard.test.ts @@ -244,10 +244,6 @@ const DELEGATING_CASES = ` return await dispatchFillViaRuntime(params); `; -test('the dispatcher guard accepts a switch whose touch cases only delegate', () => { - assert.deepEqual(touchDispatchViolations(dispatcher(DELEGATING_CASES)), []); -}); - test('the dispatcher guard rejects a hand-rolled responseData hidden behind a nested switch', () => { const source = dispatcher( DELEGATING_CASES.replace(