lutaml-model 0.8.63 → 0.8.64

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: e60ce4a1bedec13a3b778b0afea4c9be5c4779f721916bfafeb151e3bd8f8c1e
4
- data.tar.gz: b6f519fabe6c9dc9c0c5edeb871d6afcc23d6439eff433b15b74b532b1a633d7
3
+ metadata.gz: 8a6392d2dcfd63cc0cb61e585a164c72e09438c25154651cf9ad935e32985429
4
+ data.tar.gz: 492ad5dd9799652c1dd6abc9e148edba5937f3a613e143bdf556f625d94851fc
5
5
  SHA512:
6
- metadata.gz: 646c4cfdfb4dc395f5f339332eb214b0d4cba7bf31710884357e5d8519db8825e0a8e937824f268bac8642ea5d23a7fee75686988b9d3a54923f508e50aaa3c0
7
- data.tar.gz: d738e9c618790d6575691acc7349991f1b4f28986947e75a3dc40a883978cbc3ce7f6ef28021b7c85f822037c6c63137ed22f1930fe6aba36dd0b266f84a451b
6
+ metadata.gz: c14bf78b03a2cce38a13d7a7c09cc07a7cca4b1dbed59a46c0faa9a5c4c275c872dcbff23afae3f8b8518b4fa926ad64597f0f7d67a7567a711ea05d60f8754d
7
+ data.tar.gz: c8d8b9723545747d826a7c16bb3d11699963299b2a238b5c04e5a724b1de555463fb839689cef9e46e52137c92a1f6831bd50676097653d888a92c57d7255f29
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lutaml
4
4
  module Model
5
- VERSION = "0.8.63"
5
+ VERSION = "0.8.64"
6
6
  end
7
7
  end
@@ -34,16 +34,22 @@ module Lutaml
34
34
  # Recover-mode parsing must never masquerade input truncation as
35
35
  # success.
36
36
  #
37
- # libxml2 (the Nokogiri backend) caps its input buffer at 10 MB;
38
- # longer documents trip a fatal "Resource limit exceeded: Buffer
39
- # size limit exceeded, try XML_PARSE_HUGE" error mid-input. In
40
- # recover mode Nokogiri records that error on the document and
37
+ # moxml releases before 0.5.84 parsed Nokogiri documents without
38
+ # XML_PARSE_HUGE, so libxml2 capped its input buffer at 10 MB;
39
+ # longer documents tripped a fatal "Resource limit exceeded:
40
+ # Buffer size limit exceeded, try XML_PARSE_HUGE" error mid-input.
41
+ # In recover mode Nokogiri records that error on the document and
41
42
  # returns the partial tree, so every node past the limit silently
42
43
  # vanishes (lutaml-model#871). A resource-limit fatal means the
43
44
  # engine stopped early with input left — refuse to deserialize the
44
45
  # partial document instead of dropping trailing content without a
45
46
  # trace.
46
47
  #
48
+ # moxml 0.5.84 and later always pass XML_PARSE_HUGE, so the
49
+ # Nokogiri path no longer truncates and this guard stays silent;
50
+ # it remains for older moxml releases and for any other adapter
51
+ # that reports the resource-limit family.
52
+ #
47
53
  # Other recover-mode fatals (e.g. an XML declaration after leading
48
54
  # whitespace) do not drop content and keep the long-standing
49
55
  # recover behavior; only the resource-limit family is truncating.
data/lutaml-model.gemspec CHANGED
@@ -38,7 +38,10 @@ Gem::Specification.new do |spec|
38
38
  spec.add_dependency "canon"
39
39
  spec.add_dependency "concurrent-ruby"
40
40
  spec.add_dependency "liquid", ">= 4.0", "< 6.0"
41
- spec.add_dependency "moxml", "~> 0.5.56"
41
+ # 0.5.84 always passes XML_PARSE_HUGE to libxml2: very large documents
42
+ # parse completely instead of being silently truncated at the 10 MB
43
+ # input-buffer cap (lutaml-model#871).
44
+ spec.add_dependency "moxml", "~> 0.5.84"
42
45
  spec.add_dependency "ostruct"
43
46
  spec.add_dependency "rubyzip", "~> 3.4"
44
47
  spec.add_dependency "thor"
@@ -6,15 +6,16 @@ require "lutaml/model"
6
6
  require "lutaml/xml"
7
7
  require "lutaml/xml/adapter/nokogiri_adapter"
8
8
 
9
- # Regression tests for lutaml-model#871.
9
+ # Regression coverage for lutaml-model#871: very large documents must
10
+ # deserialize completely, with no silent truncation and no data loss.
10
11
  #
11
- # libxml2 (the Nokogiri backend) caps its input buffer at 10 MB. Parsing a
12
- # longer document in recover mode records a FATAL "Resource limit exceeded:
13
- # Buffer size limit exceeded, try XML_PARSE_HUGE" error on the document and
14
- # returns the partial tree, so every node past the cap silently vanishes.
15
- # XmlParser now refuses documents whose parse_errors carry a fatal error
16
- # instead of deserializing the truncated input.
17
- RSpec.describe "recovered fatal parse errors" do
12
+ # libxml2's default mode caps its input buffer at 10 MB and, in recover
13
+ # mode, silently drops every node past the cap. moxml 0.5.84 always
14
+ # passes XML_PARSE_HUGE, so the Nokogiri path now parses past the cap.
15
+ # XmlParser additionally refuses recovered parses that report the
16
+ # resource-limit fatal family, which still protects moxml releases that
17
+ # truncate.
18
+ RSpec.describe "parsing documents past libxml2's 10 MB buffer cap" do
18
19
  let(:annex_class) do
19
20
  Class.new(Lutaml::Model::Serializable) do
20
21
  attribute :id, :string
@@ -56,23 +57,28 @@ RSpec.describe "recovered fatal parse errors" do
56
57
  build_document(chunk_count: 6, chunk_size: 1_700_000, with_tail: true)
57
58
  end
58
59
 
59
- it "hits the libxml2 buffer cap in recover mode past 10 MB" do
60
+ it "confirms libxml2's default mode still trips the buffer cap past 10 MB" do
60
61
  errors = Nokogiri::XML(over_cap_document) { |config| config.recover.nonet }.errors
61
62
 
62
63
  expect(errors.map(&:message).join("\n")).to match(/\bFATAL:/)
63
64
  end
64
65
 
65
- it "raises instead of silently truncating on the nokogiri path" do
66
+ it "parses over-cap documents completely on the nokogiri path" do
66
67
  Lutaml::Model::Config.with_adapter(xml: :nokogiri) do
67
- expect { root_class.from_xml(over_cap_document) }
68
- .to raise_error(Lutaml::Model::InvalidFormatError, /resource limit.*truncated/m)
68
+ model = root_class.from_xml(over_cap_document)
69
+
70
+ expect(model.annexes.map(&:id)).to eq(
71
+ ["annex0", "annex1", "annex2", "annex3", "annex4", "annex5",
72
+ "annex-tail-marker"],
73
+ )
69
74
  end
70
75
  end
71
76
 
72
- it "raises from the adapter layer directly" do
77
+ it "returns the complete tree from the adapter layer" do
73
78
  Lutaml::Model::Config.with_adapter(xml: :nokogiri) do
74
- expect { Lutaml::Xml::Adapter::NokogiriAdapter.parse(over_cap_document) }
75
- .to raise_error(Lutaml::Model::InvalidFormatError, /XML_PARSE_HUGE/)
79
+ document = Lutaml::Xml::Adapter::NokogiriAdapter.parse(over_cap_document)
80
+
81
+ expect(document.root.children.count).to eq(7)
76
82
  end
77
83
  end
78
84
 
@@ -86,7 +92,7 @@ RSpec.describe "recovered fatal parse errors" do
86
92
  end
87
93
  end
88
94
 
89
- it "still parses smaller documents without any fatal-error handling" do
95
+ it "keeps parsing smaller documents unchanged" do
90
96
  Lutaml::Model::Config.with_adapter(xml: :nokogiri) do
91
97
  model = root_class.from_xml(
92
98
  build_document(chunk_count: 2, chunk_size: 500_000, with_tail: true),
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lutaml-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.63
4
+ version: 0.8.64
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-09-25 00:00:00.000000000 Z
11
+ date: 2026-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -92,14 +92,14 @@ dependencies:
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: 0.5.56
95
+ version: 0.5.84
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: 0.5.56
102
+ version: 0.5.84
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: ostruct
105
105
  requirement: !ruby/object:Gem::Requirement
@@ -1901,8 +1901,8 @@ files:
1901
1901
  - spec/lutaml/xml/adapter/nokogiri_adapter_spec.rb
1902
1902
  - spec/lutaml/xml/adapter/oga_adapter_spec.rb
1903
1903
  - spec/lutaml/xml/adapter/order_spec.rb
1904
+ - spec/lutaml/xml/adapter/over_cap_parse_spec.rb
1904
1905
  - spec/lutaml/xml/adapter/ox_adapter_spec.rb
1905
- - spec/lutaml/xml/adapter/recovered_fatal_parse_spec.rb
1906
1906
  - spec/lutaml/xml/adapter/rexml_adapter_spec.rb
1907
1907
  - spec/lutaml/xml/adapter/xml_namespace_spec.rb
1908
1908
  - spec/lutaml/xml/adapter_loader_spec.rb