tree_haver v4.0.5 released!
4.0.5 - 2026-01-09
- TAG: v4.0.5
- COVERAGE: 93.50% – 2058/2201 lines in 28 files
- BRANCH COVERAGE: 81.11% – 803/990 branches in 28 files
- 95.60% documented
Added
- FFI Backend: Added
child_by_field_namemethod toTreeHaver::Backends::FFI::Node- Enables field-based child access using tree-sitter’s
ts_node_child_by_field_nameC API - Works with all grammars (JSON, JSONC, TOML, Bash, etc.) that define field names
- Fixes compatibility issues with json-merge, jsonc-merge, and other gems that use field access
- Example:
pair.child_by_field_name("key")returns the key node from a JSON pair
- Enables field-based child access using tree-sitter’s
- RSpec Dependency Tags: Added
compute_blocked_backendsmethod- Determines blocked backends from
TREE_HAVER_BACKENDenv and ARGV--tagoptions - Called by
summarywhen@blocked_backendsisn’t set yet (before RSpec.configure runs) - Fixes issue where gem-specific
before(:suite)hooks could load blocked backends
- Determines blocked backends from
- RSpec Dependency Tags: Added
LD_LIBRARY_PATHandDYLD_LIBRARY_PATHtoenv_summary- These library paths are relevant for tree-sitter shared library loading
- Useful for debugging grammar loading issues
- RSpec Dependency Tags: Added
TREE_SITTER_RBS_PATHtoenv_summary
Changed
- Language#method_missing: Simplified error handling in
Language#method_missing- Removed unreachable rescue block for
FFI::NotFoundError FFI::NotFoundErrorinherits fromLoadError, so it’s already caught by the prior rescue clause- Reduces code complexity without changing behavior
- Removed unreachable rescue block for
- Parser#initialize: Simplified error handling in
Parser#initialize- Same fix as Language - removed unreachable
FFI::NotFoundErrorhandling - Added comment noting that
FFI::NotFoundErrorinherits fromLoadError
- Same fix as Language - removed unreachable
- FFI Backend Native#try_load!: Removed redundant
FFI::NotFoundErrorfrom rescue clause- Only rescues
LoadErrornow with comment explaining inheritance
- Only rescues
- GrammarFinder.tree_sitter_runtime_usable?: Removed redundant
StandardErrorrescue clauseLoadErroralready catchesFFI::NotFoundError- Added comment explaining the inheritance relationship
Fixed
- Test Isolation: Fixed state leakage in
language_registry_spec.rb- Tests were registering real language names (
:toml,:json,:yaml) with fake paths - These registrations persisted and polluted other tests that expected real grammar paths
- Changed all tests to use unique test-only language names (prefixed with
test_lang_) - Fixes 2 spec failures when running all tests together (
TreeHaver::Tree#editspecs)
- Tests were registering real language names (
Many paths lead to being a sponsor or a backer of this project. Are you on such a path?