Skip to content

Create batch change, batch spec, and changeset specs for find-and-replace

Created by: courier-new

The scope of this ticket includes the backend support for creating the batch change, batch spec, and changeset specs for a find-and-replace operation when the user clicks "Preview Pull Requests" on the configuration page. As such, it has several component prerequisites which should be implemented first.

The backend needs to be able to:

  1. Create a new empty batch change.
  2. Invoke the service method to create a batch spec for the operation (implementation of service method is not in scope, this is 1st prerequisite).
  3. Start up a background process which creates a new Compute stream with the replace.diff command (implementation of replace.diff is not in scope, this is 2nd prerequisite) and saves the resultant diffs as ChangesetSpecs. This process is probably a dbworker, so that we can track its state or if it fails.
  4. Query background process status until the stream finishes or we've hit our upper limit on file count (testing to determine the appropriate upper limit is a separate issue, for this issue we can just pick something arbitrary like 100).

We could either reuse the createEmptyBatchChange mutation and create a new one invoked on its success for steps 2-3 (the batch spec + changeset specs), OR we could create a new single mutation to do all of the steps 1-3. We also need to be able to query the status of the job that is converting the Compute diffs into ChangesetSpecs over GraphQL.