Skip to content

Drop dead rdoc/markdown handling from rubygems plugin#1700

Merged
st0012 merged 2 commits intoruby:masterfrom
st0012:claude/investigate-rdoc-issue-ibDnz
May 7, 2026
Merged

Drop dead rdoc/markdown handling from rubygems plugin#1700
st0012 merged 2 commits intoruby:masterfrom
st0012:claude/investigate-rdoc-issue-ibDnz

Conversation

@st0012
Copy link
Copy Markdown
Member

@st0012 st0012 commented May 7, 2026

lib/rubygems_plugin.rb carries a begin / rescue LoadError / else block around require_relative 'rdoc/markdown', gating hook registration on the require succeeding. The accompanying comment explains the guard exists because markdown.rb used to be kpeg-generated during bundle install and could be absent mid-bootstrap.

That window no longer exists. lib/rdoc/markdown.rb is generated and committed, and RDoc::RubyGemsHook doesn't reference RDoc::Markdown itself — any markdown source actually encountered during doc generation is loaded lazily by the parser dispatcher. So both the guard and the require it gated are dead code.

This drops both, and as a side effect skips parsing ~16k LOC of kpeg-generated parser on every gem CLI invocation and every bundle install resolution path.

claude added 2 commits May 7, 2026 03:20
lib/rdoc/markdown.rb is now generated and committed, so the
LoadError-handling workaround that delayed hook registration when
markdown.rb was absent during rdoc's own `bundle install` is no longer
needed. Require markdown unconditionally and register the hooks at
top level.

https://claude.ai/code/session_01UJr3jZWKpHhtJvdvmSSzzB
The require existed only to gate hook registration via `rescue
LoadError` (the previous commit's bootstrap workaround).  Once that
gate is gone, requiring rdoc/markdown at plugin-load time is dead
weight — RDoc::RubyGemsHook never references RDoc::Markdown directly,
and any markdown sources actually encountered during doc generation
are loaded lazily by the parser dispatcher.

https://claude.ai/code/session_01UJr3jZWKpHhtJvdvmSSzzB
Copilot AI review requested due to automatic review settings May 7, 2026 03:42
@st0012 st0012 deployed to fork-preview-protection May 7, 2026 03:42 — with GitHub Actions Active
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes a now-unnecessary begin/rescue LoadError guard and the eager require_relative 'rdoc/markdown' from the RubyGems plugin, since lib/rdoc/markdown.rb is present in-repo and Markdown parsing is loaded lazily when actually needed. This reduces RubyGems startup overhead by avoiding loading the large kpeg-generated Markdown parser during gem/Bundler operations.

Changes:

  • Drop the guarded require_relative 'rdoc/markdown' from lib/rubygems_plugin.rb.
  • Register Gem.done_installing and Gem.pre_uninstall hooks unconditionally.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@st0012
Copy link
Copy Markdown
Member Author

st0012 commented May 7, 2026

In the next PR, I will move require into the hooks so we can partially mitigate #1609 and also speed things up

@matzbot
Copy link
Copy Markdown
Collaborator

matzbot commented May 7, 2026

🚀 Preview deployment available at: https://b33421c8.rdoc-6cd.pages.dev (commit: 4ae08f2)

@st0012 st0012 merged commit 8b8dc55 into ruby:master May 7, 2026
45 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.

4 participants