rbs-merge v2.0.0 released!
2.0.0 - 2026-02-19
- TAG: v2.0.0
- COVERAGE: 72.31% – 713/986 lines in 12 files
- BRANCH COVERAGE: 39.77% – 208/523 branches in 12 files
- 98.63% documented
Added
- AGENTS.md
- Dependency Tags Support: Added
spec/support/dependency_tags.rbto load shared dependency tags from tree_haver and ast-merge. This enables automatic exclusion of tests when required backends or dependencies are not available.- Tests tagged with
:ffi_backend,:java_backend,:rust_backendare now properly excluded when those backends aren’t available - Tests tagged with
:rbs_grammarare excluded when tree-sitter-rbs isn’t available - Tests tagged with
:rbs_parsingwork with any available RBS parsing backend
- Tests tagged with
- FFI backend isolation for test suite
- Added
bin/rspec-ffiscript to run FFI specs in isolation (before MRI backend loads) - Added
spec/spec_ffi_helper.rbfor FFI-specific test configuration - Updated Rakefile with
ffi_specsandremaining_specstasks - The
:testtask now runs FFI specs first, then remaining specs
- Added
- BackendRegistry Integration: RbsBackend now registers its availability checker with
TreeHaver::BackendRegistry- Enables
TreeHaver::RSpec::DependencyTagsto detect RBS backend availability without hardcoded checks - Called automatically when backend is loaded:
TreeHaver::BackendRegistry.register_availability_checker(:rbs)
- Enables
- TreeHaver backend integration - rbs-merge now uses TreeHaver for all parsing,
enabling cross-platform RBS parsing:
Rbs::Merge::Backends::RbsBackend- New TreeHaver-compatible backend module that wraps the RBS gem. Registered with TreeHaver viaregister_language(:rbs, ...).- On MRI: Uses RBS gem backend (richer AST, comment association)
- On JRuby: Uses tree-sitter-rbs via TreeHaver’s Java backend
- Backend selection respects
TreeHaver.with_backend()andTREE_HAVER_BACKENDenv var
NodeWrapper#comment- Delegates to underlying RBS gem node’s comment for leading comment association (RBS gem backend only)FileAnalysis#compute_tree_sitter_signature- Generates signatures for raw TreeHaver::Node objects from tree-sitter backendFileAnalysis#extract_tree_sitter_node_name- Extracts declaration names from tree-sitter nodes by traversing child nodesnode_typingparameter for per-node-type merge preferences- Enables
preference: { default: :destination, special_type: :template }pattern - Works with custom merge_types assigned via node_typing lambdas
- Enables
match_refinerparameter for fuzzy matching supportregionsandregion_placeholderparameters for nested content merging
Changed
- appraisal2 v3.0.6
- kettle-test v1.0.10
- stone_checksums v1.0.3
- ast-merge v4.0.6
- tree_haver v5.0.5
- tree_stump v0.2.0
- fork no longer required, updates all applied upstream
- Updated documentation on hostile takeover of RubyGems
- https://dev.to/galtzo/hostile-takeover-of-rubygems-my-thoughts-5hlo
- RbsBackend refactored to use TreeHaver::Base classes
RbsBackend::Languagenow inherits fromTreeHaver::Base::LanguageRbsBackend::Parsernow inherits fromTreeHaver::Base::ParserRbsBackend::Treenow inherits fromTreeHaver::Base::TreeRbsBackend::Nodenow inherits fromTreeHaver::Base::Node- Consistent API across all merge gem backends
- Tree-sitter grammar registration -
register_backend!now registers both:- The RBS gem backend (Ruby-based parser, MRI only)
- The tree-sitter-rbs grammar path (for native tree-sitter backends)
- This enables
TreeHaver.parser_for(:rbs)to use tree-sitter when available
- FileAnalysis now uses TreeHaver exclusively - Removed separate backend selection
logic.
parse_rbsnow callsTreeHaver.parser_for(:rbs)which handles all backend selection automatically. node_start_line/node_end_linehelpers - Now check forstart_line/end_linemethods first (TreeHaver::Node has these), falling back tolocationorstart_point.ConflictResolver#declarations_identical?- Now compares text content instead of relying on object equality, enabling cross-backend comparison.ConflictResolver#canonical_type- Now handles TreeHaver::Node objects in addition to NodeWrapper and RBS gem nodes.ConflictResolver#has_members?- Now checks formemberschild nodes in TreeHaver::Node objects for tree-sitter backend support.ConflictResolver#resolve- Now checks for template freeze blocks first, ensuring frozen content from templates is preserved during merge.FileAligner#build_signature_map- FreezeNodes are now indexed by both their own signature AND the signatures of their contained nodes. This allows freeze blocks to match against the non-frozen version of the same declaration in the other file.MergeResult#add_freeze_block- Now uses the freeze_node’s own analysis for line extraction, ensuring template freeze blocks use template lines (not destination lines).SmartMerger#process_match- Now handles template FreezeNodes correctly, adding them viaadd_freeze_blockwhen the template side wins.SmartMerger#process_template_only- FreezeNodes from template are now always added (they represent protected content that must be preserved).- SmartMerger: Added
**optionsfor forward compatibility- Accepts additional options that may be added to base class in future
- Passes all options through to
SmartMergerBase
- ConflictResolver: Added
**optionsfor forward compatibility - MergeResult: Added
**optionsfor forward compatibility - BREAKING:
SmartMergernow inherits fromAst::Merge::SmartMergerBase- Provides standardized options API consistent with all other
*-mergegems - Gains automatic support for new SmartMergerBase features
max_recursion_depthparameter is still supportedpreferencenow accepts Hash for per-type preferences
- Provides standardized options API consistent with all other
Removed
FileAnalysis#rbs_gem_available?- Removed; TreeHaver handles backend availabilityFileAnalysis#parse_with_rbs_gem- Removed; replaced byprocess_rbs_gem_resultFileAnalysis#parse_with_tree_sitter- Removed; replaced byprocess_tree_sitter_resultbackend:parameter fromFileAnalysis#initialize- Removed; useTreeHaver.with_backend()to control backend selection
Fixed
- ConflictResolver now applies Hash-based per-node-type preferences via
node_typing. - Freeze blocks from template now preserved correctly - Previously, freeze blocks from the template would not match destination declarations because their signatures differed. Now FreezeNodes are indexed by contained node signatures.
- FreezeNode name extraction -
extract_node_namenow handles TreeHaver::Node objects and extracts meaningful names for error messages. FreezeNode#get_start_line/get_end_line- Now properly handle nodes with directstart_line/end_linemethods (TreeHaver::Node).SmartMerger#get_start_line/get_end_line- Added helper methods to support both NodeWrapper and RBS gem nodes inreconstruct_declaration_with_merged_members.
Many paths lead to being a sponsor or a backer of this project. Are you on such a path?