Skip to content

Validate ChangesetSpecs on server

Warren Gifford requested to merge mrn/ssbc-validate-specs into main

Created by: mrnugget

With SSBC we need to validate on the server that the ChangesetSpecs we built won't push to the same branch in the same repository. In src-cli we did that at the end, before uploading the changeset specs, here in this method.

Since it's a bit cumbersome to kick off the validation once all changeset specs are done (lots of race conditions waiting there!), Erik and I decided on the solution here:

  1. We validate the ChangesetSpecs in the FailureMessage and State methods of the BatchSpecResolver.
  2. The UI can then disable the "Preview" (or "Apply") button if State == Failed or FailureMessage != nil.
  3. In ApplyBatchChange, the method that applies a batch spec, we do the validation again to error.

The code here is just the backend portion (the State() and FailureMessage() need more stuff once we flesh out the UI!).

In the future we can also statically validate the batch spec beforehand to say "hey, you're using workspaces or transformChanges but all the changesets would get the same branch", or something.

Merge request reports

Loading