-
Notifications
You must be signed in to change notification settings - Fork 49
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
Fix sipity with migrations #2471
Conversation
The referenced PR is merged and override is not neded.
Test Results 3 files ±0 3 suites ±0 17m 40s ⏱️ +7s Results for commit 7be09b7. ± Comparison against base commit 3189d29. This pull request removes 42 and adds 46 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
Sipity is unable to find the entities due to migrations. Errors manifest in several situations, including: - a fedora work searches for the entity by solr document. Due to the lazy migration option, it can find the resource model rather than the original model, resulting in an incorrect key proxy gid when trying to find the entity. - a migrated work may result in a new proxy gid when attempting to find the sipity entity, resulting in the entity not being found. Sipity entities need to be migrated as works are migrated.
f3feb43
to
f67534d
Compare
b59bcf6
to
7be09b7
Compare
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 don't think this covers all possible cases, but it definitely covers some cases. going to approve it so I don't hold up the train, but I'll revisit it with a fresh brain tomorrow.
* Remove unnecessary override The referenced PR is merged and override is not neded. * Override Sipity for Migrating Works Sipity is unable to find the entities due to migrations. Errors manifest in several situations, including: - a fedora work searches for the entity by solr document. Due to the lazy migration option, it can find the resource model rather than the original model, resulting in an incorrect key proxy gid when trying to find the entity. - a migrated work may result in a new proxy gid when attempting to find the sipity entity, resulting in the entity not being found. Sipity entities need to be migrated as works are migrated. * Fix broken specs
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.
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.
Summary
Refs
Workflow management is broken between pre-valkyrie works and valkyrie resources. Due to how the
proxy_for_global_id
was being built, the Entity could not be found, resulting in no valid workflows being found either. This resulted in numerous errors.f3feb43 begins to work on the fix, by reworking how we find the entity for a work/resource. There may still be remaining issues.
This work should be moved into Hyrax once it is fully fixed.