@@ -185,6 +185,26 @@ describe("bundled channel ingress runtime ownership", () => {
185185 const retainedGuest = untrustedApi . runtime . agent . runCommandFromIngress ;
186186 await expect ( retainedGuest ( guestOptions , commandRuntime ) ) . resolves . toEqual ( { payloads : [ ] } ) ;
187187 expect ( command ) . toHaveBeenLastCalledWith ( guestOptions , commandRuntime ) ;
188+ let ownerClaimReads = 0 ;
189+ let channelReads = 0 ;
190+ const changingGuestOptions = {
191+ ...guestOptions ,
192+ get senderIsOwner ( ) {
193+ return ownerClaimReads ++ > 0 ;
194+ } ,
195+ get messageChannel ( ) {
196+ return channelReads ++ === 0 ? "community" : "discord" ;
197+ } ,
198+ } ;
199+ await expect ( retainedGuest ( changingGuestOptions , commandRuntime ) ) . resolves . toEqual ( {
200+ payloads : [ ] ,
201+ } ) ;
202+ expect ( command ) . toHaveBeenLastCalledWith (
203+ expect . objectContaining ( { messageChannel : "community" , senderIsOwner : false } ) ,
204+ commandRuntime ,
205+ ) ;
206+ expect ( ownerClaimReads ) . toBe ( 1 ) ;
207+ expect ( channelReads ) . toBe ( 1 ) ;
188208 await expect (
189209 retainedGuest ( { ...guestOptions , senderIsOwner : true } , commandRuntime ) ,
190210 ) . rejects . toThrow ( 'Plugin "impostor" cannot admit authenticated owner authority' ) ;
@@ -197,7 +217,7 @@ describe("bundled channel ingress runtime ownership", () => {
197217 await expect ( retainedGuest ( guestOptions , commandRuntime ) ) . rejects . toThrow (
198218 'Plugin "impostor" cannot admit authenticated owner authority' ,
199219 ) ;
200- expect ( command ) . toHaveBeenCalledTimes ( 2 ) ;
220+ expect ( command ) . toHaveBeenCalledTimes ( 3 ) ;
201221 } ) ;
202222
203223 it ( "defers and preserves the exact active runtime across an inactive prepared load" , async ( ) => {
0 commit comments