You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Hyrax using Valkyrie (i.e. koppie and sirenia) there are demonstrable scenarios where a work's attributes get changed from nil to type Valkyrie::ID containing a blank string when saved. Specific examples are embargo_id and lease_id when a work is in a one-step workflow. This doesn't adversely affect koppie on postgres, because the blank string seems to be functionally equivalent to nil, AFAIK.
But this breaks ID handling in sirenia on fedora because the URI values on those attributes get stored in fedora as just http://fedora_url/base_path with no trailing ID. The result is that this call to translate the URI to an ID returns just the configured base_path part of the URI as if it were the ID. On the flip side, this call to translate an ID into a URI returns http://fedora_url/base_path/base_path, which will produce Ldp::NotFound errors.
In the context of Hyrax (i.e. sirenia), the actual breaking behavior can be baffling; those IDs now contain the configured base_path when they should have been nil or blank, triggering calls in parts of the stack that it should normally slip silently through. For example, this Hyrax issue describes errors while saving workflow state for a work, which is caused by Ldp::NotFound for the URI returned for embargo_id, even though it is not under embargo.
I'm opening an issue here and in Valkyrie because it's not clear if something in Hyrax or the Valkyrie persister itself is converting those ID attributes from nil to Valkyrie::ID @id="" . Also, we may have to provide a workaround on the Hyrax side if we can't find why those get converted but the behavior doesn't change on the Valkyrie side.
This problem can be demo'd in a Hyrax (sirenia) console:
persister = Hyrax.persister
monograph1 = Monograph.new
# embargo_id is initially nil
monograph1.embargo_id
# => nil
# Set embargo_id to blank string to mimic what happens for works in a one-step workflow
monograph1.embargo_id = ""
# Value is now blank with type of Valkyrie::ID
monograph1.embargo_id
# => #<Valkyrie::ID:0x00007f5f73fecb88 @id="">
# Saving, which currently allows blank values for the ID attributes...
monograph1 = persister.save(resource: monograph1)
# Load the saved version to a new object, which walks attributes through URI-to-ID conversion
monograph2 = Hyrax.query_service.find_by(id: monograph1.id)
# embargo_id now equal to base_path
monograph2.embargo_id
# => #<Valkyrie::ID:0x00007f5f6eb829a8 @id="development">
# Subsequent ID-to-URI conversion returns invalid location:
Hyrax.query_service.find_by(id: monograph2.embargo_id)
Valkyrie::Persistence::ObjectNotFoundError: Valkyrie::Persistence::ObjectNotFoundError
...
Caused by Ldp::NotFound: Error: Resource /development/development not found
The text was updated successfully, but these errors were encountered:
In Hyrax using Valkyrie (i.e. koppie and sirenia) there are demonstrable scenarios where a work's attributes get changed from
nil
to typeValkyrie::ID
containing a blank string when saved. Specific examples areembargo_id
andlease_id
when a work is in a one-step workflow. This doesn't adversely affect koppie on postgres, because the blank string seems to be functionally equivalent tonil
, AFAIK.But this breaks ID handling in sirenia on fedora because the URI values on those attributes get stored in fedora as just
http://fedora_url/base_path
with no trailing ID. The result is that this call to translate the URI to an ID returns just the configuredbase_path
part of the URI as if it were the ID. On the flip side, this call to translate an ID into a URI returnshttp://fedora_url/base_path/base_path
, which will produceLdp::NotFound
errors.In the context of Hyrax (i.e. sirenia), the actual breaking behavior can be baffling; those IDs now contain the configured
base_path
when they should have beennil
or blank, triggering calls in parts of the stack that it should normally slip silently through. For example, this Hyrax issue describes errors while saving workflow state for a work, which is caused byLdp::NotFound
for the URI returned forembargo_id
, even though it is not under embargo.I'm opening an issue here and in Valkyrie because it's not clear if something in Hyrax or the Valkyrie persister itself is converting those ID attributes from
nil
toValkyrie::ID @id=""
. Also, we may have to provide a workaround on the Hyrax side if we can't find why those get converted but the behavior doesn't change on the Valkyrie side.This problem can be demo'd in a Hyrax (sirenia) console:
The text was updated successfully, but these errors were encountered: