sul-dlss / happy-heron

Self-Deposit for the Stanford Digital Repository (SDR): H2 is a Rails web application enabling users to deposit scholarly content into SDR
Apache License 2.0
10 stars 2 forks source link

Reserve a PURL function results in errors #1191

Closed amyehodge closed 3 years ago

amyehodge commented 3 years ago

When trying to reserve a PURL on an H2-created collection, I entered a title and clicked Submit, and it loaded the work edit page (which I don’t understand) and reported this error:

Screen Shot 2021-02-24 at 2.20.17 PM.png

Then when I tried to reserve a PURL on a migrated collection, it didn't open the form (this seems right) and appeared to reload the dashboard, but I didn’t see the reserved item listed in the collection. And I appeared to have triggered this in HB:

line 53 of [PROJECT_ROOT]/app/forms/draft_work_form.rb: deserialize_embargo line 41 of [PROJECT_ROOT]/app/forms/draft_work_form.rb: deserialize! line 35 of [PROJECT_ROOT]/app/controllers/works_controller.rb: create

https://app.honeybadger.io/projects/77112/faults/76941540

jmartin-sul commented 3 years ago

In trying to reproduce this error, I ran into something different: the deposit failed (because an invalid cocina model was generated, per @jcoyne on slack as well as me in this comment on the original PR). Then, because no state transitions existed that allowed update_metadata before deposit was complete (which would get the WorkVersion to purl_reserved), I was unable to select a type for my wedged PURL reservation (I could get the modal, but I'd get bounced back to the dashboard when selecting a type, and my selection wouldn't apply).

i have a WIP PR to address the issue i encountered: #1202

amyehodge commented 3 years ago

@jmartin-sul I just tested this again and I am not seeing that error. Hooray!

However, is there any way to keep the page from returning all the way to the top when it reloads? When there is a lot on the page it's hard to find where it was I made the PURL. But this is minor and not something a lot of time should be spent on. Just thought I'd ask.

amyehodge commented 3 years ago

The second one I reserved seems not to be updating with the actual PURL even after a couple of minutes and a manual page refresh:

Screen Shot 2021-02-25 at 4 44 31 PM

jmartin-sul commented 3 years ago

The second one I reserved seems not to be updating with the actual PURL even after a couple of minutes and a manual page refresh:

@amyehodge it looks like I (initially) forgot to restart the sneakers based workers when i deployed my test branch.

I restarted them, and my test objects from before the restart did not correctly get put into the purl reserved state (because the worker didn't pick up the old job and fire the deposit complete event on them). But the test object i created after restarting the workers did seem to successfully have the deposit complete event fired on it, and it did end up automatically getting marked as "PURL Reserved". I was then able to click the pencil icon, select a type, and edit metadata. I was also able to go to the PURL for that last test object (the PURL didn't work for the first two, from before the restart, but those druids were available in Argo).

Would you mind trying a PURL reservation again when you get a chance? And selecting a type and editing metadata? Thanks!

jmartin-sul commented 3 years ago

@jmartin-sul I just tested this again and I am not seeing that error. Hooray!

However, is there any way to keep the page from returning all the way to the top when it reloads? When there is a lot on the page it's hard to find where it was I made the PURL. But this is minor and not something a lot of time should be spent on. Just thought I'd ask.

Hmm, definitely possible, but it'd require re-working the form submission to be more AJAX-y, and off-hand, I'm not sure exactly how I'd approach it. Would you mind filing a ticket?

jmartin-sul commented 3 years ago

@amyehodge i may have spoken too soon -- one of my PURL reservation tests worked completely automatically with no manual intervention. but the two i tried after that have not had the deposit_complete event fired on them automatically, and so they're stuck in the "Reserving PURL" (reserving_purl) state. i'm not sure if this is an issue with me not re-starting the sneakers workers properly, or something else. when i refreshed the page manually in those cases, i did at least see a PURL.

this does still seem like an improvement over what's currently on main.

jmartin-sul commented 3 years ago

1236 should prevent the state transition error i saw