@@ -150,97 +150,6 @@ describe("main session recovery store", () => {
150150 } ) ;
151151 } ) ;
152152
153- it ( "cancels a reservation after Gateway migrates its legacy session key" , async ( ) => {
154- const legacyKey = "main" ;
155- await seedExact ( { [ legacyKey ] : interruptedEntry ( ) } ) ;
156- const reservation = await reserve ( legacyKey ) ;
157- const legacyEntry = readStore ( ) [ legacyKey ] ! ;
158- await applySessionEntryLifecycleMutation ( {
159- storePath,
160- removals : [ { sessionKey : legacyKey } ] ,
161- upserts : [ { sessionKey, entry : legacyEntry } ] ,
162- skipMaintenance : true ,
163- } ) ;
164-
165- const cancelled = await commitMainSessionRecovery ( {
166- command : { kind : "cancel_reservation" , reservation } ,
167- target : { sessionKey : legacyKey , storePath } ,
168- } ) ;
169-
170- expect ( cancelled . transition ) . toEqual ( { kind : "applied" } ) ;
171- expect ( read ( ) . mainRestartRecovery ) . toMatchObject ( { chargedAttempts : 0 } ) ;
172- expect ( read ( ) . mainRestartRecovery ?. reservation ) . toBeUndefined ( ) ;
173- } ) ;
174-
175- it ( "abandons a reservation after Gateway migrates its legacy session key" , async ( ) => {
176- const legacyKey = "main" ;
177- await seedExact ( { [ legacyKey ] : interruptedEntry ( ) } ) ;
178- const reservation = await reserve ( legacyKey ) ;
179- const legacyEntry = readStore ( ) [ legacyKey ] ! ;
180- await applySessionEntryLifecycleMutation ( {
181- storePath,
182- removals : [ { sessionKey : legacyKey } ] ,
183- upserts : [ { sessionKey, entry : legacyEntry } ] ,
184- skipMaintenance : true ,
185- } ) ;
186-
187- const abandoned = await commitMainSessionRecovery ( {
188- command : { kind : "abandon_reservation" , reservation } ,
189- target : { sessionKey : legacyKey , storePath } ,
190- } ) ;
191-
192- expect ( abandoned . transition ) . toEqual ( { kind : "applied" } ) ;
193- expect ( read ( ) . mainRestartRecovery ) . toMatchObject ( { chargedAttempts : 1 } ) ;
194- expect ( read ( ) . mainRestartRecovery ?. reservation ) . toBeUndefined ( ) ;
195- } ) ;
196-
197- it ( "admits a legacy-key reservation through its canonical Gateway key" , async ( ) => {
198- const legacyKey = "main" ;
199- await seedExact ( { [ legacyKey ] : interruptedEntry ( ) } ) ;
200- await reserve ( legacyKey ) ;
201-
202- const validated = await commitMainSessionRecovery ( {
203- command : {
204- kind : "validate_recovery" ,
205- lifecycleGeneration,
206- runId : "recovery-1" ,
207- sessionId : "session-1" ,
208- } ,
209- target : { sessionKey, storePath } ,
210- } ) ;
211- expect ( validated . transition ) . toEqual ( { kind : "recovery_validated" } ) ;
212-
213- const admitted = await commitMainSessionRecovery ( {
214- command : {
215- kind : "admit_recovery" ,
216- lifecycleGeneration,
217- now : 300 ,
218- runId : "recovery-1" ,
219- sessionId : "session-1" ,
220- } ,
221- target : { sessionKey, storePath } ,
222- } ) ;
223- expect ( admitted . transition ) . toEqual ( { kind : "admitted_recovery" } ) ;
224- expect ( readStore ( ) [ legacyKey ] ) . toMatchObject ( {
225- abortedLastRun : false ,
226- mainRestartRecovery : { chargedAttempts : 1 } ,
227- } ) ;
228- expect ( readStore ( ) [ legacyKey ] ?. mainRestartRecovery ?. reservation ) . toBeUndefined ( ) ;
229-
230- const restored = await commitMainSessionRecovery ( {
231- command : {
232- kind : "mark_admitted_recovery_interrupted" ,
233- lifecycleGeneration,
234- now : 400 ,
235- runId : "recovery-1" ,
236- sessionId : "session-1" ,
237- } ,
238- target : { sessionKey : admitted . sessionKey ! , storePath } ,
239- } ) ;
240- expect ( restored . transition ) . toEqual ( { kind : "applied" } ) ;
241- expect ( readStore ( ) [ legacyKey ] ) . toMatchObject ( { abortedLastRun : true } ) ;
242- } ) ;
243-
244153 it ( "transfers a resumed recovery run to one durable lifecycle owner" , async ( ) => {
245154 await write (
246155 interruptedEntry ( {
@@ -355,31 +264,6 @@ describe("main session recovery store", () => {
355264 } ) ;
356265 } ) ;
357266
358- it ( "claims an interrupted row through its pre-migration alias" , async ( ) => {
359- const legacyKey = "main" ;
360- await seedExact ( { [ legacyKey ] : interruptedEntry ( ) } ) ;
361-
362- const claim = await claimMainSessionRecoveryOwner ( {
363- lifecycleGeneration,
364- sessionId : "session-1" ,
365- target : { sessionKey, storePath } ,
366- } ) ;
367-
368- expect ( claim . kind ) . toBe ( "claimed" ) ;
369- if ( claim . kind !== "claimed" ) {
370- return ;
371- }
372- expect ( claim . lease . sessionKey ) . toBe ( legacyKey ) ;
373- expect ( readStore ( ) [ legacyKey ] ) . toMatchObject ( {
374- mainRestartRecovery : {
375- foregroundClaims : {
376- lifecycleGeneration,
377- tokens : [ claim . lease . claimId ] ,
378- } ,
379- } ,
380- } ) ;
381- } ) ;
382-
383267 it ( "claims the exact foreground row without scanning aliases" , async ( ) => {
384268 await write ( interruptedEntry ( ) ) ;
385269 const accessorSpy = vi . spyOn ( sessionAccessor , "applySessionEntryReplacements" ) ;
@@ -621,31 +505,6 @@ describe("main session recovery store", () => {
621505 expect ( read ( ) . mainRestartRecovery ?. foregroundClaims ) . toBeUndefined ( ) ;
622506 } ) ;
623507
624- it ( "claims an interrupted legacy predecessor after its canonical key is reused" , async ( ) => {
625- const legacyKey = "main" ;
626- await seedExact ( {
627- [ sessionKey ] : { sessionId : "session-2" , updatedAt : 200 } ,
628- [ legacyKey ] : interruptedEntry ( ) ,
629- } ) ;
630-
631- const claim = await claimMainSessionRecoveryOwner ( {
632- lifecycleGeneration,
633- replacementSessionId : "session-2" ,
634- sessionId : "session-1" ,
635- target : { sessionKey, storePath } ,
636- } ) ;
637-
638- expect ( claim . kind ) . toBe ( "claimed" ) ;
639- if ( claim . kind !== "claimed" ) {
640- throw new Error ( "expected foreground owner claim" ) ;
641- }
642- expect ( claim . lease . sessionKey ) . toBe ( legacyKey ) ;
643- expect ( readStore ( ) [ legacyKey ] ?. mainRestartRecovery ?. foregroundClaims ?. tokens ) . toEqual ( [
644- claim . lease . claimId ,
645- ] ) ;
646- expect ( readStore ( ) [ sessionKey ] ?. mainRestartRecovery ) . toBeUndefined ( ) ;
647- } ) ;
648-
649508 it ( "validates a transferred owner against the latest durable row" , async ( ) => {
650509 await write ( interruptedEntry ( ) ) ;
651510 const claim = await claimMainSessionRecoveryOwner ( {
0 commit comments