Bring changes from v7.11.4 to main#7683
Conversation
… when building a case statement for the QB.
emenslin
left a comment
There was a problem hiding this comment.
- Save the Data Entry record and ensure the record saves successfully
- Reload the page and ensure Specify loads and still remains accessible
- Save the Data Entry record and ensure the record saves successfully
- Ensure that the value for the autonumbered field from Data Entry is skipped in the WorkBench upload results.
- Save the Data Entry record and ensure the record saves successfully
- Ensure that the value for the autonumbered field from Data Entry is skipped in the WorkBench upload results.
- Save the Accession and ensure the record saves successfully
- Ensure that the Accessions in different Divisions are independently auto-numbered (e.g., Accessions in different Divisions should not share the same autonumbering)
- Save the Accession and ensure the record saves successfully
- Ensure that the value for the autonumbered field from Data Entry is skipped in the WorkBench upload results in the other Division
- Generally ensure that autonumbering respects the scoping of Accessions (e.g, using DataEntry, create Accessions in different scopes and ensure they're autonumbered as expected)
Looks good! I did run into some migration problems, but since that could be a test panel issue I will approve this, but it is something that should probably be looked into.
bhumikaguptaa
left a comment
There was a problem hiding this comment.
- Save the Data Entry record and ensure the record saves successfully
- Reload the page and ensure Specify loads and still remains accessible
- Save the Data Entry record and ensure the record saves successfully
- Ensure that the value for the autonumbered field from Data Entry is skipped in the WorkBench upload results.
- Save the Data Entry record and ensure the record saves successfully
- Ensure that the value for the autonumbered field from Data Entry is skipped in the WorkBench upload results.
- Save the Accession and ensure the record saves successfully
- Ensure that the Accessions in different Divisions are independently auto-numbered (e.g., Accessions in different Divisions should not share the same autonumbering)
- Save the Accession and ensure the record saves successfully
- Ensure that the value for the autonumbered field from Data Entry is skipped in the WorkBench upload results in the other Division
- Generally ensure that autonumbering respects the scoping of Accessions (e.g, using DataEntry, create Accessions in different scopes and ensure they're autonumbered as expected)
Everything worked as expected! I also came across a few migration errors while testing for the accession auto-numbering.
There was a problem hiding this comment.
- Save the Data Entry record and ensure the record saves successfully
- Reload the page and ensure Specify loads and still remains accessible
- Save the Data Entry record and ensure the record saves successfully
- Ensure that the value for the autonumbered field from Data Entry is skipped in the WorkBench upload results.
- Save the Data Entry record and ensure the record saves successfully
- Ensure that the value for the autonumbered field from Data Entry is skipped in the WorkBench upload results.
- Save the Accession and ensure the record saves successfully
- Ensure that the Accessions in different Divisions are independently auto-numbered (e.g., Accessions in different Divisions should not share the same autonumbering)
- Save the Accession and ensure the record saves successfully
- Ensure that the value for the autonumbered field from Data Entry is skipped in the WorkBench upload results in the other Division
- Generally ensure that autonumbering respects the scoping of Accessions (e.g, using DataEntry, create Accessions in different scopes and ensure they're autonumbered as expected)
I have tested the indecent division and found out that the independent autonomy based on divisions is not consistent
Screen.Recording.2026-02-10.at.4.46.47.PM.mov
this is a fresh version of the db and also there has been a weird crash in which it considered an already existing accession number as already existing even though they were from different divisions
trimmed.error.mov
here is the crash report if it give any insigne to the room of this problem
Edit: I have found out that this is happening after you attempt to autonumber into the test div twice in a row
See related (and first) #7683
|
Thank you all for the reviews! There some very subtle behavior going on behind the scenes to cause that behavior in your review @Iwantexpresso! Ultimately, what's happening is tied to the fact that you can really only be logged into one collection as one user at a time for Specify across all tabs. That is, the Collection and User you are logged in as is shared across all tabs of Specify for that instance. v7.11.4-prerelease_switch_collection.movSo when you switch collections in one tab and navigate back to an older tab that is in some other collection, Specify will treat requests as having come from the collection of the prior (newer) tab. Behind the scenes, Specify "globally" (with the perspective of the browser) manages which collection the user is signed in to via a Cookie, which is tab independent. (This Cookie is set whenever the user explicitly chooses a Collection to login to. There's a backend helper function called You can actually see which Collection you are "logged in to" by using your browser's developer tools. In the below demonstration of the bug, I inspect the Cookies present on the request made to the backend. Even though I appear to be in two separate Collections, because I last logged in to the Fish Collection (CollectionID = 32769) all request made from that point will also be made from the Fish Collection: v7.11.4-prerelease_bts.movFor more information, you can view the browsers docs on how to use their Developer Tools to inspect Cookies: The general "expected" behavior is to explicitly switch Collections whenever you are dealing with more than one Collection: v7.11.4-prerelease_expected.movThere are probably a lot of nasty bugs that could arise if you expect to be logged into more than one Collection at a time for a Specify instance... I will note, however, that this specific bug does not happen on main: v7.11.4-prerelease_main.movThe main difference between this branch and @specify/ux-testing
I can try and modify the Autonumbering code to first prioritize the scoping of the record being saved (i.e., use the field values of the record being saved) rather than the Collection the user is logged into (and fallback to the latter if the former can not be easily determined), though this may result in other subtle bugs because "easy to determine" is itself pretty difficult to determine 😅. How often do you think this will happen in practice (a production instance)? |
With all those points in mind I would imagine it is very unlikely for a user to run into this, and if fixing this one issue would likely cause other bugs I think it is probably not worth it to fix it, at least right now. I'd like to hear other opinions, especially @grantfitzsimmons, but personally I would think it's unlikely enough that it's not worth fixing. |
|
I agree with @emenslin, this is an edge case that is likely not to be encountered in production. |
|
I would generally agree it is probably not likely to happen, but maybe that is just a result of being set in the Specify Way of Things. We might be introducing much more prevalent bugs if this edge case is explicitly fixed. I could decrease the threshold in which Specify will forget the highest autonumbering value in the same Scope relative to the Collection they're logged into (e.g., less than 5 seconds) to help mitigate this Issue, but it still has to be sufficiently long enough for instances (generally regardless of performance) to handle the genuine case of concurrent autonumbering with the WorkBench and Data Entry. At the moment it seems like general sentiment is that the edge case is not going to be addressed, at least in the |
yeah this totally makes sense. at first I did not fully process how uncommon it might actually be, but realistically speaking, The Pr itself still addresses its main purpose. I probably should've made it a comment than requesting changes, my apologies! still thank you for taking your time Explaining it in such detail it helps a lot! |
Brings the changes from #7671 /
v7.11.4tomain.Checklist
self-explanatory (or properly documented)
Testing instructions
Follow the testing instructions from Prevent broken transactions when autonumbering (#7671) (provided below) and ensure the functionality is correct with the updated branch:
Sample Database
To speed up setup for testing this Pull Request, i've set up a testing database that contains all resources required for testing:
Feel free to use the database!
Where Accessions are scoped to Division:
issue-6490_scoped_accession_testing.sql.zip
Where Accessions are globally scoped:
issue-6490_global_accession_testing.sql.zip
General Concurrency with WorkBench
Concurrent Autonumbering with the WorkBench
Concurrent Autonumbering with Non Collection Scoping
Review Table Scoping Hiearchy for an overview on table scopes
With the Sample Database, this would be using the Locality Data Set in the Plants Collection with creating a new Locality in the Vascular Plants Collection
Autonumbering with Variable Table Scoping
In a database with more than one Division where Accessions are scoped to Division
In a database with more than one Division where Accessions are globally scoped
Start a WorkBench Upload operation on a sufficiently large Accession Data Set (the operation needs to be in process while some of the below steps of Concurrent Autonumbering with Non Collection Scoping are completed) where a field on Accession is being autonumbered
Open Specify in a new tab, window, or browser
Switch to a different Collection which is in a different Division as the records being uploaded
Open an Accession DataEntry form
Save the Accession and ensure the record saves successfully
Wait for the WorkBench Upload operation to complete
Ensure that the value for the autonumbered field from Data Entry is skipped in the WorkBench upload results in the other Division
Generally ensure that autonumbering respects the scoping of Accessions (e.g, using DataEntry, create Accessions in different scopes and ensure they're autonumbered as expected)
General