lutaml-model 0.8.173 → 0.8.175

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: a8e957736963670cb6a9f7b12b7ead8c90dc7885fdd1391db380d6863ecee28c
4
- data.tar.gz: 3530f1314b9f1d153ae304c076b3781f62e1f6a34e90754c977e8f4fe6f7693d
3
+ metadata.gz: '0658d10c7cba33a11cf0dfbc7105bb1be8661e99a9806800cd967ac2d7b1eff0'
4
+ data.tar.gz: 3964a62ce7c8bda8b35fc957df765bad29074a9f16f82117b3a421373cd43d9c
5
5
  SHA512:
6
- metadata.gz: 266147e6d75bf31c0161bcd25882f4979f6f525cb2bba5926b32c68f4a8db39be3a9e12969b6a7dac6ebbad7efd29db06c7eb14dd8207280a0af3a3c0469e5c5
7
- data.tar.gz: d47a234b59fbce06a92feabb3fd72cf71853550c9f97873b82d122e05e9652638aa7b2822c2a4050efa201625246f0bacae66facb4ed85485dd843947e8aa36e
6
+ metadata.gz: 5494168be6927595ed23a594138ee347e0687d90c41bdba72309f942ea7079eb9cc3fd10c1b86579eb7f87ef5647962afc7304374d09cb5519fc6b6c11307f0b
7
+ data.tar.gz: fcc10b888f2712615ab14c826997f57f7ef1937bda9e0470fd87aff70eaa461e612f6dca7ca272890583a2374149bcc823eb4ba83bdc77a6b7fecd0e0c73ce16
@@ -1,30 +1,30 @@
1
1
  {
2
2
  "complex1-46KB": {
3
- "avg_time": 0.03734036433333188,
4
- "min_time": 0.0371666289999979,
5
- "max_time": 0.03745624500000133,
3
+ "avg_time": 0.05412612500000099,
4
+ "min_time": 0.0533452209999723,
5
+ "max_time": 0.05472530600002301,
6
6
  "allocations": 51133,
7
- "ips": 26.780670672443065
7
+ "ips": 18.475366562819374
8
8
  },
9
9
  "complex4-50KB": {
10
- "avg_time": 0.052592221666666696,
11
- "min_time": 0.05142729300000326,
12
- "max_time": 0.053059656000002065,
10
+ "avg_time": 0.07426971533332487,
11
+ "min_time": 0.07386825400004682,
12
+ "max_time": 0.07480207200001132,
13
13
  "allocations": 71910,
14
- "ips": 19.01421861084463
14
+ "ips": 13.464438304522481
15
15
  },
16
16
  "size1000-245KB": {
17
- "avg_time": 0.30391380833333415,
18
- "min_time": 0.2985424360000053,
19
- "max_time": 0.30682469100000276,
17
+ "avg_time": 0.4342841280000016,
18
+ "min_time": 0.4245886159999941,
19
+ "max_time": 0.443060408000008,
20
20
  "allocations": 406451,
21
- "ips": 3.2904065974626433
21
+ "ips": 2.302639989642901
22
22
  },
23
23
  "complex3-567KB": {
24
- "avg_time": 0.4150900423333326,
25
- "min_time": 0.41338928599999747,
26
- "max_time": 0.41597578200000385,
24
+ "avg_time": 0.6035884146666604,
25
+ "min_time": 0.5935764820000031,
26
+ "max_time": 0.6103887489999806,
27
27
  "allocations": 587536,
28
- "ips": 2.4091158496087535
28
+ "ips": 1.6567581081758556
29
29
  }
30
30
  }
@@ -1,23 +1,23 @@
1
1
  {
2
2
  "metrology-4KB": {
3
- "avg_time": 0.010063263333345654,
4
- "min_time": 0.009257001000008813,
5
- "max_time": 0.011522572000018272,
3
+ "avg_time": 0.00901943666666701,
4
+ "min_time": 0.008446076000012681,
5
+ "max_time": 0.009944491999988259,
6
6
  "allocations": 7544,
7
- "ips": 99.37134375549903
7
+ "ips": 110.87166936885141
8
8
  },
9
9
  "bmj-49KB": {
10
- "avg_time": 0.09440573666664893,
11
- "min_time": 0.09292815799997811,
12
- "max_time": 0.09535357799998678,
10
+ "avg_time": 0.08010254133333206,
11
+ "min_time": 0.07855880500000012,
12
+ "max_time": 0.08229944900000419,
13
13
  "allocations": 72378,
14
- "ips": 10.592576630497009
14
+ "ips": 12.483998426949816
15
15
  },
16
16
  "pnas-152KB": {
17
- "avg_time": 0.4268490719999913,
18
- "min_time": 0.4227435029999924,
19
- "max_time": 0.43070350499999677,
17
+ "avg_time": 0.37417935833332194,
18
+ "min_time": 0.3672698569999966,
19
+ "max_time": 0.37714925399998833,
20
20
  "allocations": 259437,
21
- "ips": 2.342748445755132
21
+ "ips": 2.6725151394086044
22
22
  }
23
23
  }
@@ -1,30 +1,30 @@
1
1
  {
2
2
  "feature-doc-23KB": {
3
- "avg_time": 0.05483059733333562,
4
- "min_time": 0.05375416399999722,
5
- "max_time": 0.0561208400000055,
3
+ "avg_time": 0.06622223333332992,
4
+ "min_time": 0.06541184899998598,
5
+ "max_time": 0.06742671500001052,
6
6
  "allocations": 32998,
7
- "ips": 18.237992081695328
7
+ "ips": 15.100668607271146
8
8
  },
9
9
  "tbx-nisosts-101KB": {
10
- "avg_time": 0.15503678066666757,
11
- "min_time": 0.15244913000000793,
12
- "max_time": 0.15633518299998173,
10
+ "avg_time": 0.18845745966666527,
11
+ "min_time": 0.1869356610000068,
12
+ "max_time": 0.18972858899999778,
13
13
  "allocations": 134786,
14
- "ips": 6.450082333365923
14
+ "ips": 5.306237289671383
15
15
  },
16
16
  "iso-13849-1MB": {
17
- "avg_time": 5.312145330333332,
18
- "min_time": 5.289715321000017,
19
- "max_time": 5.352490981999978,
17
+ "avg_time": 7.070507873666647,
18
+ "min_time": 7.02138297999997,
19
+ "max_time": 7.105545188000008,
20
20
  "allocations": 1733464,
21
- "ips": 0.18824786179885084
21
+ "ips": 0.1414325558881553
22
22
  },
23
23
  "din-iso-1.1MB": {
24
- "avg_time": 0.6096079980000013,
25
- "min_time": 0.5997889989999976,
26
- "max_time": 0.6157538460000183,
24
+ "avg_time": 0.7734601796666615,
25
+ "min_time": 0.7701626870000098,
26
+ "max_time": 0.7775508419999824,
27
27
  "allocations": 883501,
28
- "ips": 1.6403984253500523
28
+ "ips": 1.292891381209787
29
29
  }
30
30
  }
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "800-expressions": {
3
- "avg_time": 0.27309784533332504,
4
- "min_time": 0.2719493029999853,
5
- "max_time": 0.2746361779999802,
3
+ "avg_time": 0.3305013003333386,
4
+ "min_time": 0.32859900500000094,
5
+ "max_time": 0.331687751000004,
6
6
  "allocations": 134002,
7
- "ips": 3.661691284233556
7
+ "ips": 3.0257067036995475
8
8
  }
9
9
  }
@@ -1,30 +1,30 @@
1
1
  {
2
2
  "ea251": {
3
- "avg_time": 0.24634261099998866,
4
- "min_time": 0.24230798000002096,
5
- "max_time": 0.25200138399998195,
6
- "allocations": 183151,
7
- "ips": 4.059387029879479
3
+ "avg_time": 0.17868011099999612,
4
+ "min_time": 0.17459571999998502,
5
+ "max_time": 0.18370481700000596,
6
+ "allocations": 183152,
7
+ "ips": 5.596593792131804
8
8
  },
9
9
  "medium": {
10
- "avg_time": 0.6121852393333332,
11
- "min_time": 0.6060158389999799,
12
- "max_time": 0.623339054000013,
10
+ "avg_time": 0.44010202266666926,
11
+ "min_time": 0.43002588400000263,
12
+ "max_time": 0.4478196080000032,
13
13
  "allocations": 474403,
14
- "ips": 1.633492504799683
14
+ "ips": 2.272200418304813
15
15
  },
16
16
  "citygml": {
17
- "avg_time": 0.6913046006666642,
18
- "min_time": 0.6854582240000013,
19
- "max_time": 0.7006513389999895,
17
+ "avg_time": 0.5005277433333314,
18
+ "min_time": 0.49570570700001326,
19
+ "max_time": 0.5039381569999932,
20
20
  "allocations": 586804,
21
- "ips": 1.4465403514393558
21
+ "ips": 1.9978912524216268
22
22
  },
23
23
  "large": {
24
- "avg_time": 5.741814371333343,
25
- "min_time": 5.667766696000001,
26
- "max_time": 5.879655317000015,
24
+ "avg_time": 4.091806745666673,
25
+ "min_time": 4.049281349000012,
26
+ "max_time": 4.164525467999994,
27
27
  "allocations": 4531263,
28
- "ips": 0.17416097688434737
28
+ "ips": 0.24439081856908937
29
29
  }
30
30
  }
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lutaml
4
4
  module Model
5
- VERSION = "0.8.173"
5
+ VERSION = "0.8.175"
6
6
  end
7
7
  end
@@ -90,16 +90,71 @@ module Lutaml
90
90
  end
91
91
  private_class_method :syntax_error
92
92
 
93
+ # Dump rides the native Yeptris::Psych face when the engine's
94
+ # emitter is byte-parity with the standard adapter, else the
95
+ # inherited standard (Psych) dump. The contract: a stored
96
+ # fixture generated under one adapter must round-trip
97
+ # byte-exactly under the other, or a host whose bundle flips
98
+ # the default engine rewrites every stored YAML (the 0.8.171
99
+ # default-flip broke relaton's SAE suite exactly this way).
100
+ # Parity is capability-based, not version-based: the probe
101
+ # dumps the shape battery through the native face and the
102
+ # standard adapter and compares byte-for-byte. Plain-scalar
103
+ # folding landed in yeptris 0.6.62.1, bare null-valued keys
104
+ # after literal blocks in 0.6.63 (#1264); any engine that
105
+ # misses a shape keeps the standard dump without a version
106
+ # floor.
93
107
  def to_yaml(_options = {})
94
- attributes_to_serialize = @attributes
108
+ return super unless self.class.native_dump_parity?
95
109
 
96
- # Generation must match the standard (Psych) adapter's output
97
- # byte-for-byte: document separator, quoting of digit-leading
98
- # strings, flow styles. The neutral Yeptris::YAML.dump is
99
- # deliberately headerless, so parity goes through the
100
- # Psych-compatible face of the same engine.
101
110
  require "yeptris/psych"
102
- Yeptris::Psych.dump(attributes_to_serialize)
111
+ Yeptris::Psych.dump(@attributes)
112
+ end
113
+
114
+ # True when the native emitter produces byte-identical output
115
+ # to the standard adapter across the shape battery (the same
116
+ # shapes the adapter spec pins: plain-scalar folding, null
117
+ # keys after literal blocks and quoted siblings, flow, unicode,
118
+ # nesting, multiline). Memoized; any failure — missing psych,
119
+ # engine error, non-parity bytes — reports false so dump rides
120
+ # the standard adapter.
121
+ def self.native_dump_parity?
122
+ return @native_dump_parity unless @native_dump_parity.nil?
123
+
124
+ @native_dump_parity = begin
125
+ require "yeptris/psych"
126
+ dump_parity_shapes.all? do |shape|
127
+ native = Yeptris::Psych.dump(shape)
128
+ # The comparison target is the literal parent class, not
129
+ # this class's to_yaml: the override routes back here
130
+ # while the probe is still unmemoized, recursing to a
131
+ # SystemStackError.
132
+ native == Lutaml::Yaml::Adapter::StandardAdapter.new(shape).to_yaml
133
+ end
134
+ rescue StandardError
135
+ false
136
+ end
137
+ end
138
+
139
+ # The document shapes whose byte treatment historically differs
140
+ # between emitters (leptris/yeptris#863, #1264). Keep in sync
141
+ # with the adapter spec's battery.
142
+ def self.dump_parity_shapes
143
+ [
144
+ {
145
+ "title" => "Taxonomy and Definitions for Terms Related to " \
146
+ "Driving Automation Systems for On-Road Motor " \
147
+ "Vehicles for On-Road Motor Vehicles",
148
+ "roles" => %w[admin dev],
149
+ },
150
+ { "s" => "line1\nline2", "n" => nil },
151
+ { "q" => "has: colon", "n" => nil },
152
+ { "u" => "héllo wörld", "num" => "007", "f" => 1.5, "e" => "" },
153
+ { "deep" => { "deeper" => [{ "x" => "y" }, [4, 5]] } },
154
+ { "multi" => "para one\n\npara two", "dash" => "a - b - c",
155
+ "omitted" => nil },
156
+ { "a" => 1, "b" => [1, 2, 3], "c" => { "d" => true } },
157
+ ]
103
158
  end
104
159
  end
105
160
  end
@@ -55,6 +55,64 @@ RSpec.describe Lutaml::Yaml::Adapter::YeptrisAdapter do
55
55
  it "serializes a hash to YAML that parses back identically" do
56
56
  expect(described_class.parse(document.to_yaml)).to eq(attributes)
57
57
  end
58
+
59
+ # Dump parity with the standard adapter is the contract: a stored
60
+ # fixture generated under one adapter must round-trip byte-exactly
61
+ # under the other, or a host whose bundle flips the default engine
62
+ # rewrites every stored YAML (relaton's SAE suite caught the
63
+ # 0.8.171 default flip this way). Generation rides the native face
64
+ # only when the adapter's capability probe (native_dump_parity?)
65
+ # finds the engine byte-identical across the shape battery —
66
+ # plain-scalar folding landed in yeptris 0.6.62.1, bare null keys
67
+ # after literal blocks in 0.6.63 (leptris/yeptris#863, #1264);
68
+ # engines that miss a shape keep the standard dump.
69
+ describe "byte parity with the standard adapter" do
70
+ let(:long_scalar) do
71
+ "Taxonomy and Definitions for Terms Related to Driving Automation " \
72
+ "Systems for On-Road Motor Vehicles for On-Road Motor Vehicles"
73
+ end
74
+ let(:wrapped_attributes) do
75
+ { "title" => long_scalar, "roles" => %w[admin dev] }
76
+ end
77
+
78
+ # The same shapes the capability probe exercises in
79
+ # yeptris_adapter.rb — keep the two lists in sync.
80
+ let(:parity_shapes) do
81
+ [
82
+ wrapped_attributes,
83
+ { "s" => "line1\nline2", "n" => nil },
84
+ { "q" => "has: colon", "n" => nil },
85
+ { "u" => "héllo wörld", "num" => "007", "f" => 1.5, "e" => "" },
86
+ { "deep" => { "deeper" => [{ "x" => "y" }, [4, 5]] } },
87
+ { "multi" => "para one\n\npara two", "dash" => "a - b - c",
88
+ "omitted" => nil },
89
+ { "a" => 1, "b" => [1, 2, 3], "c" => { "d" => true } },
90
+ ]
91
+ end
92
+
93
+ it "dumps every parity shape byte-identically to the standard adapter" do
94
+ parity_shapes.each do |shape|
95
+ standard = Lutaml::Yaml::Adapter::StandardAdapter.new(shape).to_yaml
96
+ expect(described_class.new(shape).to_yaml).to eq(standard)
97
+ end
98
+ end
99
+
100
+ it "parses the standard adapter's dumps back identically" do
101
+ parity_shapes.each do |shape|
102
+ standard = Lutaml::Yaml::Adapter::StandardAdapter.new(shape).to_yaml
103
+ expect(described_class.parse(standard)).to eq(shape)
104
+ end
105
+ end
106
+
107
+ it "opens the native dump lane when the engine answers the probe" do
108
+ skip "engine not fold-parity on this platform" unless
109
+ described_class.native_dump_parity?
110
+
111
+ first = parity_shapes.first
112
+ expect(described_class.new(first).to_yaml)
113
+ .to eq(Yeptris::Psych.dump(first))
114
+ end
115
+ end
58
116
  end
59
117
 
60
118
  describe "round trip through a model" do
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.173
4
+ version: 0.8.175
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-11-10 00:00:00.000000000 Z
11
+ date: 2026-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64