Fix CollectionObject business rule crash on missing CollectionObjectType#7905
Open
acwhite211 wants to merge 4 commits intomainfrom
Open
Fix CollectionObject business rule crash on missing CollectionObjectType#7905acwhite211 wants to merge 4 commits intomainfrom
acwhite211 wants to merge 4 commits intomainfrom
Conversation
bhumikaguptaa
requested changes
Apr 8, 2026
Collaborator
bhumikaguptaa
left a comment
There was a problem hiding this comment.
- Verify the save completes normally instead of hanging on the
"Loading..."dialog. - Verify the page remains usable after save and no infinite loading state appears.
- Refresh or reopen the record and confirm the new determination was actually saved.
- Run the same CO QB query to make sure that the COT is not null anymore.
Everything looks good, except when i refresh the page and rerun the query, the COT is still null.
Db:https://kuentoissue7870-issue-7870.test.specifysystems.org/specify/query/new/collectionobject/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 #7870
Saving a
CollectionObjectwith a missingcollectionObjectTypecould trigger a front-end business rule crash and leave the record stuck on the"Loading..."dialog instead of completing the save. This affected older records, including records created in Specify 6, whereCollectionObjectTypeIDmay still benull.Added a null guard in the
CollectionObjectcollectionObjectTypebusiness rule and skip determination taxon tree validation when no collection object type is set. Clear any existing determination taxon save blockers whencollectionObjectTypeis missing. Also added unit tests for saving whencollectionObjectTypeisnulland clearing invalid determination blockers whencollectionObjectTypebecomesnullOn the back-end, I decided to go ahead and opportunistically normalize legacy null
collectionObjectTypevalues when an existingCollectionObjectis saved in Specify 7. If the collection already has a default Collection Object Type, that value is applied on save. If both the record and the collection default are null, Specify creates or reuses the collection’s discipline-based default type, assigns it to the collection, and uses it for the saved record. I'm ok with reverting this section if anyone thinks we should leave them as null.Checklist
self-explanatory (or properly documented)
Testing instructions
CollectionObjectwith no Collection Object Type set (CollectionObjectTypeID = null). Older Specify 6-created records are the main target.Data Entry, open one of those records and confirm the Collection Object Type field is blank.Determinationto the record.Save."Loading..."dialog.