Skip to content

[Sirenia] Test fails when attempting to valkyrie_create with string value for identifier with compount metadata enabled #7544

Description

@cjcolvar

Descriptive summary

I'm seeing the following test failure (spec/features/work_show_spec.rb:190) that is blocking a clean build of my PR (#7542). It appears to only happen with Sirenia and not Koppie or Dassie so the mix of valkyrie and fedora adapater. I'm guessing that this is because both identifier and identifiers share the same predicate so the string value being passed to valkyrie_create gets checked in identifiers and fails the dry-types validation.

I think this is breaking builds now is because the docker image in the github cache got replaced with a new build when clover was installed in the test apps (#7534).

1) work show view in valkyrie shows a work
     Failure/Error: super

     Dry::Struct::Error:
       [Monograph.new] ["867-5309"] (Array) has invalid type for :identifiers violates constraints (type?(Hash, "867-5309") failed)
     # /app/bundle/ruby/3.3.0/gems/dry-types-1.9.1/lib/dry/types/schema.rb:330:in `rescue in block in resolve_unsafe'
     # /app/bundle/ruby/3.3.0/gems/dry-types-1.9.1/lib/dry/types/schema.rb:327:in `block in resolve_unsafe'
     # /app/bundle/ruby/3.3.0/gems/dry-types-1.9.1/lib/dry/types/schema.rb:322:in `each'
     # /app/bundle/ruby/3.3.0/gems/dry-types-1.9.1/lib/dry/types/schema.rb:322:in `resolve_unsafe'
     # /app/bundle/ruby/3.3.0/gems/dry-types-1.9.1/lib/dry/types/schema.rb:60:in `call_unsafe'
     # /app/bundle/ruby/3.3.0/gems/dry-types-1.9.1/lib/dry/types/constructor.rb:84:in `call_unsafe'
     # /app/bundle/ruby/3.3.0/gems/dry-struct-1.8.1/lib/dry/struct/class_interface.rb:254:in `new'
     # ./app/models/concerns/hyrax/compound_normalization.rb:24:in `new'
     # /app/bundle/ruby/3.3.0/gems/valkyrie-3.5.1/lib/valkyrie/types.rb:65:in `block in <module:Types>'
     # /app/bundle/ruby/3.3.0/gems/dry-types-1.9.1/lib/dry/types/constructor/function.rb:17:in `call'
     # /app/bundle/ruby/3.3.0/gems/dry-types-1.9.1/lib/dry/types/constructor.rb:84:in `call_unsafe'
     # /app/bundle/ruby/3.3.0/gems/dry-types-1.9.1/lib/dry/types/type.rb:47:in `call'
     # /app/bundle/ruby/3.3.0/gems/valkyrie-3.5.1/lib/valkyrie/persistence/fedora/persister/orm_converter.rb:19:in `convert'
     # /app/bundle/ruby/3.3.0/gems/valkyrie-3.5.1/lib/valkyrie/persistence/fedora/persister/resource_factory.rb:25:in `to_resource'
     # /app/bundle/ruby/3.3.0/gems/valkyrie-3.5.1/lib/valkyrie/persistence/fedora/persister.rb:33:in `save'
     # ./lib/hyrax/specs/shared_specs/factories/strategies/valkyrie_resource.rb:16:in `result'
     # /app/bundle/ruby/3.3.0/gems/factory_bot-4.11.1/lib/factory_bot/factory.rb:43:in `run'
     # /app/bundle/ruby/3.3.0/gems/factory_bot-4.11.1/lib/factory_bot/factory_runner.rb:29:in `block in run'
     # /app/bundle/ruby/3.3.0/gems/activesupport-7.2.3/lib/active_support/notifications.rb:212:in `instrument'
     # /app/bundle/ruby/3.3.0/gems/factory_bot-4.11.1/lib/factory_bot/factory_runner.rb:28:in `run'
     # /app/bundle/ruby/3.3.0/gems/factory_bot-4.11.1/lib/factory_bot/strategy_syntax_method_registrar.rb:20:in `block in define_singular_strategy_method'
     # ./spec/features/work_show_spec.rb:190:in `block (3 levels) in <top (required)>'
     # ./spec/features/work_show_spec.rb:5:in `block (2 levels) in <top (required)>'
     # ./spec/features/work_show_spec.rb:207:in `block (3 levels) in <top (required)>'
     # /app/bundle/ruby/3.3.0/gems/webmock-3.26.2/lib/webmock/rspec.rb:39:in `block (2 levels) in <top (required)>'
     # ------------------
     # --- Caused by: ---
     # Dry::Types::ConstraintError:
     #   "867-5309" violates constraints (type?(Hash, "867-5309") failed)
     #   /app/bundle/ruby/3.3.0/gems/dry-types-1.9.1/lib/dry/types/constrained.rb:37:in `call_unsafe'

Steps to reproduce

  1. Start Sirenia: docker compose -f docker-compose-sirenia.yml up
  2. Run docker compose -f docker-compose-sirenia.yml exec -w /app/samvera/hyrax-engine web sh -c 'bundle exec rspec spec/features/work_show_spec.rb'

Alternatively from the rails console

  1. Start Sirenia: docker compose -f docker-compose-sirenia.yml up
  2. Enter the rails console: docker compose -f docker-compose-sirenia.yml exec -w /app/samvera/hyrax-engine web sh -c 'bundle exec rails c'
  3. Run:
monograph = Monograph.new(identifier: "867-5309")
Hyrax.metadata_adapter.persister.save(resource: monograph)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions