Prevent conflicting tags being added in new Validate #3652
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #3635
Fixes a bug where conflicting tags (like "no alternate route" and "alternate route present") could both be added to a label through the new Validate page. Some more specifics:
mutually_exclusive_with
column to thetag
table, so that these mutual exclusivity relationships are recorded in the db. This helps us deal with the more programmatically, and I'm hoping that it makes it easier to remember to address them when this comes up again.label
orlabel_history
table. If we fail to prevent this issue on the front-end, we'll now log a warning on the back-end and remove both of the mutually exclusive tags before inserting/updating. This way we'll never have conflicting tags in the db, even if we mess up on the front-end.UNIQUE(label_type_id, tag)
constraint to thetag
table. This wasn't an issue, but it's technically a constraint we had, so figured it was worth updating the db since I was already fixing up this table. Doesn't impact anything right now.Things to check before submitting the PR