-
-
Notifications
You must be signed in to change notification settings - Fork 718
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
Fix variant data inconsistencies #6369
Fix variant data inconsistencies #6369
Conversation
…nt_unit is changed Fixes an issue where a product's variant_unit value is changed from "weight" to "items" and some of the product's variants can be left in an invalid state, which in turn breaks cloning of order cycles (with fatal errors).
1b86b08
to
49a2dd6
Compare
I updated the specs and the build is now green; it would be really nice to fix this! It might fix the root cause of #6527 as well. We'll want to have a good think about it to make sure that we're okay changing those tests and that we're not just playing whackamole and going to see another bug pop up because of these changes. I think @sauloperez would be a good person to review since it looks like he wrote some of the original specs. Sorry about all the force pushing/squashing @Matt-Yorkley |
Github won't let me approve this PR as I authored the first bit, but I think we should move this along, we're getting too many errors coming up due to these data inconsistencies and it keeps eating dev time. |
I'm guessing @andrewpbrett approves, so I'll move this to |
@Matt-Yorkley Your guess was correct, I think I hadn't explicitly approved since it felt like I was partially the author... or maybe I just forgot. In any case, Test Ready! 👍 |
Hey @Matt-Yorkley , This is quite tricky, this one. I had a look at the related bugs namely the steps to reproduce on #6368 and your advice on what should we test. I tried this:
But somehow managed to clone the OC with no issues. I was only able to reproduce it by following that procedure but starting off as an "Items" product, following these steps.
i) inserting a string, will now allow to change the product from Item to Weight -> which is issue #5234; This prevents the fail cascade. So we need a integer, to continue break the OC cloning, so ii) inserting a number on the
iii) Changing the product to "Weight" -> At this point, attempting to change from "Items" to "Weight" on the iv) After this, we should have a integer on the "Items" variant and a string on the "weight" variant... Adding these variants to the OC, trying to clone the OC -> Error 422 -> which is issue #4216 Also worth mentioning: vi) Some inconsistencies around the product edit page, on the dropdown selector. An "Items" product displays this unit on the dropdown, but a "Weight" unit does not - see pic below: All this is the current behaviour. I'll stage your PR and see how it is addressed 👍 |
Ok, after staging this PR I noticed, that:
If one chooses "Weight", fills everything but This would be expected for items as well, right? Or are we making it not mandatory on purpose? In that case, should we remove the
and bugsnag is triggered: This means, the app behaves differently in the pages This is the culprit variant: As to the PR, it seems to bring improvement, as I was not able to create corrupt variants, and reproduce the three underlying issues above. But it looks like we might be dealing with this, for all previously created variants, in which this change is attempted. So, I I'm not sure it definitively closes #6527... This and related issues might need further dev/testing but I feel this probably needs to move on. I'd prefer to have some feedback before merging. What do you think about all this @Matt-Yorkley ? |
YAY! 🎉 🕺 🥳
We've been manually fixing them as we go, which has been crazy. If we spot any others we can fix them manually as well (it's not always a simple case, so we probably can't handle it with a migration), but the big win here is that we won't be creating new ones. |
Thanks for feedback! |
What? Why?
Closes #4216
Closes #6368
Closes #5234
Fixes recurring data inconsistency issue #4216 where a product's variant_unit value is changed from "weight" to "items" and some of the product's variants can be left in an invalid state, which in turn breaks cloning of order cycles (with fatal errors).
The fix in these cases is to find variants in the OC that have a product with
variant_unit: "weight"
and where the variant'sunit_value
isnil
, and manually change them in the DB or the console fromnil
to1
. 🙈What should we test?
Release notes
Fixed a variant weight/items issue leading to OCs that cannot be cloned
Changelog Category: Technical changes