@@ -895,6 +895,51 @@ describe("retained-source retry policy", () => {
895895} ) ;
896896
897897describe ( "recovery admission" , ( ) => {
898+ it . each ( [ null , source ] ) (
899+ "gives a verified re-upload fresh attempts without reviving the old worker: %j" ,
900+ async ( retainedSource ) => {
901+ const old = await createAttempt ( ) ;
902+ rows . jobs = [
903+ {
904+ ...old ,
905+ state : "source-blocked" ,
906+ source : retainedSource ,
907+ attemptCount : 70 ,
908+ leaseExpiresAt : null ,
909+ errorCode : "source-reupload-required" ,
910+ } ,
911+ ] ;
912+ const resumed = await ensureSegmentProcessingJob ( {
913+ videoId,
914+ userId,
915+ verification : { ...verification , requiredAudio : false } ,
916+ } ) ;
917+ expect ( resumed . created ) . toBe ( true ) ;
918+ expect ( resumed . job . generation ) . not . toBe ( old . generation ) ;
919+ expect ( resumed . job ) . toMatchObject ( {
920+ state : "committing" ,
921+ attemptCount : 0 ,
922+ source : null ,
923+ verification : { requiredAudio : true } ,
924+ } ) ;
925+ expect ( await heartbeatAttempt ( old ) ) . toBe ( false ) ;
926+ expect (
927+ await claimProcessingAttempt ( {
928+ videoId,
929+ generation : resumed . job . generation ,
930+ } ) ,
931+ ) . toMatchObject ( { attemptCount : 1 } ) ;
932+ const repeated = await ensureSegmentProcessingJob ( {
933+ videoId,
934+ userId,
935+ verification,
936+ } ) ;
937+ expect ( repeated . created ) . toBe ( false ) ;
938+ expect ( repeated . job . generation ) . toBe ( resumed . job . generation ) ;
939+ expect ( repeated . job . attemptCount ) . toBe ( 1 ) ;
940+ } ,
941+ ) ;
942+
898943 it ( "keeps an inspected missing source paused until a completion request resumes it" , async ( ) => {
899944 const attempt = await createAttempt ( ) ;
900945 const paused = {
0 commit comments