Skip to content

Ruby: Support Herb in Ractors - #2261

Draft
joelhawksley wants to merge 3 commits into
marcoroth:mainfrom
joelhawksley:joelhawksley-ractor-support
Draft

Ruby: Support Herb in Ractors#2261
joelhawksley wants to merge 3 commits into
marcoroth:mainfrom
joelhawksley:joelhawksley-ractor-support

Conversation

@joelhawksley

Copy link
Copy Markdown
Contributor

Summary

  • mark the Ruby native extension as Ractor-safe
  • exercise parsing, lexing, extraction, diffing, and version access concurrently
  • support both the legacy and Ruby 4 Ractor result APIs in the test

Testing

  • bundle exec ruby -Itest test/herb_test.rb on Ruby 3.3.12
  • bundle exec ruby -Itest test/herb_test.rb on Ruby 4.0.6
  • bundle exec rake test on Ruby 4.0.6
  • bundle exec rubocop test/herb_test.rb --format quiet

Mark the native extension as Ractor-safe and cover concurrent use of its public entry points.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3961363f-e675-400a-949d-d7fc8366193b
@github-actions github-actions Bot added c C source for the core parser, lexer, and AST c-extension Ruby C extension in ext/ labels Aug 17, 2026
@joelhawksley
joelhawksley marked this pull request as ready for review August 17, 2026 20:55
@marcoroth marcoroth changed the title Support Herb in Ractors Ruby: Support Herb in Ractors Aug 18, 2026
@marcoroth marcoroth added ruby Ruby source for the gem and its libraries rubygem The herb RubyGem and its packaging labels Aug 18, 2026

@marcoroth marcoroth left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Hey @joelhawksley, I'm not sure if we can just set rb_ext_ractor_safe(true) without changing anything about the code.

Ractor-safety wasn't in the scope of my thinking when I designed the parser and the Ruby C-Extension. So I'm not certain that it's just compatible as-is.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@joelhawksley

Copy link
Copy Markdown
Contributor Author

@marcoroth I'll move this back to draft and investigate further. I was poking around at various ways of speeding up our usage of ActionView::Precompiler with Herb 鉂わ笍. For what it's worth, I was able to use Herb in Ractors successfully.

@joelhawksley
joelhawksley marked this pull request as draft August 18, 2026 19:27
@marcoroth

Copy link
Copy Markdown
Owner

Thanks @joelhawksley, that's valuable feedback and makes this decision a bit easier down the road!

I know that @geeksilva97 mentioned to me at RubyConf a few weeks ago that he found some issues with Ractors and Herb. Edy, would you mind elaborating what you found? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c C source for the core parser, lexer, and AST c-extension Ruby C extension in ext/ ruby Ruby source for the gem and its libraries rubygem The herb RubyGem and its packaging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants