@@ -306,6 +306,51 @@ await CreateService(api.Api.Object, blobClientFactory)
306306 Assert . Null ( capturedRequest . Branch ) ;
307307 }
308308
309+ [ Fact ]
310+ public async Task ResubmitWorkItemsAsync_FallsBackToParsingSourceWhenPropertiesAreMissing ( )
311+ {
312+ var api = CreateApi ( ) ;
313+ api . Job
314+ . Setup ( j => j . DetailsAsync ( "original-job" , It . IsAny < CancellationToken > ( ) ) )
315+ . ReturnsAsync ( JobDetails ( source : "ci/public/dotnet/arcade/refs/heads/main" , includeSourceMetadataInProperties : false ) ) ;
316+ api . Storage
317+ . Setup ( s => s . NewAsync ( It . IsAny < ContainerCreationRequest > ( ) , It . IsAny < CancellationToken > ( ) ) )
318+ . ReturnsAsync ( new ContainerInformation (
319+ DateTimeOffset . Parse ( "2026-04-30T00:00:00Z" ) ,
320+ DateTimeOffset . Parse ( "2026-05-30T00:00:00Z" ) ,
321+ "creator" ,
322+ "container" ,
323+ "account" ,
324+ Guid . Empty ,
325+ "region" )
326+ {
327+ ReadToken = "?read" ,
328+ WriteToken = "?write" ,
329+ } ) ;
330+
331+ JobCreationRequest capturedRequest = null ;
332+ api . Job
333+ . Setup ( j => j . NewAsync ( It . IsAny < JobCreationRequest > ( ) , It . IsAny < string > ( ) , null , It . IsAny < CancellationToken > ( ) ) )
334+ . Callback < JobCreationRequest , string , bool ? , CancellationToken > ( ( request , _ , _ , _ ) => capturedRequest = request )
335+ . ReturnsAsync ( new JobCreationResult ( "new-job" , "summary" , "results" , null ) ) ;
336+
337+ var blobClientFactory = new FakeBlobClientFactory
338+ {
339+ DownloadedText = """[{ "WorkItemId": "work-a", "Command": "run a", "PayloadUri": "payload-a" }]""" ,
340+ UploadedBlobUri = new Uri ( "https://account.blob.core.windows.net/container/job-list.json" ) ,
341+ } ;
342+
343+ await CreateService ( api . Api . Object , blobClientFactory )
344+ . ResubmitWorkItemsAsync ( new HelixJobInfo ( "original-job" , "finished" ) , [ WorkItem ( "work-a" ) ] , CancellationToken . None ) ;
345+
346+ Assert . NotNull ( capturedRequest ) ;
347+ Assert . Null ( capturedRequest . Source ) ;
348+ Assert . Equal ( "ci" , capturedRequest . SourcePrefix ) ;
349+ Assert . Equal ( "public" , capturedRequest . TeamProject ) ;
350+ Assert . Equal ( "dotnet/arcade" , capturedRequest . Repository ) ;
351+ Assert . Equal ( "refs/heads/main" , capturedRequest . Branch ) ;
352+ }
353+
309354 private static HelixService CreateService ( IHelixApi api , IBlobClientFactory blobClientFactory = null , IFileSystem fileSystem = null )
310355 => new (
311356 api ,
0 commit comments