samvera / hyrax

Hyrax is a Ruby on Rails Engine built by the Samvera community. Hyrax provides a foundation for creating many different digital repository applications.
http://hyrax.samvera.org/
Apache License 2.0
184 stars 124 forks source link

Cleans ID array attributes before persisting with pair-tree Valkyrie Fedora. #6884

Open bwatson78 opened 1 month ago

bwatson78 commented 1 month ago

Fixes

Fixes #6874

Summary

Cleans ID array attributes before persisting with pair-tree Valkyrie Fedora.

Guidance for testing, such as acceptance criteria or new user interface behaviors:

  1. Run a local build of Sirenia using Docker
  2. Log in and navigate to Dashboard -> Works
  3. Click on the title of a work that you've already deposited (or deposit a new one if you don't have any works)
  4. Click Edit
  5. Select a different visibility setting (I went from Public to Institution) and click Save Changes
  6. A message saying Failed save on # undefined method split' for nil:NilClass should not appear, replaced with a success message.

Type of change (for release notes)

Changes proposed in this pull request:

@samvera/hyrax-code-reviewers

dlpierce commented 1 month ago

This seems to address the symptom of a bigger problem, likely where an unsaved object with a nil id is associated with this parent object via an *_id* field, and to_s is called on that nil for compatibility reasons (because it's presumed to be a Valkyrie::ID) and then the resulting empty string gets persisted.

github-actions[bot] commented 1 month ago

Test Results

    17 files  ±0      17 suites  ±0   2h 19m 29s :stopwatch: + 4m 54s  6 706 tests +2   6 409 :white_check_mark: +3  297 :zzz: ±0  0 :x:  - 1  13 180 runs  +2  12 785 :white_check_mark: +3  395 :zzz: ±0  0 :x:  - 1 

Results for commit ff1a22c5. ± Comparison against base commit e4f8a06a.

This pull request removes 273 and adds 275 tests. Note that renamed tests count towards both. ``` spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create # spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create # spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create # spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create # spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy AdminSet: d3ad5e5a-b631-4647-9ba0-62b18509d0a4 spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: af2a1a03-44c2-4752-ba90-1d24e7d1f138 spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit AdminSet: b5ed8b80-843a-4590-83eb-58f11dc5ae52 spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit Hyrax::AdministrativeSet: bc697243-cf0c-4b13-953f-947943070070 spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to update AdminSet: 8fb7f762-e274-495f-b9c3-577bb717663b spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to update Hyrax::AdministrativeSet: 9781c893-9201-4e30-b352-01e08dee570d … ``` ``` spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create # spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create # spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create # spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create # spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy AdminSet: 5a14df86-5d7a-49f3-8b60-c7923484688c spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 18d5e35a-5074-43d0-aef1-b1b4f668be9a spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit AdminSet: 1b0aede5-32cf-4935-b6ae-38feca0e5442 spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit Hyrax::AdministrativeSet: 2554afdf-a808-453d-9c77-200136ee0d18 spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to update AdminSet: 549f871c-f7b2-471e-94bc-85350dd68d5c spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to update Hyrax::AdministrativeSet: 219bd406-93f7-41e9-b273-a8232d74116d … ```