@@ -47,6 +47,36 @@ const source = {
4747 files : { '/caller/flow.ad' : 'open com.example.app\nclose\n' } ,
4848} ;
4949
50+ test . each ( [ 'yaml' , 'yml' ] ) (
51+ 'bare %s replay reports explicit routing before plugin or device admission' ,
52+ async ( extension ) => {
53+ const f = await fixture ( ) ;
54+ const entry = `/caller/flow.${ extension } ` ;
55+ try {
56+ const result = await f . handler ( {
57+ token : 'token' ,
58+ command : 'replay' ,
59+ session : 'untouched' ,
60+ positionals : [ entry ] ,
61+ flags : { replayScriptSource : { entry, files : { [ entry ] : 'appId: com.example.app' } } } ,
62+ } ) ;
63+ expect ( result ) . toMatchObject ( {
64+ ok : false ,
65+ error : {
66+ code : 'INVALID_ARGS' ,
67+ message : `Maestro YAML requires explicit --maestro routing: replay ${ entry } --maestro` ,
68+ } ,
69+ } ) ;
70+ if ( result . ok ) throw new Error ( 'Bare YAML replay succeeded' ) ;
71+ expect ( result . error . details ?. installCommand ) . toBeUndefined ( ) ;
72+ expect ( f . discover ) . not . toHaveBeenCalled ( ) ;
73+ expect ( f . store . get ( 'untouched' ) ) . toBeUndefined ( ) ;
74+ } finally {
75+ await f . registry . close ( ) ;
76+ }
77+ } ,
78+ ) ;
79+
5080test . each ( [ 'replay' , 'test' ] as const ) (
5181 'missing %s execution is classified before device selection' ,
5282 async ( command ) => {
@@ -78,6 +108,31 @@ test.each(['replay', 'test'] as const)(
78108 } ,
79109) ;
80110
111+ test ( 'explicit Maestro routing still admits only the Maestro plugin' , async ( ) => {
112+ const f = await fixture ( ) ;
113+ const entry = '/caller/flow.yaml' ;
114+ try {
115+ const result = await f . handler ( {
116+ token : 'token' ,
117+ command : 'replay' ,
118+ session : 'untouched' ,
119+ positionals : [ entry ] ,
120+ flags : {
121+ replayBackend : 'maestro' ,
122+ replayScriptSource : { entry, files : { [ entry ] : 'appId: com.example.app' } } ,
123+ } ,
124+ } ) ;
125+ expect ( result ) . toMatchObject ( {
126+ ok : false ,
127+ error : { details : { reason : 'plugin-not-installed' , package : '@agent-device/maestro' } } ,
128+ } ) ;
129+ expect ( f . discover ) . not . toHaveBeenCalled ( ) ;
130+ expect ( f . store . get ( 'untouched' ) ) . toBeUndefined ( ) ;
131+ } finally {
132+ await f . registry . close ( ) ;
133+ }
134+ } ) ;
135+
81136test ( 'a changed store needs a daemon restart and embedded runtimes never consult it' , async ( ) => {
82137 const home = mkdtempForTestSync ( 'replay-plugin-store-' ) ;
83138 const env = { AGENT_DEVICE_HOME : home } ;
0 commit comments