From 5ae568a68aac0d1b71bddd6d28a878a4a583e9b0 Mon Sep 17 00:00:00 2001 From: Braydon Justice Date: Thu, 19 Dec 2024 23:23:12 -0800 Subject: [PATCH 1/3] fix race condition for statuses on export (#999) --- app/jobs/bulkrax/export_work_job.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/jobs/bulkrax/export_work_job.rb b/app/jobs/bulkrax/export_work_job.rb index 842a35c2..ec87aa93 100644 --- a/app/jobs/bulkrax/export_work_job.rb +++ b/app/jobs/bulkrax/export_work_job.rb @@ -26,7 +26,7 @@ def perform(*args) end # rubocop:enable Rails/SkipsModelValidations end - return entry if exporter_run.enqueued_records.positive? + return entry if exporter_run.reload.enqueued_records.positive? if exporter_run.failed_records.positive? exporter_run.exporter.set_status_info('Complete (with failures)') From d5b64bcbdb987f32e06c49446324dd5375e27bdb Mon Sep 17 00:00:00 2001 From: Rob Kaufman Date: Fri, 20 Dec 2024 09:04:28 -0800 Subject: [PATCH 2/3] update the bulkrax factory to support flexible metadata while maintaining non-flexi support (#1001) * update the bulkrax factory to support flexible metadata while maintaining non-flexi support * better compatibility --- app/factories/bulkrax/valkyrie_object_factory.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/factories/bulkrax/valkyrie_object_factory.rb b/app/factories/bulkrax/valkyrie_object_factory.rb index 955e84f7..e49d7c7b 100644 --- a/app/factories/bulkrax/valkyrie_object_factory.rb +++ b/app/factories/bulkrax/valkyrie_object_factory.rb @@ -81,7 +81,8 @@ def self.field_multi_value?(field:, model:) return false unless field_supported?(field: field, model: model) if model.respond_to?(:schema) - dry_type = model.schema.key(field.to_sym) + schema = model.new.singleton_class.schema || model.schema + dry_type = schema.key(field.to_sym) return true if dry_type.respond_to?(:primitive) && dry_type.primitive == Array false @@ -193,7 +194,8 @@ def self.schema_properties(klass) @schema_properties_map ||= {} klass_key = klass.name - @schema_properties_map[klass_key] = klass.schema.map { |k| k.name.to_s } unless @schema_properties_map.key?(klass_key) + schema = klass.new.singleton_class.schema || klass.schema + @schema_properties_map[klass_key] = schema.map { |k| k.name.to_s } unless @schema_properties_map.key?(klass_key) @schema_properties_map[klass_key] end From 76023a9efcfff23056b6e7e3e1e316f88e9ce3ca Mon Sep 17 00:00:00 2001 From: Rob Kaufman Date: Fri, 20 Dec 2024 09:04:44 -0800 Subject: [PATCH 3/3] Revert ObjectFactory#find method returning false instead of nil on missing object (#1000) the find method changed from returning nil to returning false in Hyrax 4 valkyrie support (#872). several bugs around this change have been guarded against, but a full audit was done and there is nothing that requires this method to continue to return false and several places that still expect it to be nil. So we are reverting to nil when an object isnt found in the factory --- app/factories/bulkrax/object_factory_interface.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/factories/bulkrax/object_factory_interface.rb b/app/factories/bulkrax/object_factory_interface.rb index e3845c3b..723bf75b 100644 --- a/app/factories/bulkrax/object_factory_interface.rb +++ b/app/factories/bulkrax/object_factory_interface.rb @@ -319,9 +319,9 @@ def delete(_user) # # @return [Object] when we've found the object by the entry's :id or by it's # source_identifier - # @return [FalseClass] when we cannot find the object. + # @return [NilClass] when we cannot find the object. def find - find_by_id || search_by_identifier || false + find_by_id || search_by_identifier || nil end ##