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

Lazy migrate sipity entity with work #7039

Merged

Conversation

laritakr
Copy link
Contributor

@laritakr laritakr commented Mar 6, 2025

Summary

When lazy migration is used, the sipity entity cannot be found for works
which are not yet migrated. Valkyrie resources have a proxy_for_global_id
with the format:
gid://hyku/Hyrax::ValkyrieGlobalIdProxy/2f6da5dd-9314-421f-b0dd-fda84fec9ee3
while prior works used the model name such as:
gid://hyku/GenericWork/2f6da5dd-9314-421f-b0dd-fda84fec9ee3.

Description of changes

Fixes notch8/palni_palci_knapsack#247

This commit introduces a lazy migration of the sipity entity via a job
which is submitted after a work is migrated to valkyrie via the Freyja
persister.

Prior work in pull request samvera/hyku#2471
added some overrides in Hyku to resolve the sipity entity issues. These
changes still needs to be backported.

The prior work includes these changes:
The MigrateResourceService introduced a migration of the entity along
with the work's migration. This service is needed for direct migration
calls, but is not adequate for lazy migration, as the Freyja persister
does not call it for the work itself that was just migrated.

Hyku overrides to sipity.rb support cases where the entity is not yet migrated
and lazy migration is in use. This is necessary because the solr_document
is used to find the Sipity::Entity. Due to the model mapping found in the
solr document, the Entity method searches for the entity with the model
name. This is problematic when the entity is not yet migrated and the
entity is searched with a GenericWorkResource model rather than the
model.

@laritakr laritakr added the notes-bugfix Release Notes: Fixed a bug label Mar 6, 2025
Copy link

github-actions bot commented Mar 6, 2025

Test Results

    13 files  ±0      13 suites  ±0   2h 59m 0s ⏱️ - 1m 11s
 6 833 tests ±0   6 527 ✅ ±0  306 💤 ±0  0 ❌ ±0 
18 101 runs  +1  17 603 ✅ +1  498 💤 ±0  0 ❌ ±0 

Results for commit c76132f. ± Comparison against base commit d4b8f81.

This pull request removes 368 and adds 368 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 #<Hyrax::PermissionTemplate:0x00007f1a17525520>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007ff3bdd1d720>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007ffb586684a0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f1a170a5b58>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007ff3d9ca99d0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007ffb587d6b98>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy AdminSet: 8bbaf5e0-87bb-4112-b541-9d9bdaf69402
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 51225655-ec2a-4da8-8319-8422b56e34b1
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: b4c1e41a-c30e-4c73-a94b-915f6caa8978
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit AdminSet: 2edc5dcc-9a1d-4d2f-b816-6f3c6d32ce2c
…
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f5de2841ce0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f6c140944d0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f98d2b180d8>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f5de284c320>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f6c1473d840>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f98d2ac5f18>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy AdminSet: a5cd16de-0586-40d3-b872-9dca5122501d
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 7f17c378-f53d-450a-b9a8-64361b61494e
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: d856442e-94af-4eb6-8cf8-73d34d77a4be
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit AdminSet: 8cb347f8-9064-41e3-b489-59e586fe7729
…

♻️ This comment has been updated with latest results.

When lazy migration is used, the sipity entity cannot be found for works
which are not yet migrated. Valkyrie resources have a `proxy_for_global_id`
with the format:
`gid://hyku/Hyrax::ValkyrieGlobalIdProxy/2f6da5dd-9314-421f-b0dd-fda84fec9ee3`
while prior works used the model name such as:
`gid://hyku/GenericWork/2f6da5dd-9314-421f-b0dd-fda84fec9ee3`.

This commit introduces a lazy migration of the sipity entity via a job
which is submitted after a work is migrated to valkyrie via the Freyja
persister.

Prior work in pull request samvera/hyku#2471
added some overrides in Hyku to resolve the sipity entity issues. These
changes still needs to be backported.

The prior work includes these changes:
The MigrateResourceService introduced a migration of the entity along
with the work's migration. This service is needed for direct migration
calls, but is not adequate for lazy migration, as the Freyja persister
does not call it for the work itself that was just migrated.

Hyku overrides to sipity.rb support cases where the entity is not yet migrated
and lazy migration is in use. This is necessary because the solr_document
is used to find the Sipity::Entity. Due to the model mapping found in the
solr document, the Entity method searches for the entity with the model
name. This is problematic when the entity is not yet migrated and the
entity is searched with a GenericWorkResource model rather than the
model.
@laritakr laritakr force-pushed the lazy-migrate-sipity-entity-with-work branch from be530c4 to c76132f Compare March 6, 2025 06:29
@laritakr laritakr merged commit dd82f66 into main_before_rails_72 Mar 6, 2025
17 checks passed
@laritakr laritakr deleted the lazy-migrate-sipity-entity-with-work branch March 6, 2025 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notes-bugfix Release Notes: Fixed a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant