lutaml-model 0.8.109 → 0.8.110

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: 45a348d47b61525553682dc4a12be7cde6239ba3d8367e1338e8a266c59ad806
4
- data.tar.gz: 1a3816081d045d022bf6fcb94a6a82bdfe335644bdbc925d3bcf7676522b433c
3
+ metadata.gz: a49c2cdf5702fe7400d2cc4439632340cf8abe4ed214219d9d53a3bbacff6943
4
+ data.tar.gz: 887431c911fa16aff6372c9c7c7addb034d0722f1ba11b0dfd28fb71bb4fb982
5
5
  SHA512:
6
- metadata.gz: 8b0e82b390f6d56ae98f9f98c9c16b121e8c96290cb79c8db0c31723104a0e940d4bfe798f3facee8493b2257f47c4597b91920cf6dff93dfa89e0875970746b
7
- data.tar.gz: c5e85f1a1a613112a08795db1e299bfda7ba41057091da39e371f24d03759ff739f56ad96b929c7d41b50ecd4bbbf41f87543205e850239c6494d89f3d334398
6
+ metadata.gz: f9c79f442e8be909743b4ecd1eaca9537d61be0d5925336507aa1869907c6795d68aac1a66b67c3fb2cedc0dab86bcab798b7850c3c41d7393a1f9301b862104
7
+ data.tar.gz: d03289efc62a1b6c3cd9c66b6114879a3e68dc05883f20aab395264c2db7c7f0487da4baf2cce95d40493485f238e914b9acb88d974b7638e54efca43f678a30
@@ -37,11 +37,11 @@ module Lutaml
37
37
  @conversion_cache = nil
38
38
  @configured = false
39
39
  @xml_plan_fast_path = true
40
- # Opt-in until leptris#1743 lands: the native ordered lane
41
- # runs away (28+ CPU-min / 14GB RSS on sts-ruby's
42
- # ISO_13849-1 document) — flipping this on by default regressed
43
- # the sts bench cell from 4m41s to a 10-minute kill.
44
- @xml_plan_ordered_path = false
40
+ # Opt-in until leptris#1743 lands: the native ordered lane
41
+ # runs away (28+ CPU-min / 14GB RSS on sts-ruby's
42
+ # ISO_13849-1 document) — flipping this on by default regressed
43
+ # the sts bench cell from 4m41s to a 10-minute kill.
44
+ @xml_plan_ordered_path = false
45
45
  @element_order_tracking = true
46
46
  end
47
47
 
@@ -139,7 +139,13 @@ module Lutaml
139
139
  plan = Lutaml::Xml::Leptris::PlanCompiler.compile(self, register)
140
140
  return nil unless plan
141
141
 
142
- root = ::Leptris::XML.parse(data.to_s).root
142
+ # strict: the from_xml contract raises on malformed input —
143
+ # the FFI lane parses leniently by default and would answer a
144
+ # best-effort tree where every other adapter raises. The
145
+ # kwarg spellings vary by engine vintage (strict: landed
146
+ # after 1.9.353, recover: on 1.9.344+), so probe the resolved
147
+ # parse method and pass the strictest spelling it accepts.
148
+ root = ::Leptris::XML.parse(data.to_s, **leptris_strict_kwargs).root
143
149
  return nil if root.nil?
144
150
  return nil unless root.name == plan[:tree][:name]
145
151
 
@@ -154,6 +160,15 @@ module Lutaml
154
160
  raise Lutaml::Model::InvalidFormatError.new(:xml, e.message)
155
161
  end
156
162
 
163
+ def leptris_strict_kwargs
164
+ params = ::Leptris::XML.method(:parse).parameters
165
+ .map { |_, key| key }
166
+ kwargs = {}
167
+ kwargs[:recover] = false if params.include?(:recover)
168
+ kwargs[:strict] = true if params.include?(:strict)
169
+ kwargs
170
+ end
171
+
157
172
  # Get list of error types that can be raised during format parsing.
158
173
  # Core errors are always included; format-specific errors come from
159
174
  # FormatRegistry registrations.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lutaml
4
4
  module Model
5
- VERSION = "0.8.109"
5
+ VERSION = "0.8.110"
6
6
  end
7
7
  end
@@ -9,6 +9,7 @@ module Lutaml
9
9
  MOXML_ADAPTER = Moxml::Adapter::Leptris
10
10
  BUILDER_CLASS = Builder::Leptris
11
11
  PARSED_ELEMENT_CLASS = Lutaml::Xml::LeptrisElement
12
+ PARSE_ERROR_CLASS = Moxml::ParseError
12
13
  end
13
14
  end
14
15
  end
@@ -49,13 +49,13 @@ RSpec.describe Lutaml::Model::AdapterResolver, ".adapter_for with a configured t
49
49
  _stdout, stderr, status = Open3.capture3(RbConfig.ruby, "-I", "lib", "-e", probe)
50
50
  expect(status).to be_success, stderr
51
51
  end
52
- end
53
52
 
54
- RSpec.describe "plan lane defaults" do
55
- it "ships the ordered plan lane opt-in until leptris#1743 is fixed" do
56
- # The native ordered lane runs away on sts-ruby's ISO_13849-1
57
- # document (leptris#1743): 28+ CPU-min / 14 GB RSS vs 6.36s on the
58
- # same parse with the lane off. Opt-in until the engine fix ships.
59
- expect(Lutaml::Model::Config.instance.xml_plan_ordered_path).to be(false)
53
+ describe "plan lane defaults" do
54
+ it "ships the ordered plan lane opt-in until leptris#1743 is fixed" do
55
+ # The native ordered lane runs away on sts-ruby's ISO_13849-1
56
+ # document (leptris#1743): 28+ CPU-min / 14 GB RSS vs 6.36s on the
57
+ # same parse with the lane off. Opt-in until the engine fix ships.
58
+ expect(Lutaml::Model::Config.instance.xml_plan_ordered_path).to be(false)
59
+ end
60
60
  end
61
61
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lutaml-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.109
4
+ version: 0.8.110
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.