scientist-softserv / palni-palci

Other
1 stars 0 forks source link

Re-allow CSVs without model column to fallback on default work type #1042

Open bkiahstroud opened 5 months ago

bkiahstroud commented 5 months ago

Story

Importing a CSV without a model column leads to the importer failing to run and logging this error: NameError - uninitialized constant Hyrax::Form Did you mean? Hyrax::Forms.

CSVs imported without a model column should fallback on Bulkrax.default_work_type.

Slack thread

Acceptance Criteria

Testing Instructions and Sample Files

  1. Login as an admin
  2. Navigate to Dashboard > Importers > New Importer
  3. Upload a valid CSV that does not have a model column
  4. Click Create and Import
  5. Validate that the importer successfully creates GenericWorks instead of failing with an error

Notes

Stack trace ``` /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/inflector/methods.rb:285:in `const_get' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/inflector/methods.rb:285:in `block in constantize' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/inflector/methods.rb:281:in `each' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/inflector/methods.rb:281:in `inject' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/inflector/methods.rb:281:in `constantize' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/core_ext/string/inflections.rb:68:in `constantize' /app/samvera/hyrax-webapp/app/parsers/bulkrax/csv_parser_decorator.rb:42:in `determine_required_fields_for' /app/samvera/hyrax-webapp/app/parsers/bulkrax/csv_parser_decorator.rb:26:in `missing_fields_for' /app/samvera/hyrax-webapp/app/parsers/bulkrax/csv_parser_decorator.rb:11:in `block in valid_import?' /app/samvera/hyrax-webapp/app/parsers/bulkrax/csv_parser_decorator.rb:9:in `each' /app/samvera/hyrax-webapp/app/parsers/bulkrax/csv_parser_decorator.rb:9:in `each_with_object' /app/samvera/hyrax-webapp/app/parsers/bulkrax/csv_parser_decorator.rb:9:in `valid_import?' /usr/local/bundle/bundler/gems/bulkrax-f2439755f501/app/models/bulkrax/importer.rb:21:in `valid_import?' /app/samvera/hyrax-webapp/app/jobs/bulkrax/importer_job_decorator.rb:9:in `import' /usr/local/bundle/bundler/gems/bulkrax-f2439755f501/app/jobs/bulkrax/importer_job.rb:12:in `perform' /usr/local/bundle/gems/activejob-5.2.8.1/lib/active_job/execution.rb:39:in `block in perform_now' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/callbacks.rb:109:in `block in run_callbacks' /usr/local/bundle/gems/sentry-raven-2.13.0/lib/raven/integrations/rails/active_job.rb:13:in `block (2 levels) in included' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/callbacks.rb:118:in `instance_exec' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks' /usr/local/bundle/gems/i18n-1.14.1/lib/i18n.rb:322:in `with_locale' /usr/local/bundle/gems/activejob-5.2.8.1/lib/active_job/translation.rb:9:in `block (2 levels) in ' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/callbacks.rb:118:in `instance_exec' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks' /usr/local/bundle/gems/activejob-5.2.8.1/lib/active_job/logging.rb:26:in `block (4 levels) in ' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/notifications.rb:168:in `block in instrument' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/notifications/instrumenter.rb:23:in `instrument' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/notifications.rb:168:in `instrument' /usr/local/bundle/gems/activejob-5.2.8.1/lib/active_job/logging.rb:25:in `block (3 levels) in ' /usr/local/bundle/gems/activejob-5.2.8.1/lib/active_job/logging.rb:46:in `block in tag_logger' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/tagged_logging.rb:71:in `block in tagged' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/tagged_logging.rb:28:in `tagged' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/tagged_logging.rb:71:in `tagged' /usr/local/bundle/gems/activejob-5.2.8.1/lib/active_job/logging.rb:46:in `tag_logger' /usr/local/bundle/gems/activejob-5.2.8.1/lib/active_job/logging.rb:22:in `block (2 levels) in ' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/callbacks.rb:118:in `instance_exec' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/callbacks.rb:136:in `run_callbacks' /usr/local/bundle/gems/activejob-5.2.8.1/lib/active_job/execution.rb:38:in `perform_now' /app/samvera/hyrax-webapp/lib/active_job_tenant.rb:39:in `block in perform_now' /app/samvera/hyrax-webapp/lib/active_job_tenant.rb:58:in `block in switch' /usr/local/bundle/gems/apartment-2.2.1/lib/apartment/adapters/abstract_adapter.rb:85:in `switch' /usr/local/lib/ruby/2.7.0/forwardable.rb:235:in `switch' /app/samvera/hyrax-webapp/lib/active_job_tenant.rb:57:in `switch' /app/samvera/hyrax-webapp/lib/active_job_tenant.rb:38:in `perform_now' /usr/local/bundle/gems/sentry-rails-5.4.2/lib/sentry/rails/active_job.rb:9:in `block in perform_now' /usr/local/bundle/gems/sentry-rails-5.4.2/lib/sentry/rails/active_job.rb:33:in `block in record' /usr/local/bundle/gems/sentry-ruby-5.4.2/lib/sentry/hub.rb:59:in `with_scope' /usr/local/bundle/gems/sentry-ruby-5.4.2/lib/sentry-ruby.rb:352:in `with_scope' /usr/local/bundle/gems/sentry-rails-5.4.2/lib/sentry/rails/active_job.rb:21:in `record' /usr/local/bundle/gems/sentry-rails-5.4.2/lib/sentry/rails/active_job.rb:8:in `perform_now' /usr/local/bundle/gems/activejob-5.2.8.1/lib/active_job/execution.rb:24:in `block in execute' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/callbacks.rb:109:in `block in run_callbacks' /usr/local/bundle/gems/activejob-5.2.8.1/lib/active_job/railtie.rb:28:in `block (4 levels) in ' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/execution_wrapper.rb:90:in `wrap' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/reloader.rb:73:in `block in wrap' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/execution_wrapper.rb:86:in `wrap' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/reloader.rb:72:in `wrap' /usr/local/bundle/gems/activejob-5.2.8.1/lib/active_job/railtie.rb:27:in `block (3 levels) in ' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/callbacks.rb:118:in `instance_exec' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/callbacks.rb:136:in `run_callbacks' /usr/local/bundle/gems/activejob-5.2.8.1/lib/active_job/execution.rb:22:in `execute' /usr/local/bundle/gems/activejob-5.2.8.1/lib/active_job/queue_adapters/sidekiq_adapter.rb:42:in `perform' /usr/local/bundle/gems/sidekiq-6.5.6/lib/sidekiq/processor.rb:202:in `execute_job' /usr/local/bundle/gems/sidekiq-6.5.6/lib/sidekiq/processor.rb:170:in `block (2 levels) in process' /usr/local/bundle/gems/sidekiq-6.5.6/lib/sidekiq/middleware/chain.rb:177:in `block in invoke' /usr/local/bundle/gems/sentry-raven-2.13.0/lib/raven/integrations/sidekiq.rb:9:in `call' /usr/local/bundle/gems/sidekiq-6.5.6/lib/sidekiq/middleware/chain.rb:179:in `block in invoke' /usr/local/bundle/gems/sidekiq-6.5.6/lib/sidekiq/middleware/chain.rb:182:in `invoke' /usr/local/bundle/gems/sidekiq-6.5.6/lib/sidekiq/processor.rb:169:in `block in process' /usr/local/bundle/gems/sidekiq-6.5.6/lib/sidekiq/processor.rb:136:in `block (6 levels) in dispatch' /usr/local/bundle/gems/sidekiq-6.5.6/lib/sidekiq/job_retry.rb:113:in `local' /usr/local/bundle/gems/sidekiq-6.5.6/lib/sidekiq/processor.rb:135:in `block (5 levels) in dispatch' /usr/local/bundle/gems/sidekiq-6.5.6/lib/sidekiq/rails.rb:14:in `block in call' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/execution_wrapper.rb:90:in `wrap' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/reloader.rb:73:in `block in wrap' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/execution_wrapper.rb:90:in `wrap' /usr/local/bundle/gems/activesupport-5.2.8.1/lib/active_support/reloader.rb:72:in `wrap' /usr/local/bundle/gems/sidekiq-6.5.6/lib/sidekiq/rails.rb:13:in `call' /usr/local/bundle/gems/sidekiq-6.5.6/lib/sidekiq/processor.rb:131:in `block (4 levels) in dispatch' /usr/local/bundle/gems/sidekiq-6.5.6/lib/sidekiq/processor.rb:263:in `stats' /usr/local/bundle/gems/sidekiq-6.5.6/lib/sidekiq/processor.rb:126:in `block (3 levels) in dispatch' /usr/local/bundle/gems/sidekiq-6.5.6/lib/sidekiq/job_logger.rb:13:in `call' /usr/local/bundle/gems/sidekiq-6.5.6/lib/sidekiq/processor.rb:125:in `block (2 levels) in dispatch' /usr/local/bundle/gems/sidekiq-6.5.6/lib/sidekiq/job_retry.rb:80:in `global' /usr/local/bundle/gems/sidekiq-6.5.6/lib/sidekiq/processor.rb:124:in `block in dispatch' /usr/local/bundle/gems/sidekiq-6.5.6/lib/sidekiq/job_logger.rb:39:in `prepare' /usr/local/bundle/gems/sidekiq-6.5.6/lib/sidekiq/processor.rb:123:in `dispatch' /usr/local/bundle/gems/sidekiq-6.5.6/lib/sidekiq/processor.rb:168:in `process' /usr/local/bundle/gems/sidekiq-6.5.6/lib/sidekiq/processor.rb:78:in `process_one' /usr/local/bundle/gems/sidekiq-6.5.6/lib/sidekiq/processor.rb:68:in `run' /usr/local/bundle/gems/sidekiq-6.5.6/lib/sidekiq/component.rb:8:in `watchdog' /usr/local/bundle/gems/sidekiq-6.5.6/lib/sidekiq/component.rb:17:in `block in safe_thread' ```

Example failed importer in prod

jillpe commented 4 months ago

SoftServ QA: I tried running 2 importers, listed below. The Bulkrax::ImporterJob is stuck in the sidekiq's retries and is preventing me from being able to check this

Importer 1 Importer 2