@@ -2,6 +2,7 @@ import { createTestDeviceInventoryGateways } from '@agent-device/device-selectio
22import {
33 daemonPlatformServicesFixture ,
44 daemonClaimRecoveryGatewayFixture ,
5+ observeBootTimeMsFixture ,
56} from './platform-services-fixture.ts' ;
67import { legacyDispatchCapture } from './legacy-snapshot-capture-fixture.ts' ;
78import { test , expect , vi , beforeEach } from 'vitest' ;
@@ -61,16 +62,6 @@ vi.mock('@agent-device/platform-apple/app-resolution', async (importOriginal) =>
6162 resolveIosApp : vi . fn ( async ( _device , app ) => app ) ,
6263 } ;
6364} ) ;
64- // The reboot-stale claim probe (#2538) must never reach the host's real process table here.
65- const mockObserveSimulatorBoot = vi . hoisted ( ( ) =>
66- vi . fn ( async ( ) : Promise < DeviceBootObservation > => ( {
67- observed : false ,
68- reason : 'unobserved' ,
69- } ) ) ,
70- ) ;
71- vi . mock ( '@agent-device/platform-apple/simulator-boot' , ( ) => ( {
72- observeSimulatorBootTimeMs : mockObserveSimulatorBoot ,
73- } ) ) ;
7465
7566import {
7667 createRequestHandler ,
@@ -86,7 +77,6 @@ import {
8677 discoverReadyAndroidEmulators ,
8778} from './application-lifecycle-runtime-fixture.ts' ;
8879import type { DeviceInfo } from '@agent-device/kernel/device' ;
89- import type { DeviceBootObservation } from '@agent-device/contracts/device-boot' ;
9080import { AppError } from '@agent-device/kernel/errors' ;
9181import { makeSessionStore } from './support/store-factory.ts' ;
9282import { inspectDeviceClaims } from '../device/device-claim-inspection.ts' ;
@@ -103,6 +93,7 @@ const mockEnsureDeviceReady = vi.mocked(ensureDeviceReady);
10393// The open path reaches readiness through its admitted package binding, so router-level
10494// serialization is observed at the fixture's emulator-discovery seam.
10595const mockDiscoverReadyAndroidEmulators = vi . mocked ( discoverReadyAndroidEmulators ) ;
96+ const mockObserveBoot = vi . mocked ( observeBootTimeMsFixture ) ;
10697const mockAwaitFixtureReadiness = vi . mocked ( awaitFixtureReadiness ) ;
10798
10899function createOpenHandler (
@@ -130,11 +121,8 @@ beforeEach(() => {
130121 mockAwaitFixtureReadiness . mockReset ( ) ;
131122 mockAwaitFixtureReadiness . mockResolvedValue ( undefined ) ;
132123 mockDiscoverReadyAndroidEmulators . mockReset ( ) ;
133- mockObserveSimulatorBoot . mockReset ( ) ;
134- mockObserveSimulatorBoot . mockImplementation ( async ( ) => ( {
135- observed : false ,
136- reason : 'unobserved' ,
137- } ) ) ;
124+ mockObserveBoot . mockReset ( ) ;
125+ mockObserveBoot . mockResolvedValue ( { observed : false , reason : 'unobserved' } ) ;
138126 mockDiscoverReadyAndroidEmulators . mockImplementation ( async ( device ) => [
139127 {
140128 ...device ,
@@ -705,10 +693,10 @@ test('an open that booted the device keeps the device against a foreign open', a
705693 // during preparation arms it here and the fake device reports that boot to every later probe.
706694 let bootedAtMs : number | undefined ;
707695 let bootArmed = false ;
708- mockObserveSimulatorBoot . mockImplementation ( async ( ) =>
696+ mockObserveBoot . mockImplementation ( async ( ) =>
709697 bootedAtMs === undefined
710- ? { observed : false , reason : 'unobserved' }
711- : { observed : true , bootedAtMs } ,
698+ ? ( { observed : false , reason : 'unobserved' } as const )
699+ : ( { observed : true , bootedAtMs } as const ) ,
712700 ) ;
713701 mockAwaitFixtureReadiness . mockImplementation ( async ( ) => {
714702 if ( bootArmed ) {
0 commit comments