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

bad tree structure error when moving Genus to a different Family #2704

Closed
grantfitzsimmons opened this issue Dec 22, 2022 · 11 comments
Closed
Assignees
Labels
1 - Bug Incorrect behavior of the product

Comments

@grantfitzsimmons
Copy link
Member

grantfitzsimmons commented Dec 22, 2022

To recreate, attempt the following move:

The Taxon node "Arceuthobium" will be placed, along with all of its descendants, under the new parent "Loganiaceae".

Move Arceuthobium to the Loganiaceae Family.

https://aafcaacdao-edge.test.specifysystems.org/specify/tree/taxon/?conformation=%7E%7E1%7E181107%7E160131%7E160170--%7E159752----

Error occurred fetching from https://aafcaacdao-edge.test.specifysystems.org/api/specify_tree/taxon/160170/move/

Invalid response code 500. Expected 200.

This error may indicate a misconfiguration or a bug in Specify. Please double check your configuration and report this issue.
AssertionError at /api/specify_tree/taxon/160170/move/
bad tree structure

Request URL: http://aafcaacdao-edge.test.specifysystems.org/api/specify_tree/taxon/160170/move/

Reported By: HeatherC at the Community Forum

https://discourse.specifysoftware.org/t/error-in-s7-tree-moves/949/2

@grantfitzsimmons grantfitzsimmons added 1 - Bug Incorrect behavior of the product pri:unknown labels Dec 22, 2022
@grantfitzsimmons
Copy link
Member Author

@specifysoftware
Copy link

This issue has been mentioned on Specify Community Forum. There might be relevant details there:

https://discourse.specifysoftware.org/t/error-in-s7-tree-moves/949/5

@grantfitzsimmons
Copy link
Member Author

Similar to #2707

Might have the same underlying issue

@melton-jason
Copy link
Contributor

melton-jason commented Dec 26, 2022

For this case, it looks like the tree is misconfigured. There is a tree node Cornus canadensis f. dutillyi (taxonid: 18574) which has a child which is the same rank as itself.
The child is Cornus canadensis f. viride (taxonid: 186086)

SQL Command:

select t.taxonid, p.taxonid, t.fullname, p.fullname, t.parentid, p.parentid, t.rankid, p.rankid from taxon t join taxon p on t.parentid=p.taxonid where t.rankid <= p.rankid;

Result:

+---------+---------+-----------------------------+-------------------------------+----------+----------+--------+--------+
| taxonid | taxonid | fullname                    | fullname                      | parentid | parentid | rankid | rankid |
+---------+---------+-----------------------------+-------------------------------+----------+----------+--------+--------+
|  186086 |   18574 | Cornus canadensis f. viride | Cornus canadensis f. dutillyi |    18574 |    18572 |    260 |    260 |
+---------+---------+-----------------------------+-------------------------------+----------+----------+--------+--------+

The problem taxa in specify 7 and its child:

taxon_specify

https://aafcaacdao-edge.test.specifysystems.org/specify/tree/taxon/?conformation=%7E%7E1%7E181107%7E159752-%7E160131-%7E18522%7E18540%7E18572------

@grantfitzsimmons
Copy link
Member Author

@melton-jason Specify 6 doesn’t throw an error when doing this action

@melton-jason
Copy link
Contributor

I believe this is because the error is only thrown when validating node numbers in Specify 7. I don't believe the problem taxa are involved in any way with the two nodes being moved, so Specify 6 probably doesn't care about it.
Specify 7 checks the entire tree, hence the error.

@melton-jason
Copy link
Contributor

What happens to Cornus canadensis f. viride after the move in 6? I would assume it would remain unchanged (as a child to Cornus canadensis f. dutillyi both with the rank of forma)

@specifysoftware
Copy link

This issue has been mentioned on Specify Community Forum. There might be relevant details there:

https://discourse.specifysoftware.org/t/error-in-s7-tree-moves/949/7

@melton-jason
Copy link
Contributor

This has since been resolved by Heather C in the Speciforum at (https://discourse.specifysoftware.org/t/error-in-s7-tree-moves/949/8).

The only thing to potentially consider is how we want to handle tree checks like this one. Users may have a hard time solving an error like this because any tree action may result in Specify throwing the error once again (as shown in Heather's post).
If this is brought into consideration, it is probably more appropriate to open a new issue, so I am closing this one.

@maxpatiiuk
Copy link
Member

@melton-jason could you improve the "bad tree structure" error to tell exactly which node is causing the problem?

That would serve well in the future

@melton-jason
Copy link
Contributor

Yes, I have gone through and improved the messages for a few Assertion Errors in the backend in #2702, this one included. Very shortly I will push a commit that addresses this one in more depth, and the error message will display a list of all nodes (containing their taxonid and fullname) which caused this error.

melton-jason added a commit that referenced this issue Jan 10, 2023
Additionally, provide more data to allow users to diagnose
'bad tree structure' errors so issues like #2704 and #2707
have more context and don't have to run SQL commands to find
the bad nodes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - Bug Incorrect behavior of the product
Projects
None yet
Development

No branches or pull requests

4 participants