@@ -251,7 +251,7 @@ export class RemoteLogs {
251251 */
252252 public async downloadAndProcess ( ) : Promise <
253253 | {
254- before : string ;
254+ before : string | undefined ;
255255 after : string ;
256256 description : ComparePerformanceDescriptionData ;
257257 }
@@ -262,17 +262,26 @@ export class RemoteLogs {
262262 void extLogger . log ( "No targets picked, aborting download" ) ;
263263 return undefined ;
264264 }
265- const processed = await Promise . all ( [
266- this . downloadAndProcessLogsForTarget ( picked . before ) ,
265+ const [ processedBefore , processedAfter ] = await Promise . all ( [
266+ ...( picked . before
267+ ? [ this . downloadAndProcessLogsForTarget ( picked . before ) ]
268+ : [ undefined ] ) ,
267269 this . downloadAndProcessLogsForTarget ( picked . after ) ,
268270 ] ) ;
269271
270- if ( processed . some ( ( d ) => typeof d === "undefined" ) ) {
271- throw new Error ( "Silently failed to download or process some logs!?" ) ;
272+ if ( picked . before && processedBefore === undefined ) {
273+ throw new Error (
274+ "Silently failed to download or process the 'before' logs!?" ,
275+ ) ;
276+ }
277+ if ( processedAfter === undefined ) {
278+ throw new Error (
279+ "Silently failed to download or process the 'after' logs!?" ,
280+ ) ;
272281 }
273282 return {
274- before : processed [ 0 ] ! ,
275- after : processed [ 1 ] ! ,
283+ before : processedBefore ,
284+ after : processedAfter ,
276285 description : picked . description ,
277286 } ;
278287 }
@@ -643,7 +652,7 @@ export class RemoteLogs {
643652
644653 private async pickTargets ( progress ?: ProgressCallback ) : Promise <
645654 | {
646- before : ArtifactDownload ;
655+ before ? : ArtifactDownload ;
647656 after : ArtifactDownload ;
648657 description : ComparePerformanceDescriptionData ;
649658 }
@@ -703,6 +712,7 @@ export class RemoteLogs {
703712 step : 4 ,
704713 maxStep : this . PICK_TARGETS_PROGRESS_STEPS ,
705714 } ) ;
715+ const NONE = "NONE" ;
706716 const targetChoice2 = await window . showQuickPick (
707717 targets
708718 . filter (
@@ -714,7 +724,8 @@ export class RemoteLogs {
714724 t . info . source_id === targetInfoChoice1 . info . source_id &&
715725 t . info . variant_id !== targetInfoChoice1 . info . variant_id ,
716726 )
717- . map ( ( t ) => t . info . target_id ) ,
727+ . map ( ( t ) => t . info . target_id )
728+ . concat ( NONE ) ,
718729 {
719730 title : `Pick target 2` ,
720731 ignoreFocusOut : true ,
@@ -726,6 +737,20 @@ export class RemoteLogs {
726737 void extLogger . log (
727738 `Picked ${ experimentChoice } ${ targetChoice1 } ${ targetChoice2 } ` ,
728739 ) ;
740+ if ( targetChoice2 === NONE ) {
741+ return {
742+ // the convention downstream is that "from" can be optional, but here it is the opposite ...
743+ before : undefined ,
744+ after : targetInfoChoice1 . downloads [ "evaluator-logs" ] ,
745+ description : {
746+ kind : "remote-logs" ,
747+ experimentName : experimentChoice ,
748+ fromTarget : undefined ,
749+ toTarget : targetChoice1 ,
750+ info,
751+ } ,
752+ } ;
753+ }
729754 const targetInfoChoice2 = targets . find (
730755 ( t ) => t . info . target_id === targetChoice2 ,
731756 ) ! ;
0 commit comments