'You need to commit changes before validating them' error message when validating a Destructive Changes User StoryTrying to validate a User Story in Copado you might receive the following error message:
'You need to commit changes before validating them'
Before validating a User Story, Copado will verify the field "Metadata Type in Selection". This field is populated from the attachment in the User Story called "Git Metadata". This attachment is empty in a Destructive Changes User Story since no component is being updated, just deleted, so the populated attachment is the one called "Git Deletion" instead, thereby "Git Metadata" is empty, so "Metadata Types in selection" is never populated, in consequence when we try to validate we display the error 'You need to commit changes before validating them'.
Please, bear in mind that currently, in the way that Copado performs the destructive changes operation, it doesn't make much sense to validate a User Story even if this is solved and working as expected. The explanation for it is that we have two different steps in the deployment while performing a destructive change:
-Git Promotion Step: Here we will create a promotion branch and we will update Git for deleting every component selected in the User Story but updating as well all the referred components related to the components to be deleted. This deployment could be a validation deployment for checking if you will be able to deploy the changes or you will not. So it can pass or it can fail.
-Delete MetaData Step: This step is for actually removing the selected components in your destination org. Even if the Git Promotion Step was completed successfully, this step can fail because of different reasons (permissions in the component, requirements for related components, etc). This step cannot be pretended or mocked, because of the nature of the step itself.
For that reason, the validation deployment of destructive changes could not make sense, because there are two different steps that can fail. The validation for the User Story can pass, but the actual Delete Metadata Step can fail.
As an alternative solution for validating a User Story which just contains destructive changes to manually populate the field in the User Story "Metadata Types in Selection" with the types committed, this should allow the validation.