Skip to content

Batch Edit silently unlinking Tree relationships if rank not included in Data Set #8469

Description

@melton-jason

Describe the bug
Batch Edit can silently unlink tree records from relationships where a record is associated to a tree node at a higher rank than the highest rank included in the Query.

For example, consider a CollectionObject determined to a Taxon node at the Family level.
If the Query used to initiate the BatchEdit includes the aforementioned CollectionObject record and only included ranks ranks at a strictly lower than Family level (Genus, Species, Subspecies, etc.), then when the Batch Edit Data Set is committed then Specify will unlink the Taxon from the Determination with no indication to the user.

unlinking_issue.mov

While not shown in the above video, the CollectionObject with the Determination which was included in the ranks of the Query was not modified.

To Reproduce
Steps to reproduce the behavior:

  1. Add a Determination to one or more CollectionObject records and assign the Determination's Taxon to a rank higher than the lowest rank in the tree
  2. Create a Query that will return one or more of the CollectionObject records. In the Query, include at least one Taxon rank and ensure all Taxon ranks in the Query are strictly lower than the determined rank of the CollectionObject records
  3. Click on the "Batch Edit" button on the Query Results
  4. (Optional) Validate the Batch Edit Data Set and see that no changes are detected
  5. Commit the Batch Edit Data Set
  6. View the Determinations on the CollectionObject records and see that their Taxon and PreferredTaxon relationships have been unlinked

Expected behavior
Specify should probably do one or more of:

  • Notify the user that a change is being made to the record which is being unlinked
  • Include all tree ranks in the Batch Edit Data Set
  • Handle this case explicitly and make no changes to the record if no changes are made within the Data Set (which is likely the expected behavior)

Please fill out the following information manually:

  • OS: macOS Tahoe 26.3.1 (a)
  • Browser: Chrome 151.0.7922.174 (Official Build) (arm64)
  • Specify 7 Version: v7.12.0.7

Additional context
Discovered by investigation into #8434, so technically first reported by @urban011

The Taxon unlinking is still recorded by the Audit Log. Below is a query used to retrieve Audit Log information, as well as the Audit Log after the Batch Edit Commit shown in the above video.

SELECT log.SpAuditLogID, log.Action, log.ParentRecordId, log.ParentTableNum, log.RecordId, log.TableNum, field.FieldName, field.NewValue, field.OldValue, log.TimestampCreated FROM spauditlog log LEFT OUTER JOIN spauditlogfield field ON log.SpAuditLogID=field.SpAuditLogID ORDER BY spauditlogid DESC LIMIT 20;
+--------------+--------+----------------+----------------+----------+----------+------------------------+----------+--------------------------------------+---------------------+
| SpAuditLogID | Action | ParentRecordId | ParentTableNum | RecordId | TableNum | FieldName              | NewValue | OldValue                             | TimestampCreated    |
+--------------+--------+----------------+----------------+----------+----------+------------------------+----------+--------------------------------------+---------------------+
|       414781 |      1 |              4 |             23 |    69542 |        9 | taxon_id               | NULL     | 250                                  | 2026-08-28 09:19:20 |
|       414780 |      0 |            181 |            517 |     2894 |      518 | NULL                   | NULL     | NULL                                 | 2026-08-28 09:18:40 |
       ^^^
       The directly above row is part of the audit for the creation of the Batch Edit Query.
       The first row is the Audit for the Batch Edit operation

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions