Validate ChangesetSpecs on server
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:
- We validate the ChangesetSpecs in the
FailureMessage
andState
methods of theBatchSpecResolver
. - The UI can then disable the "Preview" (or "Apply") button if
State == Failed
orFailureMessage != nil
. - 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.