tree_haver 4.0.1 → 4.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 872ceb8aab416345826221f841d8cc79037a4d270fd9b556ef57cbcf9d702f7a
4
- data.tar.gz: edcb75fd0ddb051e6be4ad9c1eed410b2aa3cd14f0595bc8fd20679c07f1eed7
3
+ metadata.gz: 16ff994e79a2627158244ff89554d062a5feacb3f3c6605545c8dfbf86dac3d0
4
+ data.tar.gz: 66250d72daf7a7617ef9fa610a43253b84836658e6112b9bf276d3edc91ba4a3
5
5
  SHA512:
6
- metadata.gz: 00fbca360e93a8cd116e83c35678e3d3e6010c744984ef230a24d82b82e964687202b46aa30d39b5c04606e8581ed06158a63c71a30b6c59f6ab0f0566f99277
7
- data.tar.gz: a261ba76e4ee22673ba34c4c599b8567913146d7fd3eb96c5fd854c9b8c2efda13afeb6e2c37a69a0a810b37e3bdf65697a7e9a55849e7fa6b9464c8cd40940f
6
+ metadata.gz: 80b3aff0e492dbdc1fcfc23fce6ab05a514b6fdc75630e822267c93bf232d638550340813abac8f23f1602516b63a800093e82ae95a573160fcaf2fde089ea18
7
+ data.tar.gz: 4a168f874d4e455e4db82e6786abeef2fc7c1b6007d3cc101fcce1aa0eea6b91c656a32cafb73da9fda1c7830e6397f6a7441ef7ffc4340f2e1254b183afda28
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -30,6 +30,50 @@ Please file a bug if you notice a violation of semantic versioning.
30
30
 
31
31
  ### Security
32
32
 
33
+ ## [4.0.3] - 2026-01-08
34
+
35
+ - TAG: [v4.0.3][4.0.3t]
36
+ - COVERAGE: 95.27% -- 2033/2134 lines in 28 files
37
+ - BRANCH COVERAGE: 84.17% -- 803/954 branches in 28 files
38
+ - 95.49% documented
39
+
40
+ ### Changed
41
+
42
+ - **RSpec Dependency Tags**: Refactored FFI backend isolation to use standard `:ffi_backend` tag
43
+ - The `--tag ffi_backend` now triggers `isolated_test_mode` in `dependency_tags.rb`
44
+ - This prevents MRI backend from loading during availability checks
45
+ - Legacy `*_backend_only` tags are still supported for backwards compatibility
46
+ - Simplifies the testing pattern: one tag serves as both dependency tag and isolation trigger
47
+
48
+ ### Deprecated
49
+
50
+ - **`:ffi_backend_only` tag**: Use `:ffi_backend` instead. The `*_backend_only` tags are now redundant.
51
+
52
+ ## [4.0.2] - 2026-01-08
53
+
54
+ - TAG: [v4.0.2][4.0.2t]
55
+ - COVERAGE: 95.27% -- 2033/2134 lines in 28 files
56
+ - BRANCH COVERAGE: 84.07% -- 802/954 branches in 28 files
57
+ - 95.49% documented
58
+
59
+ ### Added
60
+
61
+ - **FFI Backend**: Implemented `missing?` method on `TreeHaver::Backends::FFI::Node`
62
+ - Added `ts_node_is_missing` FFI function attachment
63
+ - This method was missing entirely, causing `NoMethodError` when checking for MISSING nodes
64
+
65
+ ### Changed
66
+
67
+ - **TreeHaver::Node**: Removed defensive `respond_to?` checks from `has_error?` and `missing?` methods
68
+ - All tree-sitter backends (MRI, Rust, FFI, Java) must implement these methods on their inner nodes
69
+ - This enforces proper backend API compliance rather than silently masking missing implementations
70
+
71
+ ### Fixed
72
+
73
+ - **FFI Backend**: Added explicit boolean conversion (`!!`) to `has_error?` return value
74
+ - FFI `:bool` return type may behave inconsistently across Ruby versions and platforms
75
+ - Ensures `has_error?` always returns `true` or `false`, not truthy/falsy values
76
+
33
77
  ## [4.0.1] - 2026-01-08
34
78
 
35
79
  - TAG: [v4.0.1][4.0.1t]
@@ -965,7 +1009,11 @@ Despite the major version bump to 3.0.0 (following semver due to the breaking `L
965
1009
 
966
1010
  - Initial release
967
1011
 
968
- [Unreleased]: https://github.com/kettle-rb/tree_haver/compare/v4.0.1...HEAD
1012
+ [Unreleased]: https://github.com/kettle-rb/tree_haver/compare/v4.0.3...HEAD
1013
+ [4.0.3]: https://github.com/kettle-rb/tree_haver/compare/v4.0.2...v4.0.3
1014
+ [4.0.3t]: https://github.com/kettle-rb/tree_haver/releases/tag/v4.0.3
1015
+ [4.0.2]: https://github.com/kettle-rb/tree_haver/compare/v4.0.1...v4.0.2
1016
+ [4.0.2t]: https://github.com/kettle-rb/tree_haver/releases/tag/v4.0.2
969
1017
  [4.0.1]: https://github.com/kettle-rb/tree_haver/compare/v4.0.0...v4.0.1
970
1018
  [4.0.1t]: https://github.com/kettle-rb/tree_haver/releases/tag/v4.0.1
971
1019
  [4.0.0]: https://github.com/kettle-rb/tree_haver/compare/v3.2.6...v4.0.0
data/README.md CHANGED
@@ -2182,7 +2182,7 @@ Thanks for RTFM. ☺️
2182
2182
  [📌gitmoji]: https://gitmoji.dev
2183
2183
  [📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
2184
2184
  [🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
2185
- [🧮kloc-img]: https://img.shields.io/badge/KLOC-2.132-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
2185
+ [🧮kloc-img]: https://img.shields.io/badge/KLOC-2.134-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
2186
2186
  [🔐security]: SECURITY.md
2187
2187
  [🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
2188
2188
  [📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
@@ -273,6 +273,7 @@ module TreeHaver
273
273
  attach_function(:ts_node_end_point, [:ts_node], :ts_point)
274
274
  attach_function(:ts_node_is_null, [:ts_node], :bool)
275
275
  attach_function(:ts_node_is_named, [:ts_node], :bool)
276
+ attach_function(:ts_node_is_missing, [:ts_node], :bool)
276
277
  attach_function(:ts_node_has_error, [:ts_node], :bool)
277
278
 
278
279
  # Only mark as fully loaded after all attach_function calls succeed
@@ -701,7 +702,20 @@ module TreeHaver
701
702
  #
702
703
  # @return [Boolean] true if node subtree contains errors
703
704
  def has_error?
704
- Native.ts_node_has_error(@val)
705
+ # Explicit boolean conversion ensures consistent behavior across Ruby versions
706
+ # FFI :bool return type may behave differently on some platforms
707
+ !!Native.ts_node_has_error(@val)
708
+ end
709
+
710
+ # Check if this is a MISSING node
711
+ #
712
+ # A MISSING node represents a token that was expected by the grammar
713
+ # but was not found in the source. Tree-sitter inserts MISSING nodes
714
+ # to allow parsing to continue despite syntax errors.
715
+ #
716
+ # @return [Boolean] true if this is a MISSING node
717
+ def missing?
718
+ !!Native.ts_node_is_missing(@val)
705
719
  end
706
720
 
707
721
  # Iterate over child nodes
@@ -263,7 +263,6 @@ module TreeHaver
263
263
  # Check if the node is missing
264
264
  # @return [Boolean]
265
265
  def missing?
266
- return false unless @inner_node.respond_to?(:missing?)
267
266
  @inner_node.missing?
268
267
  end
269
268
 
@@ -346,11 +346,13 @@ module TreeHaver
346
346
 
347
347
  # Check if FFI backend is available WITHOUT loading MRI first
348
348
  #
349
- # This is used for the :ffi_backend_only tag which runs FFI tests
350
- # in isolation before MRI can be loaded. Unlike ffi_available?,
351
- # this method does NOT check mri_backend_available?.
349
+ # This method is primarily for backwards compatibility with the legacy
350
+ # :ffi_backend_only tag. The preferred approach is to use the standard
351
+ # :ffi_backend tag, which now also triggers isolated_test_mode when
352
+ # used with --tag ffi_backend.
352
353
  #
353
354
  # @return [Boolean] true if FFI backend is usable in isolation
355
+ # @deprecated Use :ffi_backend tag instead of :ffi_backend_only
354
356
  def ffi_backend_only_available?
355
357
  # If TREE_HAVER_BACKEND explicitly selects a different native backend,
356
358
  # FFI is not available for testing
@@ -1044,14 +1046,25 @@ RSpec.configure do |config|
1044
1046
  end
1045
1047
  end
1046
1048
 
1049
+ # Check if we're running isolated backend tests using standard backend tags
1050
+ # When running with --tag ffi_backend (or other native backend tags), we need
1051
+ # to block conflicting backends to prevent them from loading first.
1052
+ # This replaces the old *_backend_only pattern with the standard *_backend tags.
1047
1053
  TreeHaver::Backends::BLOCKED_BY.each do |backend, blockers|
1048
- # Check if we're running this backend's isolated tests
1049
- isolated_tag = :"#{backend}_backend_only"
1050
- if inclusion_rules[isolated_tag]
1054
+ # Check if we're running this backend's tests using standard tag (e.g., :ffi_backend)
1055
+ standard_tag = :"#{backend}_backend"
1056
+ if inclusion_rules[standard_tag]
1051
1057
  isolated_test_mode = true
1052
1058
  # Add all backends that would block this one
1053
1059
  blockers.each { |blocker| blocked_backends << blocker }
1054
1060
  end
1061
+
1062
+ # Also support legacy *_backend_only tags for backwards compatibility
1063
+ legacy_tag = :"#{backend}_backend_only"
1064
+ if inclusion_rules[legacy_tag]
1065
+ isolated_test_mode = true
1066
+ blockers.each { |blocker| blocked_backends << blocker }
1067
+ end
1055
1068
  end
1056
1069
 
1057
1070
  # Store blocked_backends in a module variable so before(:suite) can access it
@@ -10,7 +10,7 @@ module TreeHaver
10
10
  # Current version of the tree_haver gem
11
11
  #
12
12
  # @return [String] the version string
13
- VERSION = "4.0.1"
13
+ VERSION = "4.0.3"
14
14
  end
15
15
 
16
16
  # Traditional location for VERSION constant
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tree_haver
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 4.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter H. Boling
@@ -298,10 +298,10 @@ licenses:
298
298
  - MIT
299
299
  metadata:
300
300
  homepage_uri: https://tree-haver.galtzo.com/
301
- source_code_uri: https://github.com/kettle-rb/tree_haver/tree/v4.0.1
302
- changelog_uri: https://github.com/kettle-rb/tree_haver/blob/v4.0.1/CHANGELOG.md
301
+ source_code_uri: https://github.com/kettle-rb/tree_haver/tree/v4.0.3
302
+ changelog_uri: https://github.com/kettle-rb/tree_haver/blob/v4.0.3/CHANGELOG.md
303
303
  bug_tracker_uri: https://github.com/kettle-rb/tree_haver/issues
304
- documentation_uri: https://www.rubydoc.info/gems/tree_haver/4.0.1
304
+ documentation_uri: https://www.rubydoc.info/gems/tree_haver/4.0.3
305
305
  funding_uri: https://github.com/sponsors/pboling
306
306
  wiki_uri: https://github.com/kettle-rb/tree_haver/wiki
307
307
  news_uri: https://www.railsbling.com/tags/tree_haver
metadata.gz.sig CHANGED
Binary file