-
Notifications
You must be signed in to change notification settings - Fork 3
Description
ISSUE
Back in the day, community members created a gem to ease managing deprecation warnings (see https://rubygems.org/gems/deprecation). Since that time Rails has incorporated direct support for managing deprecation warnings. Unfortunately the call signature has changed and we have a mix of old and new style calls throughout the codebase. When the wrong signature is called, we only get a very generic warning:
Warning using wrong call signature
DEPRECATION WARNING: You are using deprecated behavior which will be removed from the next major or minor release.
(called from <class:Work> at /app/samvera/hyrax-engine/app/models/hyrax/work.rb:98)
Warning using the correct call signature
DEPRECATION WARNING: globally including `Hyrax::Schema(:core_metadata)` at the work level is deprecated.
Add `include Hyrax::Schema(:core_metadata)` to your individual work classes or set
up flexible metadata, then set `work_default_metadata = false` in config/hyrax.rb to remove this warning.
(called from <class:Work> at /app/samvera/hyrax-engine/app/models/hyrax/work.rb:98)
Now that Rails provides the required functionality directly, we need to retire the dependency on the deprecation gem.
DETAILS
-
Old signature takes 3 positional arguments:
https://github.com/cbeer/deprecation/blob/v1.1.0/lib/deprecation/reporting.rb#L12def warn(context, message = nil, callstack = nil) -
New signature only takes 2 arguments(so positions change):
https://github.com/rails/rails/blob/v6.0.0/activesupport/lib/active_support/deprecation/reporting.rb#L18def warn(message = nil, callstack = nil)
SCOPE OF WORK
Listing the dependencies from Hyrax (and presumably Hyku), a number of gems include the old dependency:
# bundle info deprecation
* deprecation (1.1.0)
Summary: Stand-alone deprecation library borrowed from ActiveSupport::Deprecation
Homepage: http://github.com/cbeer/deprecation
Path: /app/bundle/ruby/3.3.0/gems/deprecation-1.1.0
Reverse Dependencies:
active-fedora (15.0.1) depends on deprecation (>= 0)
blacklight (7.41.0) depends on deprecation (>= 0)
blacklight-access_controls (6.1.0) depends on deprecation (~> 1.0)
hydra-access-controls (13.2.0) depends on deprecation (~> 1.0)
hydra-derivatives (4.0.0) depends on deprecation (>= 0)
ldp (1.2.1) depends on deprecation (>= 0)
qa (5.15.0) depends on deprecation (>= 0)
riiif (2.8.0) depends on deprecation (>= 1.0.0)
ACCEPTANCE
- Interim fix
- Add a patch to hyrax to infer the correct method signature
- Update call signatures in Hyrax to match rails expectations
- Update call signatures in Hyku to match rails expectations
- Remove the dependency and update call signatures in
riiif - Remove the dependency and update call signatures in
qa - Remove the dependency and update call signatures in
ldp - Remove the dependency and update call signatures in
hydra-derivatives - Remove the dependency and update call signatures in
hydra-access-controls - Remove the dependency and update call signatures in
blacklight-access-controls - Remove the dependency and update call signatures in
active-fedora - Remove the dependency and update call signatures in
blacklight
NOTE: this is addressed in Blacklight 8.x - see Replace deprecation gem with ActiveSupport's deprecation behavior projectblacklight/blacklight#2793 - Once all the dependencies are removed, and the old gem is no longer included in Hyrax by transitive dependency, remove the signature patch in Hyrax
Metadata
Metadata
Assignees
Labels
Type
Projects
Status