@@ -263,15 +263,11 @@ describe("applyPluginNodeInvokePolicy", () => {
263263
264264 const result = await invokeDemoPolicy ( context ) ;
265265
266- if ( result === null ) {
267- throw new Error ( "expected plugin policy failure" ) ;
268- }
269- expect ( result . ok ) . toBe ( false ) ;
270- if ( result . ok ) {
271- throw new Error ( "expected plugin policy failure" ) ;
272- }
273- expect ( result . code ) . toBe ( "PLUGIN_POLICY_MISSING" ) ;
274- expect ( result . details ) . toStrictEqual ( { nodeCommandDispatched : false } ) ;
266+ expect ( result ) . toMatchObject ( {
267+ ok : false ,
268+ code : "PLUGIN_POLICY_MISSING" ,
269+ details : { nodeCommandDispatched : false } ,
270+ } ) ;
275271 expect ( invoke ) . not . toHaveBeenCalled ( ) ;
276272 } ) ;
277273
@@ -735,10 +731,13 @@ describe("applyPluginNodeInvokePolicy", () => {
735731 expect ( invoke ) . toHaveBeenCalledOnce ( ) ;
736732 } ) ;
737733
738- it ( "binds plugin policy approval requests to the invoking client ", async ( ) => {
734+ it . each ( [ false , true ] ) ( "routes approvals for synthetic=%s ", async ( synthetic ) => {
739735 const manager = new ExecApprovalManager < PluginApprovalRequestPayload > ( ) ;
740- const visibleConnIds = new Set ( [ "conn-owner-approval" ] ) ;
736+ const visibleConnIds = new Set (
737+ synthetic ? [ "conn-owner-approval" , "conn-requester" ] : [ "conn-owner-approval" ] ,
738+ ) ;
741739 const getApprovalClientConnIds = createApprovalClientLookup ( [
740+ createOperatorClient ( ) ,
742741 createOperatorClient ( "conn-owner-approval" ) ,
743742 createApprovalClient ( {
744743 connId : "conn-other-approval" ,
@@ -751,7 +750,9 @@ describe("applyPluginNodeInvokePolicy", () => {
751750 pluginApprovalManager : manager ,
752751 getApprovalClientConnIds,
753752 } ) ;
754- const resultPromise = invokeDemoPolicy ( context , createOperatorClient ( ) ) ;
753+ const requester = createOperatorClient ( ) ;
754+ requester . internal = synthetic ? { syntheticClient : true } : undefined ;
755+ const resultPromise = invokeDemoPolicy ( context , requester ) ;
755756
756757 const record = await expectSinglePendingApproval ( manager ) ;
757758 expect ( record . requestedByConnId ) . toBe ( "conn-requester" ) ;
0 commit comments