Skip to content
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

🧹 Hyrax 5 upgrade additional specs #2067

Merged
merged 13 commits into from
Dec 19, 2023

Conversation

laritakr
Copy link
Collaborator

Refs scientist-softserv/hykuup_knapsack#55

Ongoing work to fix broken upgrade specs.

 Ref scientist-softserv/hykuup_knapsack#55

 - Contact form controller and pages controller duplicate some of the
 homepage controller behavior, so corresponding fixes are needed.
 - Update collections factory and collection_ability_spec to match hyrax
 and stop calling `.gid` on a collection_type.
 - Adjust permission_template_form_spec to adjust for removal of method
 `reset_access_controls!` and add a few new expectations instead.
Working with Permission Templates has changed, requiring an adjustment
to both logic and specs.
@laritakr laritakr force-pushed the hyrax-5-upgrade-additional-specs branch from 276201b to b67df4e Compare December 18, 2023 15:31
@laritakr laritakr added the major-ver for release notes label Dec 18, 2023
@laritakr laritakr marked this pull request as ready for review December 18, 2023 19:43
@laritakr laritakr force-pushed the hyrax-5-upgrade-additional-specs branch from f3c33b9 to d7e8fe5 Compare December 18, 2023 20:31
@laritakr laritakr force-pushed the hyrax-5-upgrade-additional-specs branch from d7e8fe5 to cc8c971 Compare December 18, 2023 20:32
@@ -58,14 +59,12 @@ def create
after_deliver
else
flash.now[:error] = 'Sorry, this message was not sent successfully. ' +
@contact_form.errors.full_messages.map(&:to_s).join(", ") +
"" + @captcha.error
@contact_form.errors.full_messages.map(&:to_s).join(", ")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we accounting for any captcha errors?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know... I'm just putting back what was there before that I removed accidentally.

@@ -321,7 +321,7 @@
permission_template: collection.permission_template,
agent_type: 'user',
agent_id: user.user_key)
collection.reset_access_controls!
collection.permission_template.reset_access_controls_for(collection:)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rhetorical/Venting: Upstream change brings the Yuck. Shouldn't the collection be able to do this?

I mean if it gets things working. But saying A tells B to do C with A is a very circuitous way; but

@@ -152,56 +141,26 @@
# :allow_multiple_membership, # OR :not_allow_multiple_membership
# ] }
# let(:collection_type) { create(:collection_lw_type, settings) }
# let(:collection) { build(:collection_lw, collection_type_gid: collection_type.gid) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm…this documentation looks like it might be nice to have.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which documentation? This portion of the code was basically a copy of Hyrax's so I copied over their current documentation with their current factory code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically, the nesting logic and documentation was removed.

We have plans to remove the Stanford import logic, but for now, this
handles the specs that were failing, in an attempt to get CI to pass.
Merge into hyrax-5-upgrade-additional-specs
@laritakr
Copy link
Collaborator Author

293 failing specs left.

Copy link
Collaborator

@kirkkwang kirkkwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@laritakr laritakr merged commit 1c04b9e into hyrax-5-upgrade Dec 19, 2023
2 of 3 checks passed
@laritakr laritakr deleted the hyrax-5-upgrade-additional-specs branch December 19, 2023 00:15
jeremyf added a commit that referenced this pull request Dec 20, 2023
Per https://github.com/samvera/hyku/releases/tag/v5.0.0, these importers
have been deprecated.

The "Commit History of Directories" shows that
there as been little activity, the recent activity being appeasing
Rubocop and working through upgrades.  Further, these files are
conceptually subsumed by Bulkrax.

<details><summary>Commit History of Directories</summary>

```bash
❯ git slog lib/importer
* 6a48652 — Hyrax 5 upgrade rubocop fixes & get specs running in CI (#2065) LaRita Robinson, (2023-12-16)
* 59626ef — 🧹 Rubocop'd lengths and other low hanging fruit Kirk Wang, (2023-12-13)
* fecb4e9 — 🧹 Ran `bundle exec rubocop -a` Kirk Wang, (2023-12-13)
* 0a6d047 — Upgrade to Hyrax 3.4.0 (#1811) Rob Kaufman, (2022-07-07)
* edafd85 — Rubocop fixes (#1640) Rob Kaufman, (2020-08-04)
* 9326387 — update to hyrax 2.2 (#1543) Rob Kaufman, (2018-10-04)
*   7526936 — Merge pull request #1541 from ubiquitypress/hyku-csv-importer Rob Kaufman, (2018-08-21)
|\
| * 904a369 — Remove :files from attributes Remove method to replace existing file_set Claire, (2018-07-20) (tag: v1.0.0)
| * 1cf7f5c — WIP- set uploaded_files param to use existing Actor Claire, (2018-07-19)
| * 9650e54 — Restore callbacks Claire, (2018-07-12)
| * e6a358a — Coerce UploadedFile to an array and use upstream Job Claire, (2018-07-11)
| * 93cb695 — Import files from CSV Claire, (2018-07-06)
* | bc51174 — Hyrax 2.1 upgrade (#1529) Rob Kaufman, (2018-07-26)
|/
* 116d4b9 — Upgrade Hyrax to 2.0.2 and upgrade gems with security vulnerabilities (#1519) Julie Allinson, (2018-03-22)
* d85952b — Changes necessary to get simple CSV import to run Michael J. Giarlo, (2017-08-22)
* a4024f4 — Make ObjectFactory rubocop-clean Joe Atzberger, (2017-08-22)
* 7618c3a — Refactor csv_importer and improve test accuracy Joe Atzberger, (2017-08-22)
* 21eb1e6 — Add a note about a broken method Justin Coyne, (2017-06-15)
* 86eedaa — Update Hyrax and other dependencies Justin Coyne, (2017-04-13)
* bfecea2 — Refactor importers to use Hyrax's actor stack Justin Coyne, (2017-02-23)
* 554b8a8 — Pass ability to the actor Justin Coyne, (2017-02-17)
* a8b25cd — Point at the Hyrax repo Justin Coyne, (2016-12-03)
* 5d005c9 — [WIP] Hyrax! Justin Coyne, (2016-12-02)
* fe229ca — Rename Lerna to Hyku. Fixes #461 Justin Coyne, (2016-11-07)
* 1f5fe23 — Update dependencies, Sufia to 7.0.0.rc1 Justin Coyne, (2016-07-12)
* d2c8fb1 — Rename hybox to lerna Michael J. Giarlo, (2016-06-08)
* 5de0440 — Add a CSV importer Justin Coyne, (2016-05-23)
* 5dcbb9b — Use User.batch_user instead of the deprecated batchuser Justin Coyne, (2016-05-20)
* d2a6c3c — Update to latest rubocop and rubocop-rspec Chris Beer, (2016-05-20)
* 642df79 — MODS/PURL importer Justin Coyne, (2016-05-19)
```

```bash
❯ git slog spec/lib/importer/
* 1c04b9e — 🧹 Hyrax 5 upgrade additional specs (#2067) LaRita Robinson, (2023-12-18)
* 6a48652 — Hyrax 5 upgrade rubocop fixes & get specs running in CI (#2065) LaRita Robinson, (2023-12-16)
* fecb4e9 — 🧹 Ran `bundle exec rubocop -a` Kirk Wang, (2023-12-13)
* 0a6d047 — Upgrade to Hyrax 3.4.0 (#1811) Rob Kaufman, (2022-07-07)
* edafd85 — Rubocop fixes (#1640) Rob Kaufman, (2020-08-04)
* f9a3a64 — Use paths based on Rails.root instead of pure relative paths Chris Colvard, (2020-07-08)
* 1b3c5ed — rubocop fixes nicholas, (2018-10-12)
* aeb9904 — update FactoryGirl to FactoryBot nicholas, (2018-10-09)
* 93cb695 — Import files from CSV Claire, (2018-07-06)
* 116d4b9 — Upgrade Hyrax to 2.0.2 and upgrade gems with security vulnerabilities (#1519) Julie Allinson, (2018-03-22)
* 7618c3a — Refactor csv_importer and improve test accuracy Joe Atzberger, (2017-08-22)
* 86eedaa — Update Hyrax and other dependencies Justin Coyne, (2017-04-13)
* bfecea2 — Refactor importers to use Hyrax's actor stack Justin Coyne, (2017-02-23)
* 8ecb861 — Require rails_helper in one place instead of 100 Joe Atzberger, (2017-02-14)
* 7498ecb — Update to latest hyrax Justin Coyne, (2016-12-20)
* a8b25cd — Point at the Hyrax repo Justin Coyne, (2016-12-03)
* 5d005c9 — [WIP] Hyrax! Justin Coyne, (2016-12-02)
* 5de0440 — Add a CSV importer Justin Coyne, (2016-05-23)
* d2a6c3c — Update to latest rubocop and rubocop-rspec Chris Beer, (2016-05-20)
* 642df79 — MODS/PURL importer Justin Coyne, (2016-05-19)
```

</details>
@kirkkwang kirkkwang mentioned this pull request Jan 5, 2024
ShanaLMoore added a commit that referenced this pull request Jan 5, 2024
* remove dogbiscuit crossover, fix routes

* add spec for search history

* add missing methods to avoid content block errors

* Update Hyku Gemfile.lock

* add option to support good job for background jobs instead of sidekiq

* update gemfile lock

* Update good_job.rb

* merge

* fix routes file, add missing js file

* 💄 styling fix

* 💄 rubocop fixes

* remove iiif_print/iiif_print require

cause of Sprockets::FileNotFound in Splash#index error. Doesn't seem necessary.

* 🎁 🧹 add missing file and format with semicolons

The previous build revealed that admin_color_select.js was missing. It also complained about missing semicolons.

* 💄 correct missing semicolons

appease the hound by formatting js file with semicolons.

* 🧹 remove call to iiif_print/iiif_print

Cause of build error. It's already being included in sass.

* 💄 Rubocop fixes

* ✅ Fix test setup for catalog_controller_spec

This commit will add additional setup to the catalog_controller_spec.

* Add knapsack helper

* remove Adventist from application.rb

* 🎁 Add conditional to run correct command for worker

This commit adds a conditional to run the correct command for sidekiq or good_job, when running docker compose up.

* Make appearance constants overrideable

This allows for the knapsack to override the constants by defining and
using a method rather than a constant in the look-ups.

* add reporting fix to hyku ci

* spec loading fixes

* rubocop

* 🧹Make appearance defaults overrideable

* bump bulkrax to 5.4.0

This commit pulls in a small collection of bug fixes.

* 🧹 Include knapsack css

* fix job loading when selecting good job

* adjust docker compose to use the startup script

* 🎁 install tesseract eng_best

* ♻️ revert tesseract best changes to dockerfile

this change belongs in the knapsack directory instead

* ♻️ revert tesseract best changes to dockerfile

this change belongs in the knapsack directory instead

* 🐛 Bring fix for entry show page not showing link

This commit will bring in a fix from Bulkrax that correctly shows the
object from the entry show page.

ref:
  - samvera/bulkrax@0e68a5e

* 🧹 Revert previous commit and update Bulkrax

This commit will update Bulkrax to 5.4.1 instead of using the override
from the last commit.  We also revert the changes from the last commit.

* 🐛 subject can't be blank for the contact form

Previously there was a bug because even if you typed in a subject, the contact form would error saying that it was blank.

Part of issue:
- https://github.com/scientist-softserv/adventist-dl/issues/608

* mend

* ♻️ Add handling for Knapsack theme overrides

Prior to this commit, we were looking for themes yaml files relative to
the directory of the spawning script.  For Hyku that was always the
`Rails.root` directory.  However, when running specs in Knapsack, that
directory was `Knapsack::Engine.root`.

This unearthed a potential configuration issue; namely that we want
Knapsack's to control what themes are available, meaning we don't want
to require amending Hyku's themes.

So, we introduce a mechanism for looking up files first in the Knapsack
then in Hyku.

I discovered this bug in the specs for knapsack (below is the *Error stack trace*)

<details>
<summary>Error stack trace</summary>

```
2) Hyrax::Admin::AppearancesController with an administrator GET #show assigns the requested site as @site
     Failure/Error: get :show, params: {}

     Errno::ENOENT:
       No such file or directory @ rb_sysopen - config/home_themes.yml
     # /usr/local/bundle/gems/psych-3.3.4/lib/psych.rb:582:in `initialize'
     # /usr/local/bundle/gems/psych-3.3.4/lib/psych.rb:582:in `open'
     # /usr/local/bundle/gems/psych-3.3.4/lib/psych.rb:582:in `unsafe_load_file'
     # ./hyrax-webapp/app/controllers/hyrax/admin/appearances_controller.rb:19:in `show'
     # /usr/local/bundle/gems/rails-controller-testing-1.0.5/lib/rails/controller/testing/template_assertions.rb:62:in `process'
     # /usr/local/bundle/gems/devise-4.9.2/lib/devise/test/controller_helpers.rb:35:in `block in process'
     # /usr/local/bundle/gems/devise-4.9.2/lib/devise/test/controller_helpers.rb:104:in `catch'
     # /usr/local/bundle/gems/devise-4.9.2/lib/devise/test/controller_helpers.rb:104:in `_catch_warden'
     # /usr/local/bundle/gems/devise-4.9.2/lib/devise/test/controller_helpers.rb:35:in `process'
     # /usr/local/bundle/gems/rails-controller-testing-1.0.5/lib/rails/controller/testing/integration.rb:16:in `block (2 levels) in <module:Integration>'
     # ./spec/controllers/hyrax/hyrax/admin/appearances_controller_spec.rb:31:in `block (4 levels) in <top (required)>'
     # /usr/local/bundle/gems/webmock-3.19.1/lib/webmock/rspec.rb:39:in `block (2 levels) in <top (required)>'
     # ./hyrax-webapp/spec/support/multitenancy_metadata.rb:50:in `block (2 levels) in <top (required)>'
     # /usr/local/bundle/gems/rspec-retry-0.6.2/lib/rspec/retry.rb:124:in `block in run'
     # /usr/local/bundle/gems/rspec-retry-0.6.2/lib/rspec/retry.rb:110:in `loop'
     # /usr/local/bundle/gems/rspec-retry-0.6.2/lib/rspec/retry.rb:110:in `run'
     # /usr/local/bundle/gems/rspec-retry-0.6.2/lib/rspec_ext/rspec_ext.rb:12:in `run_with_retry'
     # /usr/local/bundle/gems/rspec-retry-0.6.2/lib/rspec/retry.rb:37:in `block (2 levels) in setup'
     # ./spec/spec_helper.rb:10:in `block (2 levels) in <top (required)>'
```

</details>

Related to:

- #2007
- #2008

The above two commits will require some reconciliation once this is incorporated.

* ♻️ Favor Hyku::Application.path_for over Rails.root

Given the existence of Knapsack we need to consider how overrides in
Knapsack will take precedence over Hyku files.  This change handles
cases where we want to use the Knapsack's uploaded thumbnails.

Related to:

- #2010

* 🎁 Add highlight key to UV

This commit allows for the `parent_query` to be highlighted in the UV so
users won't have to do a catalog search and also a UV search.

* 🐛 Mixin `HykuKnapsack::ApplicationHelper`

This commit will mixin the `HykuKnapsack::ApplicationHelper` into the
ApplicationHelper which will allow us to use #render_ocr_snippets for
snippet highlighting.

* Revert "🐛 Mixin `HykuKnapsack::ApplicationHelper`"

This reverts commit ae093f1.

* ♻️ Favor class_attribute over constant

In Adventist, we're needing to override the constant's values.  By
making this a class_attribute we can more readily do the override via
configuration instead of obliteration of a constant.

* ♻️ Favor configurable html head title value

Prior to this commit, we hard-coded the page title; this is something
that should be far more configurable.  And this refactor is a step
towards that.

This also allows for downstream implementors to not have to override the
view simply to change the title element.

* 🐛 Add custom rendering for license

Prior to this commit, the License would render as a plain URL.  With
this change, we are now coercing the license into a URL that is labeled
and titled with the name of the license.

This is copied and modified based on [Rights show partial][1]

Related to:

- https://github.com/scientist-softserv/adventist-dl/issues/620

[1]: https://github.com/samvera/hyrax/blob/b334e186e77691d7da8ed59ff27f091be1c2a700/app/views/records/show_fields/_rights.html.erb

* ♻️ Add option to override devise configuration

For Adventist, we wanted to disable registration of accounts as this was
creating a case where folks were creating their own accounts and
tenants.

Related to:

- https://github.com/scientist-softserv/adventist-dl/issues/492
- https://github.com/scientist-softserv/adventist-dl/issues/618
- #1964
- scientist-softserv/adventist-dl#493

* run asset build later in process to allow knapsack to run it only one time

* 🐛 Fix Add to Collection for page 2+ of works

Prior to this commit, when you were on page 2 of your works and selected
a work to add to a collection, the query for available collections would
use the page 2 as part of the collection query.  This would mean the
first 100 collections (default page size) that you had access to add
works to were skipped.

With this commit, we omit the query parameters from the works page and
then query collections.

Related to:

- samvera/hyrax#5972
- samvera/hyrax#5969
- https://github.com/scientist-softserv/adventist-dl/issues/625

Co-authored-by: LaRita Robinson <[email protected]>

* test that invited users are added to the registered group

* Add invited users to the registered group

Fixes a bug where users who were invited with no roles would not
show up in the users list at all

* 🐛 Change Hyky to Hyku (#2029)

Typo caused inability to upload collection thumbnail.

* 🎁 Modify labels in UV for V3 manifests

This commit will add the same treatment as we have for V2 manifests to
V3 manifests. This will allow the UV to add a more human readable label
to the pages.

Ref:
  - https://github.com/scientist-softserv/adventist-dl/issues/628

* 🐛 Fix bad method name

Related to:

- https://github.com/samvera/hyku/pull/2023/files
- scientist-softserv/atla-hyku#198

* 🐛 Move some methods to be public

This commit will move #solr_document, #current_ability, and #request to
be public methods.  Since these methods in Hyrax were not private, in
the decorator it should not be private either.

Ref:
  - https://github.com/samvera/hyrax/blob/b334e186e77691d7da8ed59ff27f091be1c2a700/app/presenters/hyrax/file_set_presenter.rb#L10

* First attempt for upgrade to Hyrax 5.0.0.rc2

So far the changes throw an error `The adapter `nulldb_adapter` is not
yet supported` when doing a `docker compose build`.  Commenting out `RUN
RAILS_ENV=production SECRET_KEY_BASE=`bin/rake secret` DB_ADAPTER=nulldb
DB_URL='postgresql://fake' bundle exec rake assets:precompile && yarn
install` in the Dockerfile allows the build to complete but still can't
boot yet.

* 🧹 Get assets to precompile

This commit has a lot in it, but of note:

- We forked apartment gem to expand activerecord version support
- Used the Hyrax upgrade guide to update assets
- Replaced bootstrap 3 variables with hard coded values
- Commented out blacklight_helper_behavior.rb because Blacklight 7
  removed it, we'll have to figure out how to get the same functionality
  in the new version

* 🧹 Switch to Hyrax `double_combo` branch

We are using this branch on Hyrax because it has quite a few Valkyrie
related fixes in it.

* 🧹 use class attribute instead of constant to correct failing specs

* Fix specs

* 🧹 Get the page to load

This commit will get the proprietor page to load.  You can create a
tenant and vist it as well.

* ♻️ Introduce Hyku::Application.theme_view_path_roots

With the introduction of [HykuKnapsack][1], we are adjusting how we
create instances of Hyku.  Namely we don't clone Hyku but instead we
incorporate Hyku as a submodule into a Knapsack.

The Knapsack is a Rails engine that is mounted in the Hyku application.
What this means is that when we want to

Prior to this commit, the only way to adjust themed views would have
been to add them to the Rails application (e.g. Hyku) directly.  Which
would work in a non-Knapsack ecosystem.

However, with Knapsack we need a means of saying "Hey, for themes we
want to be able to add/adjust views within the knapsack."  Hence this
change.

[1]: https://github.com/samvera-labs/hyku_knapsack

* 🧹 Prepping for rubocop

This commit will change the Docker image to rc1 because rc2 stopped
working (at least locally).  Also getting things ready to run rubocop.

* 🧹 Ran `bundle exec rubocop -a`

* 🧹 Autocorrect frozen string literals

```sh
rubocop --only Style/FrozenStringLiteralComment -A
```

* 🧹 Rubocop'd lengths and other low hanging fruit

Various length metrics were disabled in this commit.  Also other various
cops that were easy to fix.

* 🧹 Remove deprecated Blacklight code

removing the deprecated blacklight code allows the specs to run. We should consider if finding a replacement is necessary in the following ticket:

- scientist-softserv/hykuup_knapsack#54

Issue:
- scientist-softserv/hykuup_knapsack#35

* 🧹 Avoid `#present?` in non-Rails situations

Rails provides [`Object#present?`][1], which is a method that is not
generally available in Ruby.  However in the changed context, the
scripts do not have access to Rails methods.

By using this adjusted approach we favor baseline Ruby methods.

[1]: https://api.rubyonrails.org/classes/Object.html#method-i-present-3F

* 🧹 Get Homepage Controller specs passing (#2058)

Refactor homepage controller to more closely align with Hyrax's
homepage controller.
Adjust theme views to render `modal` instead of `ajax_modal`.

refs: scientist-softserv/hykuup_knapsack#56

* ♻️ Replace Homepage Presenter with decorator (#2059)

* 🧹Get CatalogController specs working (#2060)

* 🧹 Hyrax 5 get additional specs passing (#2062)

* 🧹 Get chrome.hyku.test working

* 🧹 Get SitesControllerSpecs working

 File fixtures were broken.
 Ref scientist-softserv/hykuup_knapsack#56

* 🧹 Remove google analytics from config reload

This is a piece of a fix for analytics that came in via
scientist-softserv/palni-palci#946

Additional backporting of analytics work is still needed, but this
fixes numerous specs so it is being pulled in earlier.

* 🧹 Update ruby version for circleci

* 🧹 Update rails version for circleci

* 🧹Database migration & schema update (#2063)

For table hyrax_counter_metrics

* 🧹 Fix Hyrax 5 remaining controller spec failures (#2064)

* 🧹Remove ActiveFedora monkeypatch

* 🧹Fix file fixture

* 🧹 Upgrade views from Bootstrap 3 to 4

This commit is a first swing of upgrading all the views from Bootstrap 3
to 4.  There's still a lot of work to be done to make the views look
good but this is a good first step.

* Hyrax 5 upgrade rubocop fixes & get specs running in CI (#2065)

* 🧹Rubocop Fixes

* Attempt to fix circleci

* 🧹 Fix CollapsableSectionPresenter override

The override was causing issues not passing the nav-link class into the
anchor tags.  This fix specifically passes the title attribute in vs the
previous implementation of trying to pass all html options in.

* 🧹 Remove required translations from locales

This commit will remove the override for the `required` translations
since it changed to a badge badge-style in Bootstrap 4.  This is
accounted for in Hyrax so we can fall back to that.

* 🐛 Fix some javascript errors

This commit will fix a few javascript errors, at least enough to get the
the bootstrap javascript to work correctly.  We're still getting a the
almond-rails js error but that seems to exist in previous Hyku as well.

* Hyrax 5 upgrade rubocop fixes & get specs running in CI (#2065)

* 🧹Rubocop Fixes

* Attempt to fix circleci

* 🧹 Post review adjustments

These are adjustments made after the PR has been reviewed.

* 🧹 Clean up a couple blacklight views

This commit will account for the new versions of Blacklight and
Blacklight Gallery.  The masonry view no longer exists so we can't tell
how it's broken as of right now.  I'm sure we'll run into it during our
testing.

NOTE:  These changes refer to the shared search tenant.

* 🧹 Bring back `BlacklightHelperBehavior`

This commit will bring back the `BlacklightHelperBehavior` module but it
will be namespaced under `Hyku` to avoid conflicts.  We will then
include it in the `HyraxHelper` module so those methods should override
the ones in `Blacklight::BlacklightHelperBehavior`.

* 🧹 Hyrax 5 upgrade additional specs (#2067)

* 🧹 More spec & controller fixes

 Ref scientist-softserv/hykuup_knapsack#55

 - Contact form controller and pages controller duplicate some of the
 homepage controller behavior, so corresponding fixes are needed.
 - Update collections factory and collection_ability_spec to match hyrax
 and stop calling `.gid` on a collection_type.
 - Adjust permission_template_form_spec to adjust for removal of method
 `reset_access_controls!` and add a few new expectations instead.

* 🧹 Begin work on Roles Service

Working with Permission Templates has changed, requiring an adjustment
to both logic and specs.

* 🧹 Solr Document Ability Spec

* Rubocop fixes

* Fix typo of collection variable

* Reinstate some collections factory overrides

* Revert Rubocop changes

Caused spec failure in roles_service_spec.

* Fix create_default_admin_set_job_spec

* Restore mistakenly removed capta use

* 🧹 Stanford import specs

We have plans to remove the Stanford import logic, but for now, this
handles the specs that were failing, in an attempt to get CI to pass.

* Make Rubocop happy

* Fix typo

* Update Hyrax to pull in most recent changes

* More spec fixes

Menu presenter: removed html_options
Application Helper: override for missing_translations now receives
`false` when translation wasn't found rather than a string.

* Fix missing translation logic

* Fix  missing_translation override

Simplify and fix override. A missing translation now returns `false`
instead of the text `translation missing`.

The super method requires the `option` parameter, so we opted to keep
the override.

* 🧹 Remove copied code

The overrides are no longer necessary.  In reviewing the diff between
what I'm removing and what is in the `double_combo` branch; the major
change was adding an operator for the `reduce` function.  The breaking
problem was that the method signature of one of the copied methods has
changed in Hyrax 5.0.

The removal considers that Hyrax::Group is of two different classes:

- In Hyrax, it is a plain old Ruby object
- In Hyku, it is descended from ActiveRecord::Base

The two classes have different instantiation parameters.  Hence the
introduction of `Hyrax::Group.new` in this code.

* 🧹 Fix missing method name

* 🐛 Ensure :maxFileSize is integer

Prior to this commit, we were casting the value to string.  However
Hyrax attempts to do division on that string.

See https://github.com/samvera/hyrax/blob/b7891b758411c59f71ff54212e0d250fcc47e35f/app/views/hyrax/base/_form_files.html.erb#L6-L15

* Skip taking a picture on failure

* 🧹 Fix issue regarding Valkyrie::Identifier

The encountered error was:

```
NoMethodError:
  undefined method `split' for #<Valkyrie::ID:0x0000ffffa5f04bc8
  @id="admin_set/default">
```

* 🧹 Favor Sipity::Entity function over to_sipity_entity

The Sipity conversion methods are now explicit functions (much like the
`Array()` function).

- https://github.com/samvera/hyrax/blob/5aaa568d348a180add2a1337d9d794b740703df8/app/models/sipity.rb#L20

* Update Hyrax IIIF AV gem

* 🧹 Review controller overrides

Many of the controllers just needed to be updated with the decorator
pattern.  We're creating a new concern for all the Hyku specific
overrides in Hyku::WorksControllerBehavior.  This has to be included in
the Controller classes after Hyrax::WorksControllerBehavior to override
the relevant methods.

* clean up from pr review

* Appease rubocop

* Update IIIF Print gem

* 🤖 Specify Cache Root

Prior to this commit, we were seeing the following failure:

> Failure/Error: Site.application\_name || super
>
> ActionView::Template::Error:
>  Permission denied @ dir\_s\_mkdir - /app

The `Account#setup_tenant_cache` sets the cache\_store to be
`ENV.fetch('HYKU_CACHE_ROOT', '/app/samvera/file_cache')`.  When I
locally chanced it to `/blorg/samvera/file_cache` I could repeat the
error.

With this commit, we're setting the cache value for the CircleCI run.

Why was it previously working?  Perhaps because
`Account#setup_tenant_cache` never got called due to other
configurations?  There is a guard clause around the method call.

* 🧹 Update spec to reflect AdminSet default behavior

In the following commit, we removed the deprecated
`AdminSet.find_or_create_default_admin_set_id`:

- samvera/hyrax@863c4bc

This commit follows the advice of the deprecation warning and now favors
the `Hyrax::AdminSetCreateService.find_or_create_default_admin_set.id`
method call.

Related to:

- samvera/hyrax#6203

* Remove obsolete site roles and routes (#2080)

The site/roles route is obsolete. This is an attempt to remove as much
of the obsolete logic as possible, as it has been replaced by the groups
with roles feature.

* Remove stanford importer

Importer was deprecated in prior release version.

* 🤖 Fix spec/features/collection_type_spec.rb

There are three major changes:

1. Favor setting `collection_type` attribute instead of
   `collection_type_gid`
2. Change `#collections?` to `#collections#any?`
3. Change CSS selector based on Bootstrap upgrade

The above changes are related to work done in:

- samvera/hyrax#5730
- samvera/hyrax#5742
- samvera/hyrax#4701

See:
- samvera/hyrax@eb6e04e
- samvera/hyrax@237c0c6
- samvera/hyrax@280664b

* 🤖 Fix stub methods to pass tests

These tests weren't verifying that we could reach Redis; they were
testing the interface of the `RedisEndpoint#ping` by mocking the
instance.

This commit changes the mocking by avoiding a call to
`Hyrax::RedisEventStore.instance` which was raising a Redis connection
error.

Again, this test is not is redis connecting but "assume we are trying to
connect to redis now demonstrate ping."

* Lock chromedriver version (#2086)

Refs
CircleCI-Public/browser-tools-orb#96
CircleCI-Public/browser-tools-orb#75 (comment)

* 🧹 Clean up model overrides

Most of what's in this commit is just updating the Hyrax version in the
override comments.  There was also an opportunity to switch the
`ContactForm` model to a decorator.

* 🤖 Favor general spec over specific

With the CircleCI alternate place for the file_store cache, we need to
fallback to a more general test assertion.

* 🤖 Bring over Hyrax spec changes

* 🤖 Extract constant to ease testing

We're not concerned with where the cached file is for testing purposes;
so instead of hard-coding a value that can change in the ENV, let's
compare the constant that we use in the code.

tl;dr - Don't rely on magic strings

* 🤖 Re-arrange CleanupAccountJob specs

The `CleanupAccountJob` was stubbing very nosily; needing to know too
much about implementation details of the end-points.  Instead this
preserves the over-view spec (e.g. what all the cleanup spec actually
cleans up) while moving that nosy logic to the constituent endpoint.

Most of these specs are testing that the method chains work; which is
perhaps adequate as the other option is far more expensive tests (e.g.
make a new Fedora node only to then immediately destroy it)

I'm also leveraging the new `Redis::Namespace#clear` method.

Related to:

- resque/redis-namespace#202

* 🧹 Restore btn-sign-up on splash page

This change was part of the bulk upgrade of Bootstrap 3 to 4.

* 🧹 Fix `./spec/requests/admin_dashboard_spec.rb` spec

Prior to this commit, the specs failed because of the introduction of
the WorkflowResponsibilityFormDecorator.  The decorator extracted prior
logic from Hyrax::Admin::WorkflowRolesController.

In copying that logic we introduced a subtle bug.  Namely, we favored
the original `.new` behavior if and only if you provided a `:user_id`.
This broke places where we instantiated the form in a
view (e.g. `./app/views/hyrax/admin/workflow_roles/index.html.erb`).

With this change, we make the behavior of `.new` fail towards its
"normal" implementation and instead rely on the presence of an attribute
to switch to a different form instantatior.

See Commit:

- 095edca

Related to:

- #2079

Co-authored-by: LaRita Robinson <[email protected]>
Co-authored-by: Kirk Wang <[email protected]>

* 🎁 Upgrade Redis initializer to Hyrax 5's gen version

Prior to this commit, when looking at the
`Hyrax::RedisEventStore.instance` we saw it's connection information as:

`#<Redis client v4.8.1 for redis://localhost:6379/0>`

We were expecting the connection to be the following:

`#<Redis client v4.8.1 for redis://redis:6379/0>`

What we were seeing in tests is when we hit the redis connection we were
getting an error about not being able to connect to 127.0.0.1:6379 (e.g.
localhost).

With this commit, we have a clear connection to Redis.

See Redis Config initializer:

- https://github.com/samvera/hyrax/blob/966951ffaa72524e4a775f8a198bd51a47ece7d9/lib/generators/hyrax/templates/config/initializers/redis_config.rb#L1-L10

Co-authored-by: Kirk Wang <[email protected]>

* 🧹 Clean up actors

Just found one actor that was overriding Hyrax.  This commit will switch
it to a decorator.

* 🐛 Handle missing labels

Adjust paths and keys to look for labels.

* Appease the cops

* 🧹 Assigning collection_type

The partials rendered in the tested view assume that we've set a
collection type.

* Appease rubocop

* Fixing nav link selectors to new structure

* Fixing nav link selectors to new structure

* 🧹 Clean up forms

The only big thing in this commit is the appearance_decorator.  I've
added to the spec to show that the decorator should be working as
intended.

* 🧹 Fix spec based on HTML class changes

* 🧹 Narrow specificity of CSS selector

The selector was *very* specific, and with the HTML class changes for
Bootstrap 3 to 4, this almost certainly broke.

Note, there are still underlying issues with two other specs; there
errors are listed below:

```
1) Admin can select home page theme when a search results theme is
selected updates the search results page with the selected layout view

Failure/Error: super

     ActionView::Template::Error:
       undefined method `with_collection' for nil:NilClass
```

* 🧹 Remove specificity of CSS selectors in test

The hyper specific selectors are not durable for CSS framework upgrades.

* 🐛 Adding document_component to blacklight's config

Blacklight 7.35.0 's default document_component is `nil`, see:

- https://github.com/projectblacklight/blacklight/blob/ac5fa8b300c5ad5c35b1663ef0f15372ffa2be0f/lib/blacklight/configuration.rb#L213
- https://github.com/projectblacklight/blacklight/blob/ac5fa8b300c5ad5c35b1663ef0f15372ffa2be0f/lib/blacklight/configuration.rb#L186

 Digging around in the wiki, you might find (only found because I cloned the repo):

- https://github.com/projectblacklight/blacklight/wiki/Configuration---Results-View

Related to:

- projectblacklight/blacklight#2317

* 🧹 Allow :clean or :clean_repo to work for the cleaners

Hyrax has :clean_repo and Hyku has :clean

Sometimes folks copy over specs from Hyrax, and bring along the
:clean_repo; which looks like it should work.

With this commit, we bring that logic along!

* 🧹 Remove skip CI

Perhaps it's flappy; but let's see.

* 🧹 Fix button class for Bootstrap 3 to 4

* 🧹 Favor Layout/LineLength over Metrics/LineLength

Rubocop seams to prefer the Layout namespace for LineLength.

* 🧹 The selector is not working

Checking the HTML (on the CircleCI SSH environment), it appears that the
selector should work in test.  But it is not.  So I'm removing the specificity.

* Cleaning a spec that should start clean

* 🧹 Ensure feature specs run clean

Prior to this commit, we did not automatically clean the features.  The
below ripgrep (and output) shows that there were some features which did
not start from a clean state.

```
rg "(clean|clean_repo):" spec/features --files-without-match
``

```
spec/features/accounts_spec.rb
spec/features/proprietor_spec.rb
spec/features/featured_collections_spec.rb
spec/features/user_roles_spec.rb
spec/features/oai_pmh_spec.rb
```

* Stab at trying to find a problem

* 🧹 Clean up services

This commit will reconcile the services that are overrides for Hyrax
with the Hyrax 5.0.0rc2 version.  There were a number of overrides that
were changed to the decorator pattern.

* Moving rescue and documenting the why

* 🧹 Rearrange order of filter chain

This is not tested in the UI, but the
`show_works_or_works_that_contain_files` remains after the troublesome
advanced query filters.

* 🧹 Address PR comments

This commit addresses comments from the review but one thing that is of
note is loading the I18n translations in the application.rb file.  We
needed this because our decorators load prior to I18n loads the locales
in our config/locales directory for them to use so we were getting
missing translations.

* 🧹 Attempting to find and squash bug

* ♻️ Account for observed customizations

Dear reviewer, put on your reading glasses.

This commit looks at the newly refactored
`Hyrax::IiifAv::DisplaysContentDecorator` as well as the current state
of [PALS's Hyrax::IiifAv::DisplaysContentDecorator][1] and attempts to
account for the variances between the two by introducing configurations.

Yes, we could port this to the hyrax-iiif_av gem, but for now that would
not solve the underlying issue of how we've been handling things.

Why the Hyku::Application class attribute?  Because the decorator is
being mixed into a module, which does not response to `.class_attribute`
methods.

[1]: https://github.com/scientist-softserv/palni-palci/blob/8754556c0225ce9f04674c1ffac6403586fd65f4/app/presenters/concerns/hyrax/iiif_av/displays_content_decorator.rb

* 🧹 Clean up other overrides

This commit is aiming to clean up the rest of the found overrides.

* 🧹 Change locale file load order so that our local files are prioritized

We add our local config locale directory to the I18n.load_path so that our local files take precendence over the ones found in our gems.

Related issue:
- scientist-softserv/hykuup_knapsack#55

* 🧹 Update IIIF Print and AV gems

We were not seeing images loading correctly in the UV because we
introduced the `Hyku::WorksControllerBehavior` and IIIF Print did not
know about it.
  - scientist-softserv/iiif_print@cad2cf3

We were seeing a respon to mismatch error in the Hyrax IIIF AV.
  - samvera-labs/hyrax-iiif_av@4723b8f

Also, the image that I tested was a phone image that apparently had
different ExifImageHeight/ExifImageWidth values than the
ImageHeight/ImageWidth values.  This was probably because modern phones
typically generate multiple images so the user can choose the best shot.
The exiftool_image_to_fits.xslt was proritizing the Exif values over the
regular values and would cause our image characterization to have weird
height and width values.  The change in this PR prioritizes the regular
over the Exif values.

Ref:
  - scientist-softserv/hykuup_knapsack#68

* 🐛 Fix video thumbnail generation

In a previous commit we created the
`Hyrax::FileSetDerivativesServiceDecorator` to override the default
thumbnails that Hyrax uses but I forgot to add the video thumbnail,
which is fixed here.

Ref
  - scientist-softserv/hykuup_knapsack#69

* 🧹 Add space between thumbnail and title

* 🧹 Update Hyku version

This commit bumps the hyku version from 5.1.0 to 6.0.0.

* 💄 ruboco fix

* 🧹 Fixing a few styles

This commit will change the maximized size to match Bootstrap 4 break
points.  Also, added btn-secondary to hyku.css so it doesn't get
overriden by appearance styles.  Finally, restructured the homepage to
make it look more like Hyrax 5.

* sort properties

* adjust screen size

* 🧹 Update `rails` to `6-1-stable` for GoodJob

There is a compatibility issue with Rails 6.1.7.6 and Ruby 3.2 that was
affecting GoodJob.  There was a backport to the 6-1-stable branch that
fixes this issue.

See:
  - rails/rails#46895

Ref:
  - scientist-softserv/hykuup_knapsack#67

* 🎁 only add Good Job classes if it's enabled

ref:
- #2047 (comment)

* ♻️ Removing file in favor of comments found in docker-compose.yml

Remove file in favor of comments found on lines #138 - 139, which uses the sleep infinity command to accomplish the same thing.

ref:
- https://devopscube.com/keep-docker-container-running/

* 🧹 Remove disabling of Rubocop Naming/PredicateName (#2126)

This cop was originally disabled in order to get specs to run during CI
without code changes. Now that specs are running, the changes can be
safely made to appease rubocop rather than disabling it.

* 🎁 Add Hyrax version in the footer

Often we forget what version of Hyrax we're running so this should help.

---------

Co-authored-by: Rob Kaufman <[email protected]>
Co-authored-by: Shana Moore <[email protected]>
Co-authored-by: LaRita Robinson <[email protected]>
Co-authored-by: Jeremy Friesen <[email protected]>
Co-authored-by: Benjamin Kiah Stroud <[email protected]>
Co-authored-by: LaRita Robinson <[email protected]>
@jeremyf jeremyf mentioned this pull request Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major-ver for release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants