Skip to content

Guard optional plugin specs and modernize Ruby URI parsing - #142

Merged
id774 merged 2 commits into
masterfrom
claude/automatic-ruby-ci-support-x085gb
Aug 14, 2026
Merged

Guard optional plugin specs and modernize Ruby URI parsing#142
id774 merged 2 commits into
masterfrom
claude/automatic-ruby-ci-support-x085gb

Conversation

@id774

@id774 id774 commented Aug 14, 2026

Copy link
Copy Markdown
Owner

Summary

This change guards specs for plugins with optional gem dependencies behind a conditional check, ensuring they only run when their required gems are installed. It also modernizes URI parsing to use URI::RFC2396_Parser directly instead of the deprecated URI::Parser, and updates documentation to clarify the distinction between supported Ruby versions and continuously validated versions.

Key Changes

  • Optional plugin gem handling: Wrapped FilterSanitize and FilterDescriptionLink specs with if AutomaticSpec.optional_dependency?() guards, since these plugins depend on optional gems (sanitize and nkf) not installed by default
  • New test infrastructure: Added OPTIONAL_PLUGIN_GEMS constant and optional_dependency?() method to AutomaticSpec to manage optional plugin dependencies, with clear error messages when gems are missing
  • URI parsing modernization: Replaced deprecated URI::Parser.new.escape() calls with URI::RFC2396_Parser.new.escape() across multiple files (description_link.rb, link.rb, xml.rb, g_guide_spec.rb), which works consistently across all supported Ruby versions
  • Documentation updates:
    • Clarified in POLICY.md that supported Ruby range (3.3-4.0) and CI-validated versions (3.3, 3.4, 4.0) are separate statements
    • Updated REQUIREMENTS.md and README.md to distinguish between supported range and continuously validated versions
    • Added guidance on installing optional plugin gems with BUNDLE_WITH=plugins bundle install
    • Updated DEPLOYMENT.md and PLUGINS.md to document optional plugin dependencies
  • CI workflow updates: Clarified that the matrix validates representative versions rather than every intermediate release, and that optional plugin gems are not installed
  • Code cleanup: Removed unnecessary require 'nokogiri' statements from feed_parser.rb and feed_maker.rb, and updated string literal in opml.rb to use +'' for clarity about mutability

Implementation Details

The optional dependency system works by:

  1. Declaring gems in OPTIONAL_PLUGIN_GEMS list in spec_helper.rb
  2. Specs guard their entire file with if AutomaticSpec.optional_dependency?('gem_name')
  3. Missing gems are tracked and reported, but don't fail the test suite
  4. Operators can install the group with BUNDLE_WITH=plugins bundle install to run all specs

The URI parser change uses URI::RFC2396_Parser, which is the underlying implementation that URI::Parser was reaching, ensuring compatibility across Ruby 3.3-4.0 without version conditionals.

https://claude.ai/code/session_01XTSJZ48Jhsj9rquWgEvAXA

claude added 2 commits August 14, 2026 17:06
Validate 3.3, 3.4 and 4.0 in CI instead of 3.3, 3.4 and 3.5, and state the
supported range and the continuously validated set as two separate facts:
required_ruby_version keeps its lower bound and gains no upper one, so a Ruby
outside the matrix is permitted rather than refused.

Replace the APIs Ruby 3.4 deprecated with the ones the whole supported range
shares, without a RUBY_VERSION branch: URI::Parser#escape, URI.extract and
URI::PATTERN answer through the RFC 3986 parser and report themselves obsolete,
so URI::RFC2396_Parser is named directly. Stop mutating a string literal in the
OPML parser, which Ruby 4.0 warns about.

Correct the direction of the HTML parser dependency. Requiring automatic loaded
nokogiri through FeedMaker, which never used it, and through FeedParser, where
only parse_html does; the dead require is gone and the live one moved into that
method, so the framework loads no HTML parser. nokogiri stays a runtime
dependency because Supported plugins an installed gem must be able to run need
it. nkf and sanitize are each needed by one plugin, so they move to the
Gemfile's optional :plugins group, and a dead require of kconv is deleted.

Keep the optional group out of the default test path. Its gems are a declared
list rather than a discovered load failure, the two specs that need one guard
their file with it and say what is not verified, and installing the group runs
them as part of the ordinary suite.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XTSJZ48Jhsj9rquWgEvAXA
nkf is a plugin's dependency and is no longer declared as a runtime one, so
listing it among the gems the framework requires read as a contradiction.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XTSJZ48Jhsj9rquWgEvAXA
@id774
id774 merged commit e1b44be into master Aug 14, 2026
6 checks passed
@id774
id774 deleted the claude/automatic-ruby-ci-support-x085gb branch August 14, 2026 17:34
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