-
Notifications
You must be signed in to change notification settings - Fork 36
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
Extend Record Merging to multiple records #3474
Conversation
Still working on creating more unit tests, but please go ahead and start testing with front-end integration. |
@melton-jason feel free to add more unit tests |
This pull request has been mentioned on Specify Community Forum. There might be relevant details there: https://discourse.specifysoftware.org/t/record-merging-in-specify-7/939/11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will need to take a more indepth look at this and add a unit test for when Agents have Group Person records.
For a quick thrice-over, everything looks good, but I do have some questions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After waiting for a few minutes, it seems that the merging process failed. It showed a red bar at the top of the dialog, but no error was reported to the user.
When opening the console, it seems there were some errors reported there.
Console Log:
kufish51623-agent-merging-extremos.test.specifysystems.org-16842.zip
I have also encountered an issue when Agents are associated with Specify Users. There is a backend business rule which prevents the deletion of agents when associated with specify users. specify7/specifyweb/businessrules/agent_rules.py Lines 5 to 16 in 6f103c4
This branch tries to delete the old records (lines 512-514 in specifyweb/views.py), which is what caused an issue for me when testing internally: # Dedupe by deleting the record that is being replaced and updating the old model ID to the new one
for old_model_id in old_model_ids:
target_model.objects.get(id=old_model_id).delete() @grantfitzsimmons |
@melton-jason
|
Yes that would be a nice way of going about this particular case. We will need to think of ways to generalize cases such as these (if broad generalization can exist to cover all backend deletion Business Rules).
|
I'm afraid you misunderstood my comment. Indeed, you can't assign the same agent to multiple users. |
@melton-jason the simplest solution for this issue: |
eb0b153
to
ed4be7b
Compare
agent_merge_user.mp4Unfortunately, this is not a complete fix. |
However, this falls under the third |
I don't think this is very likely |
It is not very likely at all |
This is still concerning, and I have been unable to identify the cause of the issue thus far. Perhaps the most concerning and perplexing symptom of this issue is how little it gives in terms of information to debug the problem. The only information that can be gleaned directly from the issue is the 405 (Method Not Allowed) response. @maxpatiiuk |
Code looks ok. This could be caused by test panel restarting. That would explain the 421 error |
#3474 (comment) - I really don't like how the error message is formatted in the video If I remember correctly, this is only happening when in development. And we still don't know why that's happening? |
In my free time in the past two days I have been looking into why this formatting is happening (#3343). I will update the issue shortly with what I have found in the interim. |
You have a ton of other important things! |
Yes, I first thought it might be an issue with the test panel restarting. However, I have attempted to perform that exact merge multiple times, and every time encountered the same behavior. I have successfully merged a variety of Agents both locally and through the same There is a lot that could go wrong, and we don't have a lot to go off of. |
I have identified a case on a local copy of Here is a video showing two agents that I tried to merge which showed the aforementioned behavior. agent_merging_error.mp4Assuming the error was likely due to the references, I investigated the 13 Collecting Events which reference Then I attempted the merge again, and it worked! 🥳 agents_merged.mp4Our phantom issue is what appears to be an Integrity Error. In the context of #3474 (review), there must be cases where some records reference both I will need to investigate how the endpoint works currently, and I can work on a fix. |
@maxpatiiuk |
yes please, let's do that |
Ok. I'd say we can merge this back to |
Let's go ahead now and merge this with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Two small refactoring things - can be resolved after merging this
@melton-jason I don't think back-end is at fault here. It's front-end's fault for not handling the error correctly. There is code that tries to figure out if the error was generated by a permission system (thus display the permission error dialog) or by session time out (thus, prompt the user to sign in instead). It's concerning that this error didn't trigger either error dialog. Relevant code: specify7/specifyweb/frontend/js_src/lib/components/Errors/FormatError.tsx Lines 153 to 177 in bd2ba16
Can you please take a look at what's going on there? |
Extend Record Merging to multiple records to allow for the handling of businesses rules and keeping the whole merging process inside of one ACID transaction.