-
Notifications
You must be signed in to change notification settings - Fork 429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent versioned change requests from overwriting each other #4145
Comments
Some thoughts on possible (perhaps temporary) improvements:
Some thoughts on a more permanent solution:
My preference here would be option (1) since I believe that will handle scheduled changes as well, but we will likely still need to consider how we deal with merge conflicts between multiple change requests. For example, if CR1 enables a feature for a segment, and CR2 adds a value for it, how would we handle this? |
As discussed with @kyle-ssg the permanent solution will behave as follows. When creating a change request, a 'diff' will be provided to the API. This diff will consist of:
This diff will include only the list of changes to be made to the flag, not the entire feature as it exists in the given environment. When a change request is published, this diff will be applied to the feature at that point to create a new version of the feature by merging the changes into the other existing components of the feature. If there are conflicts at the point of publishing, or when the scheduled date is reached, an error will be raised rather than overwriting what is there. It is still TBD how / if users will be able to reconcile any conflicts by updating the change request to include any changes that have been made to the same components (e.g. segment overrides) of that feature between the time that the change request was created and the time at which it is published, or scheduled to go live. Here are some scenarios to illustrate the behaviour: Scenario 1Initial state User A creates CR A with the following changes:
User B creates CR B with the following changes: User B publishes CR B Final state Scenario 2Initial state User A creates CR A with the following changes:
User B creates CR B with the following changes:
User B publishes CR B |
@kyle-ssg I’ve made a start on the API for this one. I’ve got a PR up here but, because it involves private code the Uffizzi preview won’t work. To spin up a local version to develop the FE against, you should be able to just do: export CR_PAT=<GH PAT with packages:read scope>
echo $CR_PAT | docker login ghcr.io -u <GH username> --password-stdin Then just update the docker-compose.yml file in the root of the repository to use the image at Currently, the API expects a very similar data structure to the one on the updated endpoint to create a version. I've added a new attribute to the {
"feature_states_to_update": "",
"feature_states_to_create": "",
"segment_ids_to_delete_overrides": ""
} The only difference is that (for the moment at least, I'm trying to improve this) the data is expected to be stringified json for each of these attributes. Here's an example payload (obtained from a working test I have in the API). {
"title": "Test CR",
"description": "",
"feature_states": [],
"environment_feature_versions": [],
"change_sets": [
{
"feature": 1,
"feature_states_to_update": "[{\"feature_segment\": null, \"enabled\": true, \"feature_state_value\": {\"type\": \"unicode\", \"string_value\": \"some_updated_value\"}}, {\"feature_segment\": {\"segment\": 1, \"priority\": 2}, \"enabled\": true, \"feature_state_value\": {\"type\": \"unicode\", \"string_value\": \"segment_override_updated_value\"}}]",
"feature_states_to_create": "[{\"feature_segment\": {\"segment\": 3, \"priority\": 1}, \"enabled\": true, \"feature_state_value\": {\"type\": \"int\", \"integer_value\": 42}}]",
"segment_ids_to_delete_overrides": "[2]"
}
]
} |
The way in which change requests work when versioning is enabled is such that a new version is created as a snapshot of the current state of a feature in a given environment when the change request is opened. This is illustrated in the following process:
Given Feature A, Segment X and Segment Y.
The expected behaviour here is that both segment overrides should exist after following this process. Currently, the behaviour however, is that the end result is that only the override for Segment Y applied in CR2 will exist after following these steps because the override for Segment X did not exist when CR2 was created.
The text was updated successfully, but these errors were encountered: