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

fix: chromedriver versions not installing #96

Merged
merged 1 commit into from
Sep 13, 2023

Conversation

ryanbourdais
Copy link
Contributor

@ryanbourdais ryanbourdais commented Sep 12, 2023

This fixes the new issue arisen in #95 with chromedriver installs now failing again. This issue was caused by the timestamp output of [this endpoint](this endpoint) containing a string that matched the major version of stable.
Output:

{"timestamp":"2023-09-12T18:09:06.116Z","milestones":{"113":{"milestone":"113","version":"113.0.5672.63","revision":"1121455"},"114":{"milestone":"114","version":"114.0.5735.133","revision":"1135570"},"115":{"milestone":"115","version":"115.0.5790.170","revision":"1148114"},"116":{"milestone":"116","version":"116.0.5845.96","revision":"1160321"},"117":{"milestone":"117","version":"117.0.5938.62","revision":"1181205"},"118":{"milestone":"118","version":"118.0.5993.3","revision":"1192594"},"119":{"milestone":"119","version":"119.0.6004.0","revision":"1194959"}}}

Version 116.0.5845.96 is stable at the moment so the logic would latch onto the string 2023-09-12T18:09:06.116Z in the timestamp. These changes leverage that the output surrounds the milestone versions in double quotes,
for example:

"116":{"milestone":"116","version":"116.0.5845.96","revision":"1160321"}

and now has logic that grabs the version only when we find a match of the matching chrome major version and the milestone.

@ryanbourdais ryanbourdais requested a review from a team as a code owner September 12, 2023 19:44
Copy link

@tabfugnic tabfugnic 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.

src/scripts/install-chromedriver.sh Outdated Show resolved Hide resolved
Copy link

@hoylemd hoylemd left a comment

Choose a reason for hiding this comment

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

looks like it works in theory, I tested it by running these commands in my shell

'before'

CHROME_DRIVER_VERSION=116
curl https://googlechromelabs.github.io/chrome-for-testing/latest-versions-per-milestone.json | grep -o "$CHROME_VERSION_MAJOR.*" | grep -o "version.*" | sed 's/version":"//' | sed 's/".*//'

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 567 100 567 0 0 1579 0 --:--:-- --:--:-- --:--:-- 1601
113.0.5672.63

'after':

CHROME_DRIVER_VERSION=116
CHROME_DRIVER_VERSION=\"${CHROME_DRIVER_VERSION}\"
curl https://googlechromelabs.github.io/chrome-for-testing/latest-versions-per-milestone.json | grep -o "$CHROME_VERSION_MAJOR.*" | grep -o "version.*" | sed 's/version":"//' | sed 's/".*//'

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 567 100 567 0 0 1818 0 --:--:-- --:--:-- --:--:-- 1846
116.0.5845.96

(running in zsh)

I'd approve but I don't have permissions :p

@hoylemd
Copy link

hoylemd commented Sep 12, 2023

@ryanbourdais it's CHROME_VERSION_MAJOR, not CHROME_MAJOR_VERSION 😜 (whether it should be is another matter :p)

@ryanbourdais
Copy link
Contributor Author

@ryanbourdais it's CHROME_VERSION_MAJOR, not CHROME_MAJOR_VERSION 😜 (whether it should be is another matter :p)

yea, I'm glad you mentioned that, I had copied it from my response to @karlentwistle instead of using my IDE's autocomplete

@hoylemd
Copy link

hoylemd commented Sep 12, 2023

I gochu bro ❤️

@ryanbourdais ryanbourdais force-pushed the fix--chromedriver-versions-not-installing branch from b0d5fd5 to 65fee6f Compare September 12, 2023 20:17
@neospeed83
Copy link

Thanks for the rapid resolution @ryanbourdais.

@rolandcrosby-columntax
Copy link

Thanks for the fix. When do you plan to cut a release that includes this change?

@ryanbourdais
Copy link
Contributor Author

@rolandcrosby-columntax as soon as this PR is approved internally and merged in I'll cut a new patch release

@ryanbourdais ryanbourdais merged commit 62fdb2b into main Sep 13, 2023
2 checks passed
@ryanbourdais ryanbourdais deleted the fix--chromedriver-versions-not-installing branch September 13, 2023 20:49
laritakr added a commit to samvera/hyku that referenced this pull request Dec 20, 2023
There is an apparent issue with chromedriver installation when
there is a new release of chrome that doesn't have a corresponding
version of chromedriver.

Orb 1.4.6 release was supposed to fix this but we are once again
seeing the error, so we are attempting to lock the crome version to
see if we can bypass this error.

Refs
CircleCI-Public/browser-tools-orb#96
CircleCI-Public/browser-tools-orb#75 (comment)
ShanaLMoore added a commit to samvera/hyku 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 <larita@scientist.com>

* 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 <larita@scientist.com>
Co-authored-by: Kirk Wang <kirk.wang@scientist.com>

* 🎁 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 <kirk.wang@scientist.com>

* 🧹 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 <rob@notch8.com>
Co-authored-by: Shana Moore <shana@scientist.com>
Co-authored-by: LaRita Robinson <larita@scientist.com>
Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>
Co-authored-by: Benjamin Kiah Stroud <32469930+bkiahstroud@users.noreply.github.com>
Co-authored-by: LaRita Robinson <laritakr@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants