sourcegraph/src-cli

SSBC: `src batch remote` preview link returns 404 if batch change did not already exist

courier-new opened this issue ยท 0 comments

In src/batch_remote.go we create the batch spec but we forget to make sure the batch change exists first. ๐Ÿ™ƒ It was previously possible to view a remote execution in isolation without a parent batch change, but this is no longer possible. However, with src-cli, it's possible to run a remote execution for a batch change that already exists or doesn't yet exist, whilst the mutation that the frontend UI uses to create the empty batch change (CreateEmptyBatchChange) fails if a batch change by that name already exists, so we either need to:

  • Create a new mutation like UpsertEmptyBatchChange that doesn't fail if a batch change by that name already exists, or
  • Add a new parameter to CreateEmptyBatchChange like allowUpsert that changes the behavior of the mutation so that it doesn't fail.

We should then call that mutation from src/batch_remote.go before we call CreateBatchSpecFromRaw, so that the batch change exists to load from for the preview link.