Skip to content

Commit 51281e5

Browse files
committed
test(composition): name the root fixtures after their lane
Both fixture lanes exported the same names: daemonPlatformServicesFixture and applicationLifecycleRuntimeFixture existed as canned spies under the daemon and as the real composed ports at the root, so an import that drifted between the two trees stayed invisible in review — the call site read the same. The root composition fixtures now export composedPlatformServicesFixture, composedClaimRecoveryGatewayFixture, and composedLifecycleRuntimeFixture, and every root call site carries the new name, so each import spells which lane it answers and a stray swap shows as a rename. The daemon's canned fixtures keep their names for the daemon lane.
1 parent b5d7af7 commit 51281e5

36 files changed

Lines changed: 164 additions & 164 deletions

‎src/__tests__/daemon-composition/application-lifecycle-runtime-fixture.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const discoverReadyAndroidEmulators = vi.fn(async (readyDevice: DeviceInf
3939
},
4040
]);
4141

42-
export async function applicationLifecycleRuntimeFixture(
42+
export async function composedLifecycleRuntimeFixture(
4343
device: DeviceInfo,
4444
signal: AbortSignal = new AbortController().signal,
4545
shutdownTarget: (device: DeviceInfo) => Promise<TargetShutdownResult> = async () => ({

‎src/__tests__/daemon-composition/device/device-ready.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { afterEach, beforeEach, expect, test, vi } from 'vitest';
22
import { promises as fs } from 'node:fs';
3-
import { daemonPlatformServicesFixture } from '../platform-services-fixture.ts';
3+
import { composedPlatformServicesFixture } from '../platform-services-fixture.ts';
44
import type { DeviceInfo } from '@agent-device/kernel/device';
55

66
vi.mock('@agent-device/host-kit/command', async (importOriginal) => {
@@ -40,7 +40,7 @@ const mockWaitForAndroidBoot = vi.mocked(waitForAndroidBoot);
4040
// composition lane on the root-composed services fixture, with the platform leaves mocked above.
4141
// The daemon-lane port fixture answers readiness with a canned spy; this suite separately
4242
// pins the readiness cache contract, including its TTL behavior.
43-
const platformServices = daemonPlatformServicesFixture();
43+
const platformServices = composedPlatformServicesFixture();
4444

4545
beforeEach(() => {
4646
vi.useFakeTimers();

‎src/__tests__/daemon-composition/generic-settle.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { daemonPlatformServicesFixture } from './platform-services-fixture.ts';
1+
import { composedPlatformServicesFixture } from './platform-services-fixture.ts';
22
import { beforeEach, expect, test, vi } from 'vitest';
33
import type { CommandFlags } from '@agent-device/contracts/command';
44
import type { RawSnapshotNode } from '@agent-device/kernel/snapshot';
@@ -214,7 +214,7 @@ async function dispatchGeneric(params: {
214214
};
215215
return await dispatchGenericCommand({
216216
createCommandSurface: testCreateCommandSurface,
217-
platformServices: daemonPlatformServicesFixture(),
217+
platformServices: composedPlatformServicesFixture(),
218218
req,
219219
ref: params.sessionStore.lookup(params.sessionName)!,
220220
sessionName: params.sessionName,
@@ -654,7 +654,7 @@ test('an ended generic lifetime is refused before dispatch or settle constructio
654654
await expect(
655655
dispatchGenericCommand({
656656
createCommandSurface: testCreateCommandSurface,
657-
platformServices: daemonPlatformServicesFixture(),
657+
platformServices: composedPlatformServicesFixture(),
658658
req: {
659659
token: 't',
660660
session: sessionName,

‎src/__tests__/daemon-composition/gesture-admission-parity.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { daemonPlatformServicesFixture } from './platform-services-fixture.ts';
1+
import { composedPlatformServicesFixture } from './platform-services-fixture.ts';
22
import { expect, test } from 'vitest';
33
import type {
44
GestureCommandInput,
@@ -71,7 +71,7 @@ async function admit(input: GestureCommandInput, target: DeviceInfo) {
7171
});
7272
try {
7373
return await resolveBoundGestureRuntime({
74-
platformServices: daemonPlatformServicesFixture(),
74+
platformServices: composedPlatformServicesFixture(),
7575
device: target,
7676
input,
7777
inspectFacts: bindings.inspectFacts,

‎src/__tests__/daemon-composition/handlers/session-device-claims-cancellation.test.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { daemonPlatformServicesFixture } from '../platform-services-fixture.ts';
1+
import { composedPlatformServicesFixture } from '../platform-services-fixture.ts';
22
import assert from 'node:assert/strict';
33
import path from 'node:path';
44
import { afterEach, test, vi } from 'vitest';
@@ -49,7 +49,7 @@ import {
4949
import type { PlatformRuntimeOperations } from '@agent-device/contracts/platform-runtime-operations';
5050
import type { BindDeviceRuntime } from '../../../daemon/request-runtime-binding.ts';
5151
import {
52-
applicationLifecycleRuntimeFixture,
52+
composedLifecycleRuntimeFixture,
5353
dispatchApplicationLifecycleEffect,
5454
} from '../application-lifecycle-runtime-fixture.ts';
5555
import { SessionStore } from '../../../daemon/session-store.ts';
@@ -78,7 +78,7 @@ async function realLifecycleBinding(
7878
device,
7979
owner: localRuntimeOwner(device.platform),
8080
facts: await inspectLifecycleRuntimeFacts(device),
81-
operations: await applicationLifecycleRuntimeFixture(device),
81+
operations: await composedLifecycleRuntimeFixture(device),
8282
[Symbol.asyncDispose]: async () => {},
8383
};
8484
}
@@ -125,7 +125,7 @@ test('cancellation after local device setup retains the device claim for recover
125125
try {
126126
const response = await handleProductionOpenCommand({
127127
createCommandSurface: fakeCreateCommandSurface,
128-
platformServices: daemonPlatformServicesFixture(),
128+
platformServices: composedPlatformServicesFixture(),
129129
req: {
130130
command: 'open',
131131
token: 'test',

‎src/__tests__/daemon-composition/handlers/session-relaunch-guards.test.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
import { handleSessionCommands } from '../../../daemon/handlers/__tests__/session-command-harness.ts';
1111
import { mkdtempForTestSync } from '@agent-device/test-kit/tmp-dir';
1212
import { fakeCreateCommandSurface } from '../../../daemon/__tests__/support/command-surface-fake.ts';
13-
import { daemonPlatformServicesFixture } from '../platform-services-fixture.ts';
13+
import { composedPlatformServicesFixture } from '../platform-services-fixture.ts';
1414

1515
// These relaunch cases pin the REAL open-target validation rules (the URL-target refusal and the
1616
// Android installed-package classification with its exact message) reached through the daemon's
@@ -21,7 +21,7 @@ test('open --relaunch rejects URL targets', async () => {
2121
const sessionStore = makeSessionStore();
2222
const response = await handleSessionCommands({
2323
createCommandSurface: fakeCreateCommandSurface,
24-
platformServices: daemonPlatformServicesFixture(),
24+
platformServices: composedPlatformServicesFixture(),
2525
req: {
2626
token: 't',
2727
session: 'default',
@@ -47,7 +47,7 @@ test('open --relaunch rejects Android app binary paths', async () => {
4747
const sessionStore = makeSessionStore();
4848
const response = await handleSessionCommands({
4949
createCommandSurface: fakeCreateCommandSurface,
50-
platformServices: daemonPlatformServicesFixture(),
50+
platformServices: composedPlatformServicesFixture(),
5151
req: {
5252
token: 't',
5353
session: 'default',
@@ -71,7 +71,7 @@ test('open --relaunch rejects bare Android app binary filenames', async () => {
7171
const sessionStore = makeSessionStore();
7272
const response = await handleSessionCommands({
7373
createCommandSurface: fakeCreateCommandSurface,
74-
platformServices: daemonPlatformServicesFixture(),
74+
platformServices: composedPlatformServicesFixture(),
7575
req: {
7676
token: 't',
7777
session: 'default',
@@ -106,7 +106,7 @@ test('open --relaunch rejects Android app binary paths for active sessions', asy
106106

107107
const response = await handleSessionCommands({
108108
createCommandSurface: fakeCreateCommandSurface,
109-
platformServices: daemonPlatformServicesFixture(),
109+
platformServices: composedPlatformServicesFixture(),
110110
req: {
111111
token: 't',
112112
session: 'default',
@@ -130,7 +130,7 @@ test('open --relaunch rejects Android app binary paths before resolving a new de
130130
const sessionStore = makeSessionStore();
131131
const response = await handleSessionCommands({
132132
createCommandSurface: fakeCreateCommandSurface,
133-
platformServices: daemonPlatformServicesFixture(),
133+
platformServices: composedPlatformServicesFixture(),
134134
req: {
135135
token: 't',
136136
session: 'default',

‎src/__tests__/daemon-composition/handlers/snapshot-handler-freshness.test.ts‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { daemonPlatformServicesFixture } from '../platform-services-fixture.ts';
1+
import { composedPlatformServicesFixture } from '../platform-services-fixture.ts';
22
import { test, expect, vi, afterEach, beforeEach } from 'vitest';
33
import { legacyDispatchCapture } from '../../../daemon/__tests__/legacy-snapshot-capture-fixture.ts';
44
import { resetGetRuntimeFixture } from '../../../daemon/__tests__/interaction-get-runtime-fixture.ts';
@@ -185,7 +185,7 @@ test('snapshot annotations survive a deferred post-gesture capture into CLI JSON
185185

186186
const response = await handleSnapshotCommands({
187187
createCommandSurface: testCreateCommandSurface,
188-
platformServices: daemonPlatformServicesFixture(),
188+
platformServices: composedPlatformServicesFixture(),
189189
req: snapshotRequest(sessionName, 'snapshot'),
190190
sessionName,
191191
logPath: '/tmp/daemon.log',
@@ -217,7 +217,7 @@ test('snapshot timeout captures Android screenshot evidence with overlay refs',
217217
mockAndroidTimeoutEvidenceDispatch();
218218
const response = await handleSnapshotCommands({
219219
createCommandSurface: testCreateCommandSurface,
220-
platformServices: daemonPlatformServicesFixture(),
220+
platformServices: composedPlatformServicesFixture(),
221221
req: snapshotRequest(sessionName, 'snapshot'),
222222
sessionName,
223223
logPath: '/tmp/daemon.log',
@@ -248,7 +248,7 @@ test('snapshot warns when recent snapshot node count collapses sharply', async (
248248

249249
const response = await handleSnapshotCommands({
250250
createCommandSurface: testCreateCommandSurface,
251-
platformServices: daemonPlatformServicesFixture(),
251+
platformServices: composedPlatformServicesFixture(),
252252
req: snapshotRequest(sessionName, 'snapshot'),
253253
sessionName,
254254
logPath: '/tmp/daemon.log',
@@ -296,7 +296,7 @@ test('snapshot does not warn on expected node drop across presentation modes', a
296296

297297
const response = await handleSnapshotCommands({
298298
createCommandSurface: testCreateCommandSurface,
299-
platformServices: daemonPlatformServicesFixture(),
299+
platformServices: composedPlatformServicesFixture(),
300300
req: snapshotRequest(sessionName, 'snapshot', { flags: { snapshotInteractiveOnly: true } }),
301301
sessionName,
302302
logPath: '/tmp/daemon.log',
@@ -335,7 +335,7 @@ test('snapshot automatically retries stale Android trees after recent navigation
335335

336336
const response = await handleSnapshotCommands({
337337
createCommandSurface: testCreateCommandSurface,
338-
platformServices: daemonPlatformServicesFixture(),
338+
platformServices: composedPlatformServicesFixture(),
339339
req: snapshotRequest(sessionName, 'snapshot', { flags: { snapshotInteractiveOnly: true } }),
340340
sessionName,
341341
logPath: '/tmp/daemon.log',
@@ -365,7 +365,7 @@ test('snapshot warns when Android freshness retries still return the previous ro
365365

366366
const response = await handleSnapshotCommands({
367367
createCommandSurface: testCreateCommandSurface,
368-
platformServices: daemonPlatformServicesFixture(),
368+
platformServices: composedPlatformServicesFixture(),
369369
req: snapshotRequest(sessionName, 'snapshot', { flags: { snapshotInteractiveOnly: true } }),
370370
sessionName,
371371
logPath: '/tmp/daemon.log',
@@ -415,7 +415,7 @@ test('snapshot response includes normalized visibility metadata', async () => {
415415

416416
const response = await handleSnapshotCommands({
417417
createCommandSurface: testCreateCommandSurface,
418-
platformServices: daemonPlatformServicesFixture(),
418+
platformServices: composedPlatformServicesFixture(),
419419
req: snapshotRequest(sessionName, 'snapshot', { flags: { snapshotInteractiveOnly: true } }),
420420
sessionName,
421421
logPath: '/tmp/daemon.log',
@@ -445,7 +445,7 @@ test('diff snapshot carries stale-tree warnings for recent Android presses', asy
445445

446446
const response = await handleSnapshotCommands({
447447
createCommandSurface: testCreateCommandSurface,
448-
platformServices: daemonPlatformServicesFixture(),
448+
platformServices: composedPlatformServicesFixture(),
449449
req: snapshotRequest(sessionName, 'diff', {
450450
positionals: ['snapshot'],
451451
flags: { snapshotInteractiveOnly: true },

‎src/__tests__/daemon-composition/handlers/snapshot-handler.test.ts‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { daemonPlatformServicesFixture } from '../platform-services-fixture.ts';
1+
import { composedPlatformServicesFixture } from '../platform-services-fixture.ts';
22
import { test, expect, vi, afterEach, beforeEach } from 'vitest';
33
import { legacyDispatchCapture } from '../../../daemon/__tests__/legacy-snapshot-capture-fixture.ts';
44
import { resetGetRuntimeFixture } from '../../../daemon/__tests__/interaction-get-runtime-fixture.ts';
@@ -89,7 +89,7 @@ test('snapshot rejects @ref scope without existing session snapshot', async () =
8989

9090
const response = await handleSnapshotCommands({
9191
createCommandSurface: testCreateCommandSurface,
92-
platformServices: daemonPlatformServicesFixture(),
92+
platformServices: composedPlatformServicesFixture(),
9393
req: snapshotRequest(sessionName, 'snapshot', { flags: { snapshotScope: '@e1' } }),
9494
sessionName,
9595
logPath: '/tmp/daemon.log',
@@ -112,7 +112,7 @@ test('snapshot on iOS rejects sessions without a tracked app', async () => {
112112

113113
const response = await handleSnapshotCommands({
114114
createCommandSurface: testCreateCommandSurface,
115-
platformServices: daemonPlatformServicesFixture(),
115+
platformServices: composedPlatformServicesFixture(),
116116
req: snapshotRequest(sessionName, 'snapshot'),
117117
sessionName,
118118
logPath: '/tmp/daemon.log',
@@ -141,7 +141,7 @@ test('snapshot on iOS without a tracked app carries the detected open command as
141141
const sessionName = 'ios-sim-no-app-hinted';
142142
sessionStore.publish(sessionName, makeSession(sessionName, iosSimulatorDevice));
143143

144-
const platformServices = daemonPlatformServicesFixture();
144+
const platformServices = composedPlatformServicesFixture();
145145
const response = await handleSnapshotCommands({
146146
createCommandSurface: testCreateCommandSurface,
147147
platformServices,
@@ -180,7 +180,7 @@ test('snapshot on provider-backed iOS runs without a tracked app', async () => {
180180

181181
const response = await handleSnapshotCommands({
182182
createCommandSurface: testCreateCommandSurface,
183-
platformServices: daemonPlatformServicesFixture(),
183+
platformServices: composedPlatformServicesFixture(),
184184
req: snapshotRequest(sessionName, 'snapshot'),
185185
sessionName,
186186
logPath: '/tmp/daemon.log',
@@ -205,7 +205,7 @@ test('diff on local iOS still requires a tracked app', async () => {
205205

206206
const response = await handleSnapshotCommands({
207207
createCommandSurface: testCreateCommandSurface,
208-
platformServices: daemonPlatformServicesFixture(),
208+
platformServices: composedPlatformServicesFixture(),
209209
req: snapshotRequest(sessionName, 'diff', { positionals: ['snapshot'] }),
210210
sessionName,
211211
logPath: '/tmp/daemon.log',
@@ -235,7 +235,7 @@ test('snapshot on iOS runs when the session tracks an app', async () => {
235235

236236
const response = await handleSnapshotCommands({
237237
createCommandSurface: testCreateCommandSurface,
238-
platformServices: daemonPlatformServicesFixture(),
238+
platformServices: composedPlatformServicesFixture(),
239239
req: snapshotRequest(sessionName, 'snapshot'),
240240
sessionName,
241241
logPath: '/tmp/daemon.log',
@@ -272,7 +272,7 @@ test('snapshot re-activates a complete frame; diff preserves it (ADR 0014)', asy
272272

273273
const snapshotResponse = await handleSnapshotCommands({
274274
createCommandSurface: testCreateCommandSurface,
275-
platformServices: daemonPlatformServicesFixture(),
275+
platformServices: composedPlatformServicesFixture(),
276276
req: snapshotRequest(sessionName, 'snapshot'),
277277
sessionName,
278278
logPath: '/tmp/daemon.log',
@@ -286,7 +286,7 @@ test('snapshot re-activates a complete frame; diff preserves it (ADR 0014)', asy
286286

287287
const diffResponse = await handleSnapshotCommands({
288288
createCommandSurface: testCreateCommandSurface,
289-
platformServices: daemonPlatformServicesFixture(),
289+
platformServices: composedPlatformServicesFixture(),
290290
req: snapshotRequest(sessionName, 'diff', { positionals: ['snapshot'] }),
291291
sessionName,
292292
logPath: '/tmp/daemon.log',
@@ -307,7 +307,7 @@ async function runVersionedRefsCommand(params: {
307307
}): Promise<Record<string, unknown> | undefined> {
308308
const response = await handleSnapshotCommands({
309309
createCommandSurface: testCreateCommandSurface,
310-
platformServices: daemonPlatformServicesFixture(),
310+
platformServices: composedPlatformServicesFixture(),
311311
req: snapshotRequest(params.sessionName, params.command, {
312312
positionals: params.command === 'diff' ? ['snapshot'] : [],
313313
}),
@@ -394,7 +394,7 @@ test('daemon-private snapshot observation advances capture state without publish
394394

395395
const response = await handleSnapshotCommands({
396396
createCommandSurface: testCreateCommandSurface,
397-
platformServices: daemonPlatformServicesFixture(),
397+
platformServices: composedPlatformServicesFixture(),
398398
req: snapshotRequest(sessionName, 'snapshot', { internal: { observationOnly: true } }),
399399
sessionName,
400400
logPath: '/tmp/daemon.log',
@@ -418,7 +418,7 @@ test('snapshot surfaces filtered-to-zero Android guidance for interactive snapsh
418418

419419
const response = await handleSnapshotCommands({
420420
createCommandSurface: testCreateCommandSurface,
421-
platformServices: daemonPlatformServicesFixture(),
421+
platformServices: composedPlatformServicesFixture(),
422422
req: snapshotRequest(sessionName, 'snapshot', {
423423
flags: { snapshotInteractiveOnly: true, snapshotDepth: 3 },
424424
}),
@@ -440,7 +440,7 @@ test('diff rejects unsupported kind', async () => {
440440
const sessionStore = makeSessionStore();
441441
const response = await handleSnapshotCommands({
442442
createCommandSurface: testCreateCommandSurface,
443-
platformServices: daemonPlatformServicesFixture(),
443+
platformServices: composedPlatformServicesFixture(),
444444
req: snapshotRequest('default', 'diff', { positionals: ['unknown'] }),
445445
sessionName: 'default',
446446
logPath: '/tmp/daemon.log',
@@ -459,7 +459,7 @@ test('diff screenshot is not handled daemon-side (client-backed command)', async
459459
const sessionStore = makeSessionStore();
460460
const response = await handleSnapshotCommands({
461461
createCommandSurface: testCreateCommandSurface,
462-
platformServices: daemonPlatformServicesFixture(),
462+
platformServices: composedPlatformServicesFixture(),
463463
req: snapshotRequest('default', 'diff', { positionals: ['screenshot'] }),
464464
sessionName: 'default',
465465
logPath: '/tmp/daemon.log',

‎src/__tests__/daemon-composition/interaction/interaction-dispatch-disclosure.test.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { daemonPlatformServicesFixture } from '../platform-services-fixture.ts';
1+
import { composedPlatformServicesFixture } from '../platform-services-fixture.ts';
22
import assert from 'node:assert/strict';
33
import fs from 'node:fs';
44
import { beforeEach, test, vi } from 'vitest';
@@ -195,7 +195,7 @@ async function swipeRefusedOnSecondRepetition(): Promise<unknown> {
195195
sessionStore.publish(session.name, session);
196196
const response = await routeInteraction({
197197
createCommandSurface: testCreateCommandSurface,
198-
platformServices: daemonPlatformServicesFixture(),
198+
platformServices: composedPlatformServicesFixture(),
199199
req: {
200200
token: 't',
201201
session: session.name,
@@ -229,7 +229,7 @@ async function gestureDragRefusedBeforeDispatch(): Promise<unknown> {
229229
sessionStore.publish(session.name, session);
230230
const response = await routeInteraction({
231231
createCommandSurface: testCreateCommandSurface,
232-
platformServices: daemonPlatformServicesFixture(),
232+
platformServices: composedPlatformServicesFixture(),
233233
req: {
234234
token: 't',
235235
session: session.name,
@@ -288,7 +288,7 @@ async function refRefusedAfterAndroidRecovery(command: 'press' | 'gesture'): Pro
288288
};
289289
const response = await routeInteraction({
290290
createCommandSurface: testCreateCommandSurface,
291-
platformServices: daemonPlatformServicesFixture(),
291+
platformServices: composedPlatformServicesFixture(),
292292
req: {
293293
token: 't',
294294
session: session.name,

0 commit comments

Comments
 (0)