1+ import { IOS_SIMULATOR } from '../../__tests__/device-fixtures.ts' ;
12import { AppError } from '@agent-device/kernel/errors' ;
23import assert from 'node:assert/strict' ;
34import { test } from 'vitest' ;
@@ -84,17 +85,23 @@ test('a sparse capture of a presented system surface names the surface host', ()
8485// The registry, not the wire, decides the kind: a payment host stamped with the wrong kind reads
8586// back as `payment`, and a bundle id the registry does not know is dropped rather than surfaced.
8687test ( 'the wire reader takes surface kind from the registry and drops unregistered hosts' , ( ) => {
87- const mismatched = readAppleSnapshotResult ( {
88- systemSurface : { bundleId : 'com.apple.PassbookUIService' , kind : 'web-auth' } ,
89- } ) ;
88+ const mismatched = readAppleSnapshotResult (
89+ {
90+ systemSurface : { bundleId : 'com.apple.PassbookUIService' , kind : 'web-auth' } ,
91+ } ,
92+ IOS_SIMULATOR ,
93+ ) ;
9094 assert . deepEqual ( mismatched . systemSurface , {
9195 bundleId : 'com.apple.PassbookUIService' ,
9296 kind : 'payment' ,
9397 } ) ;
9498
95- const unregistered = readAppleSnapshotResult ( {
96- systemSurface : { bundleId : 'com.example.notahost' , kind : 'payment' } ,
97- } ) ;
99+ const unregistered = readAppleSnapshotResult (
100+ {
101+ systemSurface : { bundleId : 'com.example.notahost' , kind : 'payment' } ,
102+ } ,
103+ IOS_SIMULATOR ,
104+ ) ;
98105 assert . equal ( unregistered . systemSurface , undefined ) ;
99106} ) ;
100107
@@ -171,16 +178,22 @@ test('a presented system surface travels with an undeclared-payload refusal as t
171178} ) ;
172179
173180test ( 'readAppleSnapshotResult keeps registry-known system surface provenance only' , ( ) => {
174- const known = readAppleSnapshotResult ( {
175- nodes : [ ] ,
176- systemSurface : { bundleId : 'com.apple.SafariViewService' , kind : 'web-auth' } ,
177- } ) ;
181+ const known = readAppleSnapshotResult (
182+ {
183+ nodes : [ ] ,
184+ systemSurface : { bundleId : 'com.apple.SafariViewService' , kind : 'web-auth' } ,
185+ } ,
186+ IOS_SIMULATOR ,
187+ ) ;
178188 assert . deepEqual ( known . systemSurface , SYSTEM_SHEET ) ;
179189
180- const unknown = readAppleSnapshotResult ( {
181- nodes : [ ] ,
182- systemSurface : { bundleId : 'com.example.PhishingService' , kind : 'web-auth' } ,
183- } ) ;
190+ const unknown = readAppleSnapshotResult (
191+ {
192+ nodes : [ ] ,
193+ systemSurface : { bundleId : 'com.example.PhishingService' , kind : 'web-auth' } ,
194+ } ,
195+ IOS_SIMULATOR ,
196+ ) ;
184197 assert . equal ( unknown . systemSurface , undefined ) ;
185198} ) ;
186199
@@ -246,26 +259,35 @@ test('the reader forwards each published keyboard band shape unchanged', () => {
246259 // The landscape band #2653 confirmed on iPhone 17 Pro: the runner answers `app.keyboards` in the
247260 // app's own orientation space, so the daemon reads these numbers beside node rects unchanged.
248261 assert . deepEqual (
249- readAppleSnapshotResult ( {
250- keyboard : { kind : 'visible' , frame : { x : 0 , y : 198 , width : 874 , height : 204 } } ,
251- } ) . keyboard ,
262+ readAppleSnapshotResult (
263+ {
264+ keyboard : { kind : 'visible' , frame : { x : 0 , y : 198 , width : 874 , height : 204 } } ,
265+ } ,
266+ IOS_SIMULATOR ,
267+ ) . keyboard ,
252268 { kind : 'visible' , frame : { x : 0 , y : 198 , width : 874 , height : 204 } } ,
253269 ) ;
254- assert . deepEqual ( readAppleSnapshotResult ( { keyboard : { kind : 'absent' } } ) . keyboard , {
255- kind : 'absent' ,
256- } ) ;
257270 assert . deepEqual (
258- readAppleSnapshotResult ( {
259- keyboard : { kind : 'unmeasurable' , reason : 'keyboard-frame-query-timeout' } ,
260- } ) . keyboard ,
271+ readAppleSnapshotResult ( { keyboard : { kind : 'absent' } } , IOS_SIMULATOR ) . keyboard ,
272+ {
273+ kind : 'absent' ,
274+ } ,
275+ ) ;
276+ assert . deepEqual (
277+ readAppleSnapshotResult (
278+ {
279+ keyboard : { kind : 'unmeasurable' , reason : 'keyboard-frame-query-timeout' } ,
280+ } ,
281+ IOS_SIMULATOR ,
282+ ) . keyboard ,
261283 { kind : 'unmeasurable' , reason : 'keyboard-frame-query-timeout' } ,
262284 ) ;
263285} ) ;
264286
265287test ( 'a capture from a tier that never reads the keyboard publishes no fact at all' , ( ) => {
266288 // The query sweep and private-AX tiers answer with no `keyboard` key, which is how the daemon
267289 // learns to keep deriving the band from that tree instead of being told the screen is clear.
268- assert . equal ( readAppleSnapshotResult ( { nodes : [ ] } ) . keyboard , undefined ) ;
290+ assert . equal ( readAppleSnapshotResult ( { nodes : [ ] } , IOS_SIMULATOR ) . keyboard , undefined ) ;
269291} ) ;
270292
271293// Routing proof: every reason below is emitted only by the kernel reader, never by a wire producer.
@@ -280,7 +302,7 @@ test('a malformed keyboard payload is restated by the kernel reader, never forwa
280302 ] ;
281303
282304 for ( const [ payload , reason ] of cases ) {
283- const read = readAppleSnapshotResult ( { keyboard : payload } ) . keyboard ;
305+ const read = readAppleSnapshotResult ( { keyboard : payload } , IOS_SIMULATOR ) . keyboard ;
284306 assert . deepEqual ( read , { kind : 'unmeasurable' , reason } , `payload ${ JSON . stringify ( payload ) } ` ) ;
285307 }
286308} ) ;
@@ -386,3 +408,21 @@ test('a raw projection publishes no viewport, because nothing validated its box
386408
387409 assert . equal ( 'viewport' in presented , false ) ;
388410} ) ;
411+
412+ test ( 'runner presented and quality nodes share RN interpretation without replacing raw evidence' , ( ) => {
413+ const node = { index : 0 , type : 'Other' , value : 'checkbox, unchecked' } ;
414+ const result = readAppleSnapshotResult (
415+ {
416+ nodes : [ node ] ,
417+ qualityPayload : { nodes : [ node ] , truncated : false } ,
418+ } ,
419+ IOS_SIMULATOR ,
420+ ) ;
421+ for ( const interpreted of [ result . nodes ?. [ 0 ] , result . qualityPayload ?. nodes [ 0 ] ] ) {
422+ assert . equal ( interpreted ?. checked , false ) ;
423+ assert . equal ( interpreted ?. value , node . value ) ;
424+ assert . equal ( interpreted ?. type , node . type ) ;
425+ assert . equal ( interpreted ?. iosValueSemantics ?. role , 'checkbox' ) ;
426+ }
427+ assert . equal ( 'checked' in node , false ) ;
428+ } ) ;
0 commit comments