Skip to content

Remove ActiveSupport dependency from compact index - #6825

Merged
jenshenny merged 1 commit into
masterfrom
compact-index-no-rails
Aug 31, 2026
Merged

Remove ActiveSupport dependency from compact index#6825
jenshenny merged 1 commit into
masterfrom
compact-index-no-rails

Conversation

@jenshenny

@jenshenny jenshenny commented Aug 31, 2026

Copy link
Copy Markdown
Member

Replace Object#present? (ActiveSupport) with a pure-Ruby private predicate in CompactIndex::GemVersionMethods, so the vendored lib/compact_index* files in the client no longer rely on Rails being loaded. The predicate preserves present? semantics for content_address (nil or a non-empty hex string), guarding the empty-string case rather than relying on the host application's model validation invariant.

Ref: ruby/rubygems#9773 (comment)

@jenshenny
jenshenny force-pushed the compact-index-no-rails branch 4 times, most recently from 5557b2d to 148a6ff Compare August 31, 2026 15:17
@jenshenny
jenshenny requested a lite review from Copilot August 31, 2026 15:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Removes the remaining ActiveSupport present? usage from the vendored compact index gem version logic by introducing a pure-Ruby predicate for content_address, keeping lib/compact_index/* usable without Rails loaded.

Changes:

  • Replaced content_address.present? checks with a new private content_address? predicate.
  • Added content_address? to CompactIndex::GemVersionMethods and used it to control version_token formatting and to_line metadata output.
Suppressed comments (1)

lib/compact_index/gem_version.rb:38

  • content_address? does not fully match ActiveSupport present? semantics: whitespace-only strings (e.g. " ") would be treated as present, changing version_token/to_line output and contradicting the PR goal of preserving present? behavior for content_address. Consider treating whitespace-only strings as absent (and handling non-string values safely).
    def content_address?
      !content_address.nil? && !content_address.empty?
    end

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lib/compact_index/gem_version.rb
@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.80%. Comparing base (e2332aa) to head (6f14522).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6825   +/-   ##
=======================================
  Coverage   97.80%   97.80%           
=======================================
  Files         534      534           
  Lines       11771    11773    +2     
=======================================
+ Hits        11513    11515    +2     
  Misses        258      258           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Replace `Object#present?` (ActiveSupport) with a pure-Ruby private predicate in `CompactIndex::GemVersionMethods`, so the vendored `lib/compact_index*` files no longer rely on Rails being loaded. The predicate preserves `present?` semantics for `content_address` (nil or a non-empty hex string), guarding the empty-string case rather than relying on the host application's model validation invariant.

@brian-penguin brian-penguin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Lgtm!

@jenshenny
jenshenny merged commit 572cf89 into master Aug 31, 2026
19 checks passed
@jenshenny
jenshenny deleted the compact-index-no-rails branch August 31, 2026 23:04
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.

3 participants