Skip to content
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

NoMethodError errors for <GenericWork> when adding work to two collections of same single membership type (nurax-pg) #5594

Closed
elrayle opened this issue Apr 4, 2022 · 26 comments · Fixed by #5861 or #6089
Assignees
Labels
Collection impacts the Collection part of PCDM Model priority valkyrization workflow

Comments

@elrayle
Copy link
Contributor

elrayle commented Apr 4, 2022

Descriptive summary

Adding a work to two collections of the same single membership type raises NoMethodError - undefined method 'errors' for <GenericWork>

Expected behavior

When attempting to add a work to a second collection of the same single membership type, after clicking Save, should stay in the editor and see flash message explaining why this is not allowed.

Actual behavior

When attempting to add a work to a second collection of the same single membership type, after clicking Save, it attempts to stay in the editor but raises an exception...

image

Steps to reproduce the behavior

On nurax-pg...

Prerequisite:

  1. Create a collection type that is single membership
  2. Create two collections of that type

To Reproduce:

  1. Dashboard -> Works -> Add new work -> select any work type
  2. Fill in required metadata
  3. Select tab: Relationships
  4. In Add to collection selection, type name of first single membership collection and click button: Add
  5. In Add to collection selection, type name of second single membership collection and click button: Add
  6. Click button: Save changes

See exception shown in Actual behavior.

Related work

Issue #5582

@gamontoya
Copy link

This appears to be working on Koppie. I'm not sure if seeing two errors reported to the user is expected behavior, however.

singleMem2

@blancoj
Copy link
Contributor

blancoj commented Sep 16, 2022

@gamontoya The issue you were seeing on Koppie, I also saw and @cjcolvar helped me resolve it. It is happening because you need the latest version of rails running on Koppie. This is how you get the latest rails installed on Koppie:

docker exec -it koppie-app-1 /bin/sh
bundle update rails

The double error, is what I also saw. I think this is expected behavior, but it would be good to get someone else to confirm that.

@gamontoya
Copy link

@blancoj I'll update and try again on koppie, thank you.

@jlhardes This is a fail on nurax-pg:

single

@gamontoya
Copy link

gamontoya commented Sep 16, 2022

@blancoj I'm seeing the same double error banner even after updating rails on koppie (Rails 7.0.4)

@jlhardes This passes on koppie.

singlemem

@jlhardes
Copy link
Contributor

Verified that this is still producing the same error message on nurax-pg. It is also still working but still showing 2 flash error messages on koppie. Reopening and moving to In Progress column on project board for follow-up.

@jlhardes jlhardes reopened this Jan 25, 2023
@alishaevn
Copy link
Contributor

instructions on how to create a "single membership" collection can be found on hyrax#4011 under the "Steps to reproduce the behavior" heading in the initial comment.

@alishaevn alishaevn self-assigned this May 30, 2023
@alishaevn
Copy link
Contributor

@dlpierce which error message do we want to remove?

the error message above the form is created by #after_update_error and rendered by _flash_msg.html.erb.

the error message within the form is created by #full_collections_errors and rendered by _form.html.erb

hyrax koppie
image image

@dlpierce
Copy link
Contributor

I'm inclined to keep the one rendered by _flash_msg.html.erb, but having it be blank is not ideal.

@alishaevn
Copy link
Contributor

I'm inclined to keep the one rendered by _flash_msg.html.erb, but having it be blank is not ideal.

@dlpierce agreed. idk why the messages are different between the two, but would you like me to move forward with removing the error message within the form? while I'm at it, should I also remove the entire errors block from the form since the flash msg also handles errors on this page?

alishaevn added a commit that referenced this issue Jun 5, 2023
before this commit, the flash message would show an error above the form AND there would be another error messa
ge that showed within the form. these messages would be for the same reason. instead, this commit shows unique error m
essages above the form only.

ref: #5594

co-authored-by: rob <[email protected]>
@alishaevn alishaevn linked a pull request Jun 12, 2023 that will close this issue
2 tasks
@gamontoya
Copy link

gamontoya commented Jun 12, 2023

@alishaevn

This is the behavior I'm seeing on nurax-pg Hyrax Version: 4.0.0

pgNurax1

@gamontoya
Copy link

@alishaevn And this is the behavior on Koppie v4.0.0

koppie

@alishaevn
Copy link
Contributor

@gamontoya can you check nurax again? the commit sha listed next to the hyrax revision in the footer is the one for the pr related to this work. looks like it was updated yesterday, but I'm unsure if it was before or after you tested. I don't have a login to check for myself either.

if it doesn't work for you on nurax, can you try locally?

local hyrax image
nurax commit sha image

@gamontoya
Copy link

@alishaevn Yes, I'm on it!

@gamontoya
Copy link

gamontoya commented Jun 13, 2023

@alishaevn This is the latest version of https://pg.nurax.samvera.org/

pg-nurax

FWIW: I'm getting the same results as yesterday.

  • Works on Koppie
  • Does not work on pg-nurax

@gamontoya
Copy link

My local environment is upated:
* main 014fe61dc [origin/main] Merge pull request #6090 from samvera/5575-item-actions-edit

Same behavior for Koppie (it works), unlike pg-nurax

@alishaevn
Copy link
Contributor

@gamontoya did your local version of hyrax work? I don't have a login for the pg nurax site so I can't do any debugging there.

@alishaevn
Copy link
Contributor

@alishaevn
Copy link
Contributor

I created a login for pg nurax and tested this. I got the same problem. from the screenshot above, and my testing, it appears that the works created on pg nurax are considered to be valkyrie works instead of active fedora ones. when I test the hyrax app locally, the works are active fedora backed. I'm unsure why the mixup is happening on nurax.

@dlpierce any ideas what's causing this inconsistency?

# error from pg
...
hyrax (014fe61dcb0a) app/controllers/concerns/hyrax/works_controller_behavior.rb:203:in `update_valkyrie_work'
hyrax (014fe61dcb0a) app/controllers/concerns/hyrax/works_controller_behavior.rb:104:in `update' 
...


____________________________

# code the above error is referencing
def update
  case curation_concern
  when ActiveFedora::Base
    # this code gets run locally for hyrax
    actor.update(actor_environment) ? after_update_response : after_update_error(curation_concern.errors)
  else
    # this code gets run in pg for hyrax
    update_valkyrie_work
  end
end

@alishaevn
Copy link
Contributor

as info, I created two collections as "single membership" on https://dev.nurax.samvera.org and it didn't error at all. I'm not an admin, so I can't see how the collection type is truly configured. I was just going by the name. feels like it is not configured correctly though.

@gamontoya
Copy link

@alishaevn Hi again!

Here's the results from 4 different environments.

dev-nurax (works)

  • QA Testing for Hyrax
  • Hyrax Version: 4.0.0
  • Hyrax Branch: refs/heads/main
  • Hyrax Revision: 8aa6379a690945148dbb44e518a0037d370a35e1

dev-nurax

pg-nurax (fails)

  • QA Testing for Hyrax
  • Hyrax Version: 4.0.0
  • Hyrax Branch: refs/heads/main
  • Hyrax Revision: 014fe61dcb0a92f83bbe0b1b2c0828147ec4b4f8

pg-nurax

Local Hyrax (works)

hyrax4 0

Local Koppie (works)

koppie4 0

@alishaevn
Copy link
Contributor

I went to the hyrax working group standup and mentioned the above issue. pg.nurax.samvera.org IS equivalent to local koppie, while dev.nurax.samvera.org is equivalent to dassie.

either way, since the code is working locally for both gabriela and I, daniel wondered if it could be something up with the nurax pg branch that deploys to pg.nurax? maybe a gem is out of date or something?

potentially unrelated, but at this moment, the pg branch is 171 commits ahead and 442 commits behind the main branch. daniel mentioned that there doesn't appear to be any attempt to keep them in line.

@alishaevn
Copy link
Contributor

tldr: I paired with @orangewolf to get the pg app running locally and I can now duplicate the issue in the nurax app. ActiveModel::DeprecationHandlingMessageArray is not defined in the pg app, for some reason, while it is in hyrax.

local koppie

image

local nurax

image

@alishaevn
Copy link
Contributor

ActiveModel::DeprecationHandlingMessageArray is not available in rails v6.0.6, which is the version that the nurax pg branch has in its gemfile.lock. the class IS available in rails v6.1.0, which is what the koppie app is using. (koppie is on v6.1.7.3 to be exact)

I changed the gemfile on the nurax pg branch to gem 'rails', '~> 6.0' (what's in koppie) and gem 'rails', '~> 6.1', and ran bundle update rails --conservative. both times I got a "Bundler attempted to update rails but its version stayed the same" message.
I even deleted the gemfile.lock file completely and ran bundle. it says "Bundle complete! 47 Gemfile dependencies, 326 gems now installed.", but the gemfile.lock file is still deleted in my source control, so it doesn't appear to have actually done anything.

@alishaevn
Copy link
Contributor

started a thread in the samvera nurax channel about the above issue.

alishaevn referenced this issue in samvera-labs/nurax Jun 23, 2023
…ationHandlingMessageArray

before the rails upgrade we would get an "uninitialized constant" error on the above class when running the koppie code on pg nurax staging. this upgrade was needed to get around that.

ref: https://github.com/samvera/hyrax/issues/5594\#issuecomment-1599723760
@alishaevn
Copy link
Contributor

@gamontoya my pr's against the pg app were deployed to pg nurax so this code is ready to be tested again! 🎉

@gamontoya
Copy link

@alishaevn I certainly appreciate your persistence--thank you!

@rjkati This ticket is now closeable. Issue resolved for pg-nurax:

Yay!

@rjkati rjkati closed this as completed Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Collection impacts the Collection part of PCDM Model priority valkyrization workflow
Projects
None yet
7 participants