Skip to content

Upgrade: Ruby 3.1 → 4.0#221

Merged
kaysiz merged 8 commits intomasterfrom
ks-ruby-4-upgrade
Mar 12, 2026
Merged

Upgrade: Ruby 3.1 → 4.0#221
kaysiz merged 8 commits intomasterfrom
ks-ruby-4-upgrade

Conversation

@kaysiz
Copy link
Member

@kaysiz kaysiz commented Mar 4, 2026

Purpose

closes: Add github issue that originated this PR

Approach

Open Questions and Pre-Merge TODOs

Learning

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

  • New feature (non-breaking change which adds functionality)

  • Breaking change (fix or feature that would cause existing functionality to change)

Reviewer, please remember our guidelines:

  • Be humble in the language and feedback you give, ask don't tell.
  • Consider using positive language as opposed to neutral when offering feedback. This is to avoid the negative bias that can occur with neutral language appearing negative.
  • Offer suggestions on how to improve code e.g. simplification or expanding clarity.
  • Ensure you give reasons for the changes you are proposing.

Summary by CodeRabbit

Release Notes v2.6.0

  • New Features

    • Added support for Ruby 4.0 compatibility.
  • Chores

    • Minimum Ruby version requirement raised to 3.2; Ruby 3.1 no longer supported.
    • Updated multiple core dependencies including activesupport, citeproc-ruby, and csl-styles for enhanced stability.
    • Removed deprecated postrank-uri dependency.
    • Improved internal URI normalization handling for better URL consistency.

@kaysiz kaysiz self-assigned this Mar 4, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 4, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Updated Bolognese gem to support Ruby 3.2–4.0, modernized dependencies (activesupport, citeproc-ruby, csl-styles, concurrent-ruby, vcr, webmock), removed postrank-uri dependency, refactored URI normalization logic, bumped version to 2.6.0, and updated test expectations for citation output.

Changes

Cohort / File(s) Summary
CI Workflows
.github/workflows/ci.yml, .github/workflows/release.yml
Expanded Ruby test matrix to include 3.2, 3.3, 3.4, and 4.0 (removed 3.1); updated release workflow to use Ruby 4.0.1.
Gem Configuration
bolognese.gemspec, lib/bolognese/version.rb
Bumped version to 2.6.0; updated Ruby requirement to >= 3.2, < 4.1; upgraded maremma, activesupport, citeproc-ruby, csl-styles, concurrent-ruby, vcr, webmock; removed postrank-uri; added csv and irb dependencies.
Core Library Cleanup
lib/bolognese.rb, lib/bolognese/author_utils.rb, lib/bolognese/metadata_utils.rb
Removed requires for postrank-uri, benchmark_methods, and citeproc/ruby; cleaned up commented benchmark instrumentation directives.
URI Normalization Refactor
lib/bolognese/utils.rb
Replaced PostRank\::URI.clean() calls with new private helper normalize_uri_with_path_cleanup() that normalizes URI and trims trailing slashes from paths in normalize_id() and normalize_url() methods.
Reader Dependencies
lib/bolognese/readers/datacite_reader.rb
Added require 'base64' for Base64 decoding operations.
Test Updates
spec/writers/citation_writer_spec.rb
Updated citation expectations to reflect dependency version changes and wording adjustments across multiple styles (Chicago, APA, Vancouver, IEEE, MLA); changed Dryad label from "Data set" to "Dataset"; updated Chicago style from fullnote-bibliography to notes-bibliography.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: upgrading Ruby from version 3.1 to 4.0, which is reflected across CI configuration, gemspec, and development workflow files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ks-ruby-4-upgrade
📝 Coding Plan for PR comments
  • Generate coding plan

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
Gemfile (1)

3-3: Pin the git dependency to an immutable ref.
Line 3 tracks a moving branch, which makes builds non-reproducible and brittle if the branch is force-pushed or deleted.

Suggested change
-gem 'maremma', '~> 5.0', git: 'https://github.com/datacite/maremma.git', branch: 'ks-ruby-4-upgrade'
+gem 'maremma', '~> 5.0', git: 'https://github.com/datacite/maremma.git', ref: '<commit-sha>'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Gemfile` at line 3, The Gemfile currently pins maremma to a moving branch via
the gem declaration gem 'maremma', '~> 5.0', git:
'https://github.com/datacite/maremma.git', branch: 'ks-ruby-4-upgrade'; update
this to pin to an immutable ref by replacing the branch: 'ks-ruby-4-upgrade'
with a ref: '<COMMIT_SHA>' (or a tagged version) so the gem line references a
specific commit SHA, ensuring reproducible builds.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@bolognese.gemspec`:
- Line 16: Update the gemspec's Ruby version constraint to allow the full 4.0
minor series by replacing the upper bound on s.required_ruby_version;
specifically change the current constraint that uses "<= 4.0.1" to use "< 4.1"
so s.required_ruby_version becomes ['>= 3.2', '< 4.1'], ensuring patch releases
in 4.0.x are permitted while still preventing 4.1+ upgrades.
- Line 19: Restore the maremma runtime dependency in the gemspec by re-adding
the add_dependency entry for maremma (with an appropriate version constraint,
e.g., ~> 5.0) and ensure it is not commented out so the gemspec declares maremma
as a runtime dependency; this will allow the require in lib/bolognese.rb (line
with require 'maremma') and all usages in utils.rb, datacite_reader.rb,
npm_reader.rb, schema_org_reader.rb, etc., to work when the gem is installed
from RubyGems.

---

Nitpick comments:
In `@Gemfile`:
- Line 3: The Gemfile currently pins maremma to a moving branch via the gem
declaration gem 'maremma', '~> 5.0', git:
'https://github.com/datacite/maremma.git', branch: 'ks-ruby-4-upgrade'; update
this to pin to an immutable ref by replacing the branch: 'ks-ruby-4-upgrade'
with a ref: '<COMMIT_SHA>' (or a tagged version) so the gem line references a
specific commit SHA, ensuring reproducible builds.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3070d29f-40a0-4542-8c41-6c397f0da86f

📥 Commits

Reviewing files that changed from the base of the PR and between 7dc29da and 30d1a7a.

⛔ Files ignored due to path filters (1)
  • Gemfile.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • .github/workflows/ci.yml
  • .github/workflows/release.yml
  • Gemfile
  • bolognese.gemspec
  • lib/bolognese/version.rb

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@bolognese.gemspec`:
- Around line 29-30: The gemspec dependency bump to citeproc-ruby (~> 2.1, >=
2.1.8) and csl-styles (~> 2.0, >= 2.0.2) may pull in CSL 2.x breaking changes;
inspect any code that interacts with CSL APIs (search for uses of citeproc-ruby
rendering code and places that build CSL items/variables or validate CSL
documents), update handling for new item types (e.g., software, dataset,
standard, periodical), variable/license defaults, and schema expectations, then
run the full test suite and fix failing examples/formatting outputs;
specifically review code paths that construct CSL items or call citeproc-ruby
render methods and adjust mappings/validation so output remains consistent
before finalizing the dependency upgrade.

In `@lib/bolognese/utils.rb`:
- Around line 671-673: The current code strips a trailing slash from the
serialized URL (variable normalized_url) which can remove slashes in query or
fragment; instead, after calling uri.normalize, modify only the URI path (e.g.
remove a trailing '/' from uri.path) and then serialize to string so query and
fragment are preserved; update the block using uri.normalize and normalized_url
to mutate uri.path (not normalized_url) before calling to_s—this will fix
downstream consumers like normalize_id and calls into Maremma.get in
npm_reader.rb and schema_org_reader.rb.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7b503d6c-5d79-46e5-99b6-71e15885e44d

📥 Commits

Reviewing files that changed from the base of the PR and between 30d1a7a and 659520c.

⛔ Files ignored due to path filters (1)
  • Gemfile.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • bolognese.gemspec
  • lib/bolognese.rb
  • lib/bolognese/author_utils.rb
  • lib/bolognese/metadata_utils.rb
  • lib/bolognese/readers/datacite_reader.rb
  • lib/bolognese/utils.rb
  • spec/writers/citation_writer_spec.rb
💤 Files with no reviewable changes (3)
  • lib/bolognese/metadata_utils.rb
  • lib/bolognese.rb
  • lib/bolognese/author_utils.rb
✅ Files skipped from review due to trivial changes (1)
  • lib/bolognese/readers/datacite_reader.rb

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
bolognese.gemspec (1)

19-19: ⚠️ Potential issue | 🔴 Critical

Re-enable maremma in the gemspec.

The gem still loads maremma immediately in lib/bolognese.rb:5, and core paths use Maremma.from_json, Maremma.from_xml, and Maremma.get in lib/bolognese/utils.rb:572-584, lib/bolognese/readers/datacite_json_reader.rb:10, and lib/bolognese/readers/crossref_reader.rb:18. Leaving this dependency commented out means the published gem can install without a library it requires at load time.

Proposed fix
-  # s.add_dependency 'maremma', '~> 5.0' # update this to the latest version when available on RubyGems
+  s.add_dependency 'maremma', '~> 5.0'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bolognese.gemspec` at line 19, Uncomment and re-add the maremma runtime
dependency in the gemspec so the gem installs the library it requires at load
time: restore the s.add_dependency 'maremma', '~> 5.0' (or update to the latest
compatible version) so require 'maremma' in lib/bolognese.rb and calls to
Maremma.from_json / Maremma.from_xml / Maremma.get used in
lib/bolognese/utils.rb, lib/bolognese/readers/datacite_json_reader.rb, and
lib/bolognese/readers/crossref_reader.rb will be present when the gem is
installed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@bolognese.gemspec`:
- Line 19: Uncomment and re-add the maremma runtime dependency in the gemspec so
the gem installs the library it requires at load time: restore the
s.add_dependency 'maremma', '~> 5.0' (or update to the latest compatible
version) so require 'maremma' in lib/bolognese.rb and calls to Maremma.from_json
/ Maremma.from_xml / Maremma.get used in lib/bolognese/utils.rb,
lib/bolognese/readers/datacite_json_reader.rb, and
lib/bolognese/readers/crossref_reader.rb will be present when the gem is
installed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: efd60d4e-4bf4-4af7-85da-cda4ea58270c

📥 Commits

Reviewing files that changed from the base of the PR and between d351fa3 and 132dcfa.

📒 Files selected for processing (2)
  • bolognese.gemspec
  • lib/bolognese/utils.rb

@kaysiz kaysiz requested a review from a team March 12, 2026 09:45
@kaysiz kaysiz requested review from a team and jrhoads March 12, 2026 13:50
@kaysiz kaysiz merged commit c770ccf into master Mar 12, 2026
6 checks passed
@kaysiz kaysiz deleted the ks-ruby-4-upgrade branch March 12, 2026 14:17
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