Skip to content

Drop the ActiveSupport dependency and load on Faraday 2 - #8

Merged
jguecaimburu merged 4 commits into
masterfrom
rails-8-support
Sep 1, 2026
Merged

Drop the ActiveSupport dependency and load on Faraday 2#8
jguecaimburu merged 4 commits into
masterfrom
rails-8-support

Conversation

@jguecaimburu

@jguecaimburu jguecaimburu commented Aug 27, 2026

Copy link
Copy Markdown

Warning: this gem is abandoned. Upstream has one commit since our fork (2023-04), gemspec bounds untouched since 2020, RubyGems release is the old v1 API. Our fork's CI could not run (Ruby 2.5–2.7) and 11 specs have failed since Dec 2024. Every fix here is ours.

Implementation

  • Drop ActiveSupport. It was used for 3 string inflections; TransformHash implements them. Removes the activesupport < 8.0 bound blocking Rails 8.
  • Load on Faraday 2. Drop dependency 'oj' and Faraday::Response::Middleware; require oj; floor faraday >= 1.2.
  • Fix the 11 failing specs. spec/support/cleanup.rb lets 7 cleanup hooks tolerate a 404 on already-deleted resources; 2 examples assert the 404; 2 dead hooks removed. Cassettes unchanged.
  • CI on Ruby 3.3 and 3.4. Dead Lint workflow removed.

Verification

  • 95 examples, 0 failures on Faraday 2.14 and 1.10, locally and in CI.
  • Inflections identical to ActiveSupport on all 345 cassette keys, 20 endpoint names, SparkLoop keys, 300k random strings.
  • Works in a bundle with no ActiveSupport.
  • SparkLoop Docker test env with this branch: real client end-to-end and existing AC specs pass; Bundler no longer blames active_campaign for Rails 8.
  • Two adversarial reviews; both findings fixed.

SparkLoop

bundle lock --update active_campaign after merge. No code changes.

@jguecaimburu jguecaimburu changed the title Support ActiveSupport 8 Drop the ActiveSupport dependency Aug 27, 2026
@jguecaimburu jguecaimburu changed the title Drop the ActiveSupport dependency Drop the ActiveSupport dependency and load on Faraday 2 Aug 27, 2026
ActiveSupport was used for three string inflections: camelize for endpoint module names, lower camelcase for request keys and underscore for response keys. TransformHash implements them with the rules ActiveSupport applies when no acronyms are configured, so the wire format does not depend on the host application inflections or on the ActiveSupport version.

Faraday 2 removed Faraday::Middleware.dependency and Faraday::Response::Middleware, and the gemspec allows faraday below 3.0, so the middleware no longer uses either. Faraday::Middleware dispatches on_complete from 1.2.0, so that is the new floor. The gem requires oj itself since dependency was what loaded it.
The client raises ResourceNotFound on 404. Cleanup hooks that delete a resource the example already deleted tolerate that error, and the two irretrievable examples assert it. The create_pipeline and create_deal_stage hooks read the id from the wrong response key, so they only ever requested a delete with a blank id; they are removed. The recorded cassettes are unchanged.
It ran on Ruby 2.6, where bundler can no longer be installed, so it has not executed rubocop or reek in years and only reports a failure on every push.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Has been broken forever

@@ -1,7 +1,5 @@
# frozen_string_literal: true

require 'active_support/core_ext/string'

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

We are blocked from upgrading because the gem uses a couple of methods to format strings. It's really a huge overkill

Comment on lines +70 to +78
#
# Changes the case of a string
#
# @param [String] string the string to change
# @param [Symbol] style `:underscore` or `:camelcase`
# @param [Symbol] first_letter `:upper` or `:lower`, only used by `:camelcase`
#
# @return [String]
#

@jguecaimburu jguecaimburu Aug 27, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This is all we need to avoid that dependency.

This gem has been abandoned for +2 years, at some point it might be a lot easier to simply refactor it into a client we own with a lot fewer moving parts. Leaving that for future adventures.

Comment thread spec/support/cleanup.rb
Comment on lines +3 to +4
# The client raises ResourceNotFound on 404, and cleanup hooks often delete a
# resource the example itself already deleted.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

We made this change on the fork long time ago and never fixed specs

@jguecaimburu
jguecaimburu merged commit 03185f2 into master Sep 1, 2026
4 checks passed
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.

2 participants