@@ -267,50 +267,55 @@ test(scenarioNames(RUNTIME_SELECTOR_COVERAGE, 'targetStability')[0]!, async () =
267267 assert . equal ( captures , 3 , 'one resolution capture plus the gate two re-observations' ) ;
268268} ) ;
269269
270- test ( scenarioNames ( RUNTIME_SELECTOR_COVERAGE , 'targetStability' ) [ 1 ] ! , async ( ) => {
271- const taps : Point [ ] = [ ] ;
272- let captures = 0 ;
273- // Still moving when the window ran out: the two re-observations disagree.
274- const positions = [
275- continueButtonAtRect ( 240 , 20 ) ,
276- continueButtonAtRect ( 300 , 20 ) ,
277- continueButtonAtRect ( 360 , 20 ) ,
278- ] ;
279- const device = createContractDevice ( positions [ 0 ] ! , {
280- captureSnapshot : async ( ) => ( { snapshot : positions [ captures ++ ] ?? positions [ 2 ] ! } ) ,
281- tap : async ( _context , point ) => {
282- taps . push ( point ) ;
283- } ,
284- clock : createContractClock ( ) ,
285- sessionState : {
286- movingTargetBaseline : { finishedAt : 0 , tree : { nodes : viewportOnlySnapshot ( ) . nodes } } ,
287- } ,
288- } ) ;
289-
290- await assert . rejects (
291- ( ) => device . interactions . press ( selector ( 'label=Continue' ) , { session : 'default' } ) ,
292- ( error : unknown ) => {
293- assert . ok ( error instanceof Error ) ;
294- // Names the failed confirmation, not motion: the unmeasured shape cannot claim that.
295- assert . match (
296- error . message ,
297- / l a b e l = C o n t i n u e h a d n o c o n f i r m e d r e s t i n g p o s i t i o n w h e n t h e t r a n s i t i o n w i n d o w r a n o u t / ,
270+ // The wiring, through the real daemon route rather than an injected session record: press A must
271+ // LEAVE the tree it acted through on the session (#3471) and press B must be screened against it.
272+ // Deleting either half of that — the writer in `dispatchRuntimeInteraction` or the carrier in
273+ // `toRuntimeSessionRecord` — leaves B idle, so it taps the vacated point and this fails.
274+ test (
275+ scenarioNames ( RUNTIME_SELECTOR_COVERAGE , 'targetStability' ) [ 1 ] ! ,
276+ async ( ) => {
277+ // The shared runner tree with the Continue button's frame translated to `y`.
278+ const runnerNodesAtY = ( y : number ) =>
279+ RUNNER_CONTINUE_NODES . map ( ( node ) =>
280+ node . index === 1 ? { ...node , rect : { ...node . rect , y } } : node ,
298281 ) ;
299- const details = ( error as { details ?: Record < string , unknown > } ) . details ;
300- assert . equal ( details ?. reason , INTERACTION_ERROR_REASONS . targetStillMoving ) ;
301- assert . equal ( details ?. dispatched , 'no' ) ;
302- assert . equal ( details ?. selector , 'label=Continue' ) ;
303- // The position the caller resolved and the one the re-observations found: the pair that says
304- // which way the surface is going.
305- assert . deepEqual ( details ?. rect , { x : 240 , y : 20 , width : 100 , height : 40 } ) ;
306- assert . deepEqual ( details ?. movedToRect , { x : 360 , y : 20 , width : 100 , height : 40 } ) ;
307- assert . equal ( typeof details ?. waitedMs , 'number' ) ;
308- assert . match ( String ( details ?. hint ) , / l a b e l = C o n t i n u e / ) ;
309- return true ;
310- } ,
311- ) ;
312- assert . deepEqual ( taps , [ ] ) ;
313- } ) ;
282+ await withIosContractDaemon (
283+ [
284+ // A resolves and taps at y=300; B resolves at 360 and its two re-observations disagree.
285+ runnerSnapshotEntry ( runnerNodesAtY ( 300 ) ) ,
286+ runnerTapEntry ( { x : 200 , y : 322 } ) ,
287+ runnerSnapshotEntry ( runnerNodesAtY ( 360 ) ) ,
288+ runnerSnapshotEntry ( runnerNodesAtY ( 420 ) ) ,
289+ runnerSnapshotEntry ( runnerNodesAtY ( 480 ) ) ,
290+ ] ,
291+ async ( daemon , transcript ) => {
292+ assertRpcOk ( await daemon . callCommand ( 'press' , [ 'label=Continue' ] ) ) ;
293+ const refusal = await daemon . callCommand ( 'press' , [ 'label=Continue' ] ) ;
294+ const data = assertRpcError (
295+ refusal ,
296+ 'COMMAND_FAILED' ,
297+ / l a b e l = C o n t i n u e h a d n o c o n f i r m e d r e s t i n g p o s i t i o n w h e n t h e t r a n s i t i o n w i n d o w r a n o u t / ,
298+ ) ;
299+ const details = data . details as Record < string , unknown > ;
300+ assert . equal ( details . reason , INTERACTION_ERROR_REASONS . targetStillMoving ) ;
301+ assert . equal ( details . dispatched , 'no' ) ;
302+ assert . deepEqual ( details . rect , { x : 100 , y : 360 , width : 200 , height : 44 } ) ;
303+ assert . deepEqual ( details . movedToRect , { x : 100 , y : 480 , width : 200 , height : 44 } ) ;
304+ // A: one capture. B: its resolution plus the gate's two. Any other count is the harness's
305+ // `assertComplete` failing, which is what makes the unused deletion above visible.
306+ assert . equal (
307+ transcript . calls . filter ( ( call ) => call . command === 'ios.runner.snapshot' ) . length ,
308+ 4 ,
309+ ) ;
310+ assert . equal (
311+ transcript . calls . filter ( ( call ) => call . command === 'ios.runner.tap' ) . length ,
312+ 1 ,
313+ ) ;
314+ } ,
315+ ) ;
316+ } ,
317+ PARALLEL_PROVIDER_SCENARIO_TIMEOUT_MS ,
318+ ) ;
314319
315320// The cost contract, as a scenario: the gate reads a tree the session already holds, so a press
316321// whose target the previous action left in place spends the one capture it always spent.
0 commit comments