@@ -122,6 +122,22 @@ test.each([1, 2] as const)(
122122 await expect ( settleVerifiedOrphanedClaim ( f . claim , f . recovery , f . env ) ) . rejects . toBe (
123123 f . cleanupError ,
124124 ) ;
125+ expect ( f . emit ) . toHaveBeenCalledOnce ( ) ;
126+ expect ( f . emit ) . toHaveBeenCalledWith (
127+ expect . objectContaining ( {
128+ phase : 'device_claim_recovery_dispose_failed' ,
129+ data : expect . objectContaining ( {
130+ deviceKey : f . claim . deviceKey ,
131+ ownerSession : f . claim . session ,
132+ error : expect . objectContaining ( {
133+ details : {
134+ reason : 'platform-owner-shutdown-failed' ,
135+ failures : expectedFailures . slice ( 0 , failureCount ) ,
136+ } ,
137+ } ) ,
138+ } ) ,
139+ } ) ,
140+ ) ;
125141 const normalized = normalizeError ( f . cleanupError ) ;
126142 expect ( JSON . parse ( JSON . stringify ( normalized ) ) ) . toMatchObject ( {
127143 code : 'COMMAND_FAILED' ,
@@ -252,6 +268,9 @@ test.each([
252268 [ 'retained' , 'circular' ] ,
253269 [ 'retained' , 'toJSON' ] ,
254270 [ 'retained' , 'sink' ] ,
271+ [ 'reconciled' , 'circular' ] ,
272+ [ 'reconciled' , 'toJSON' ] ,
273+ [ 'reconciled' , 'sink' ] ,
255274] as const ) (
256275 'preserves %s outcome and claim when secondary diagnostics encounter %s' ,
257276 async ( outcome , fault ) => {
@@ -264,7 +283,7 @@ test.each([
264283 const f = fixture (
265284 async ( ) => {
266285 if ( outcome === 'primary-error' ) throw primary ;
267- return retained ;
286+ return outcome === ' retained' ? retained : { status : 'reconciled' } ;
268287 } ,
269288 1 ,
270289 fault === 'circular'
@@ -283,6 +302,7 @@ test.each([
283302 } ) ;
284303 const recovery = settleVerifiedOrphanedClaim ( f . claim , f . recovery , f . env ) ;
285304 if ( outcome === 'primary-error' ) await expect ( recovery ) . rejects . toBe ( primary ) ;
305+ else if ( outcome === 'reconciled' ) await expect ( recovery ) . rejects . toBe ( f . cleanupError ) ;
286306 else await expect ( recovery ) . resolves . toBe ( retained ) ;
287307 if ( fault === 'circular' ) {
288308 expect ( f . emit ) . toHaveBeenCalledOnce ( ) ;
0 commit comments