Skip to content
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 Taxon taxonomy id validation regression #5189

Merged

Conversation

RyanofWoods
Copy link
Contributor

@RyanofWoods RyanofWoods commented Jun 28, 2023

Summary

Fixes #5187.

In v3.4 I added optional Taxon validations which become mandatory in v4.0. This caused a regression which made all root taxons with children always invalid. This is a fix for v4, another PR for v3.4 was made:
#5190


This optional validation for root taxons (parent_id is nil), was
checking for uniqueness of taxonomy_id among all Taxons. This is wrong
however, as the children Taxons of this root Taxon will point to the
same Taxonomy. Instead, we should only look among other root Taxons.

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

@github-actions github-actions bot added the changelog:solidus_core Changes to the solidus_core gem label Jun 28, 2023
@RyanofWoods RyanofWoods changed the title Fix taxon taxonomy id validation [v4.0] Fix Taxon taxonomy id validation regression Jun 28, 2023
@RyanofWoods RyanofWoods marked this pull request as ready for review June 28, 2023 08:44
@RyanofWoods RyanofWoods requested a review from a team as a code owner June 28, 2023 08:44
@kennyadsl kennyadsl added the type:bug Error, flaw or fault label Jun 28, 2023
This optional validation for root taxons (parent_id is nil), was
checking for uniqueness of taxonomy_id among all Taxons. This is wrong
however, as the children Taxons of this root Taxon will point to the
same Taxonomy. Instead, we should only look among other root Taxons.
@RyanofWoods RyanofWoods force-pushed the ryanofwoods/fix-taxon-taxonomy_id-validation branch from f99a549 to b574c21 Compare June 28, 2023 09:25
@kennyadsl kennyadsl added the backport-v4.0 Backport this pull-request to v4.0 label Jun 28, 2023
@kennyadsl kennyadsl changed the title [v4.0] Fix Taxon taxonomy id validation regression Fix Taxon taxonomy id validation regression Jun 28, 2023
@kennyadsl kennyadsl merged commit 8206c05 into solidusio:main Jun 29, 2023
@kennyadsl kennyadsl deleted the ryanofwoods/fix-taxon-taxonomy_id-validation branch June 29, 2023 08:24
@github-actions
Copy link

💚 All backports created successfully

Status Branch Result
v4.0

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v4.0 Backport this pull-request to v4.0 changelog:solidus_core Changes to the solidus_core gem type:bug Error, flaw or fault
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Root taxons with at least a child are not valid
4 participants