Skip to content

Declare rexml in the test bundle - #3058

Merged
ericproulx merged 1 commit into
masterfrom
fix/declare-rexml-dependency
Nov 6, 2026
Merged

ericproulx merged 1 commit into
masterfrom
fix/declare-rexml-dependency

Conversation

@ericproulx

@ericproulx ericproulx commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Without multi_xml, Grape parses XML with ActiveSupport::XmlMini (lib/grape/xml.rb), whose default backend does require 'rexml/document'. rexml has been a bundled gem rather than a default one since Ruby 3.0, so under Bundler it loads only when the bundle holds it.

Nothing in the Gemfile asks for it. Grape's XML specs pass today only because Danger's kramdown dependency brings rexml into the test bundle. With Danger's gems removed (as #3057 does), 18 specs fail with:

LoadError: cannot load such file -- rexml/document

This declares rexml in the :test group, so the specs no longer lean on Danger. It is deliberately not a runtime dependency: an app that parses XML without multi_xml brings rexml itself.

#3057 adds the same three lines, so whichever merges second drops its copy.

Test plan

  • bundle exec rake: RuboCop clean, 3184 examples, 0 failures.
  • With Danger's gems removed from the Gemfile (so no kramdown), the three spec files that had the 18 failures pass: 717 examples, 0 failures.
  • CI green.

🤖 Generated with Claude Code

@ericproulx
ericproulx force-pushed the fix/declare-rexml-dependency branch from 9911683 to b36bb5f Compare November 6, 2026 17:51
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Danger Report

No issues found.

View run

Without multi_xml, Grape parses XML with ActiveSupport::XmlMini, whose
default backend requires rexml/document. rexml has been a bundled gem
rather than a default one since Ruby 3.0, so under Bundler it loads only
when the bundle holds it. Nothing in the Gemfile asked for it: Grape's
XML specs passed only because Danger's kramdown dependency brought it
in. Without Danger they fail with

    LoadError: cannot load such file -- rexml/document

The :test group now declares it, so the specs no longer depend on
Danger. It stays out of the gemspec: an app that parses XML without
multi_xml brings rexml itself.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@ericproulx
ericproulx force-pushed the fix/declare-rexml-dependency branch from b36bb5f to f63ec16 Compare November 6, 2026 17:53
@ericproulx ericproulx changed the title Add rexml as a dependency Declare rexml in the test bundle Nov 6, 2026
@ericproulx
ericproulx merged commit 60cc85d into master Nov 6, 2026
70 checks passed
@ericproulx
ericproulx deleted the fix/declare-rexml-dependency branch November 6, 2026 17:56
ericproulx added a commit that referenced this pull request Nov 6, 2026
Danger ran one check, `changelog.check!`, and cost far more than that:

* 29 of the 91 gems in the lockfile (octokit, faraday, git, kramdown and
  their dependencies) were there only for it. They sat in the :test group,
  which every gemfile evals, so every CI job and every local bundle
  installed them, and #3045 had to pin `git < 6` to keep it loading.
* Its two workflows called a third-party reusable workflow, pinned by tag,
  with `secrets: inherit`.
* It parsed the whole of CHANGELOG.md, so it failed pull requests on
  entries merged years before, and it failed every pull request opened with
  the `#PR` placeholder AGENTS.md asks for until the number was filled in.

.github/scripts/check_changelog.rb replaces it. It needs nothing but Ruby
and git, so .github/workflows/changelog.yml installs no bundle and uses no
secret. It reads the lines the pull request adds to CHANGELOG.md:

* a new entry must be `* [#N](https://github.com/ruby-grape/grape/pull/N):
  Description - [@user](https://github.com/user).`, with N this pull
  request's number; an edited entry keeps the number it was merged with;
* a `#PR` or `#XXXX` placeholder is a warning, not a failure;
* `* Your contribution here.` stays the last line of each section of the
  unreleased version;
* a pull request that changes more than Markdown files without touching
  CHANGELOG.md gets a warning, as it did with Danger.

Problems are annotations on the CHANGELOG line. RuboCop skips hidden
directories, so .rubocop.yml now includes .github/**/*.rb.

Removing Danger also takes kramdown out of the bundle, which was the only
thing bringing in rexml, the parser ActiveSupport::XmlMini needs for XML
when multi_xml is absent. #3058 declared rexml in the :test group, so the
XML specs no longer depend on Danger.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.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.

1 participant