lutaml-model 0.8.170 → 0.8.172

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: dd7b915692eee1912259db7da0a88cc7864f803d6b4351462d1d4c876d02a6ec
4
- data.tar.gz: 8a706f651a1e7986924a3e9a66d80f861d2d52557ad7df25020b64638ce52d66
3
+ metadata.gz: 7cde2b0a71310dad7114db493d1c910ca54da02c386ed71f7c12ec0aee505e4f
4
+ data.tar.gz: '082b2d05339bce0c681ea564bde71c431762a65256b736ec192b49f9c465d469'
5
5
  SHA512:
6
- metadata.gz: d9de4cf6473267fbe06c5b3b3b96020666ab597514d7a44a2f081a23a432b93cb3c4bf89f32b7cbfe057f4e9882eefcf687b2f1dfcbdd8de30c0ac3219589201
7
- data.tar.gz: 6a022ad30b74a4c6f5211ff2f1d484399492df597c68a3ab9efdd61e42b889577795b3b4e14dd00b90c0eb9ab84afe7730baa513cea9f307e4c498d718cc13d4
6
+ metadata.gz: 6fbd3285be7b105fd859d96d456aad146f429186d88d84cac002902933021d52ee53a0882ccd4e1cb41dba7165853a4ddeb47591a149619b496b2c2a7c7f78a9
7
+ data.tar.gz: 6114a1b089c42e8714590a867f9fdfbccc0f41f1e0bbeacb4608887c424abf96d2f3173b3f31c72b9899083ac90062314d6fb80f0ae74b03f3dd0f0cfccbffb0
@@ -1,30 +1,30 @@
1
1
  {
2
2
  "complex1-46KB": {
3
- "avg_time": 0.03743817400000656,
4
- "min_time": 0.03580255499998941,
5
- "max_time": 0.037985226000003536,
3
+ "avg_time": 0.03734036433333188,
4
+ "min_time": 0.0371666289999979,
5
+ "max_time": 0.03745624500000133,
6
6
  "allocations": 51133,
7
- "ips": 26.71070442697939
7
+ "ips": 26.780670672443065
8
8
  },
9
9
  "complex4-50KB": {
10
- "avg_time": 0.05052796100000497,
11
- "min_time": 0.04987352499999531,
12
- "max_time": 0.05090635400000565,
10
+ "avg_time": 0.052592221666666696,
11
+ "min_time": 0.05142729300000326,
12
+ "max_time": 0.053059656000002065,
13
13
  "allocations": 71910,
14
- "ips": 19.791022242118608
14
+ "ips": 19.01421861084463
15
15
  },
16
16
  "size1000-245KB": {
17
- "avg_time": 0.29998471433333407,
18
- "min_time": 0.2930994010000063,
19
- "max_time": 0.30605089399999486,
17
+ "avg_time": 0.30391380833333415,
18
+ "min_time": 0.2985424360000053,
19
+ "max_time": 0.30682469100000276,
20
20
  "allocations": 406451,
21
- "ips": 3.33350318272827
21
+ "ips": 3.2904065974626433
22
22
  },
23
23
  "complex3-567KB": {
24
- "avg_time": 0.4159978183333332,
25
- "min_time": 0.414953170000004,
26
- "max_time": 0.41766153099999315,
24
+ "avg_time": 0.4150900423333326,
25
+ "min_time": 0.41338928599999747,
26
+ "max_time": 0.41597578200000385,
27
27
  "allocations": 587536,
28
- "ips": 2.403858760621466
28
+ "ips": 2.4091158496087535
29
29
  }
30
30
  }
@@ -1,23 +1,23 @@
1
1
  {
2
2
  "metrology-4KB": {
3
- "avg_time": 0.011824453333337223,
4
- "min_time": 0.011421979000004967,
5
- "max_time": 0.012430414000007772,
3
+ "avg_time": 0.010063263333345654,
4
+ "min_time": 0.009257001000008813,
5
+ "max_time": 0.011522572000018272,
6
6
  "allocations": 7544,
7
- "ips": 84.57050586691008
7
+ "ips": 99.37134375549903
8
8
  },
9
9
  "bmj-49KB": {
10
- "avg_time": 0.10275671466666363,
11
- "min_time": 0.10232797499999435,
12
- "max_time": 0.10314825199999689,
10
+ "avg_time": 0.09440573666664893,
11
+ "min_time": 0.09292815799997811,
12
+ "max_time": 0.09535357799998678,
13
13
  "allocations": 72378,
14
- "ips": 9.731724133492762
14
+ "ips": 10.592576630497009
15
15
  },
16
16
  "pnas-152KB": {
17
- "avg_time": 0.46011452899999955,
18
- "min_time": 0.4572272639999966,
19
- "max_time": 0.4658364209999917,
17
+ "avg_time": 0.4268490719999913,
18
+ "min_time": 0.4227435029999924,
19
+ "max_time": 0.43070350499999677,
20
20
  "allocations": 259437,
21
- "ips": 2.173371925840666
21
+ "ips": 2.342748445755132
22
22
  }
23
23
  }
@@ -1,30 +1,30 @@
1
1
  {
2
2
  "feature-doc-23KB": {
3
- "avg_time": 0.07566020366666255,
4
- "min_time": 0.074541666000016,
5
- "max_time": 0.0764295470000036,
3
+ "avg_time": 0.05483059733333562,
4
+ "min_time": 0.05375416399999722,
5
+ "max_time": 0.0561208400000055,
6
6
  "allocations": 32998,
7
- "ips": 13.21698794792725
7
+ "ips": 18.237992081695328
8
8
  },
9
9
  "tbx-nisosts-101KB": {
10
- "avg_time": 0.219973534666669,
11
- "min_time": 0.21835066099998812,
12
- "max_time": 0.2225604799999985,
10
+ "avg_time": 0.15503678066666757,
11
+ "min_time": 0.15244913000000793,
12
+ "max_time": 0.15633518299998173,
13
13
  "allocations": 134786,
14
- "ips": 4.546001415649038
14
+ "ips": 6.450082333365923
15
15
  },
16
16
  "iso-13849-1MB": {
17
- "avg_time": 7.808285298999995,
18
- "min_time": 7.748742658999987,
19
- "max_time": 7.903863881000007,
17
+ "avg_time": 5.312145330333332,
18
+ "min_time": 5.289715321000017,
19
+ "max_time": 5.352490981999978,
20
20
  "allocations": 1733464,
21
- "ips": 0.1280690909344808
21
+ "ips": 0.18824786179885084
22
22
  },
23
23
  "din-iso-1.1MB": {
24
- "avg_time": 0.9531642093333138,
25
- "min_time": 0.9456722399999649,
26
- "max_time": 0.9604461779999838,
24
+ "avg_time": 0.6096079980000013,
25
+ "min_time": 0.5997889989999976,
26
+ "max_time": 0.6157538460000183,
27
27
  "allocations": 883501,
28
- "ips": 1.0491371688194684
28
+ "ips": 1.6403984253500523
29
29
  }
30
30
  }
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "800-expressions": {
3
- "avg_time": 0.4214679240000028,
4
- "min_time": 0.41841092800001434,
5
- "max_time": 0.42341057799998794,
3
+ "avg_time": 0.27309784533332504,
4
+ "min_time": 0.2719493029999853,
5
+ "max_time": 0.2746361779999802,
6
6
  "allocations": 134002,
7
- "ips": 2.3726597993729963
7
+ "ips": 3.661691284233556
8
8
  }
9
9
  }
@@ -1,30 +1,30 @@
1
1
  {
2
2
  "ea251": {
3
- "avg_time": 0.26108460200000155,
4
- "min_time": 0.2576839820000032,
5
- "max_time": 0.2658058270000083,
6
- "allocations": 183152,
7
- "ips": 3.8301760898177903
3
+ "avg_time": 0.24634261099998866,
4
+ "min_time": 0.24230798000002096,
5
+ "max_time": 0.25200138399998195,
6
+ "allocations": 183151,
7
+ "ips": 4.059387029879479
8
8
  },
9
9
  "medium": {
10
- "avg_time": 0.6549090059999875,
11
- "min_time": 0.6454114659999846,
12
- "max_time": 0.6686907289999908,
10
+ "avg_time": 0.6121852393333332,
11
+ "min_time": 0.6060158389999799,
12
+ "max_time": 0.623339054000013,
13
13
  "allocations": 474403,
14
- "ips": 1.5269296815869702
14
+ "ips": 1.633492504799683
15
15
  },
16
16
  "citygml": {
17
- "avg_time": 0.7382608636666722,
18
- "min_time": 0.7349978900000167,
19
- "max_time": 0.7414869970000098,
17
+ "avg_time": 0.6913046006666642,
18
+ "min_time": 0.6854582240000013,
19
+ "max_time": 0.7006513389999895,
20
20
  "allocations": 586804,
21
- "ips": 1.3545347575833357
21
+ "ips": 1.4465403514393558
22
22
  },
23
23
  "large": {
24
- "avg_time": 6.100064923666669,
25
- "min_time": 5.998476953000022,
26
- "max_time": 6.217400171000008,
24
+ "avg_time": 5.741814371333343,
25
+ "min_time": 5.667766696000001,
26
+ "max_time": 5.879655317000015,
27
27
  "allocations": 4531263,
28
- "ips": 0.1639326814572513
28
+ "ips": 0.17416097688434737
29
29
  }
30
30
  }
@@ -416,60 +416,29 @@ module Lutaml
416
416
  end
417
417
 
418
418
  # Native key-value engine preference: yeptris (libyeptris C11)
419
- # when the host explicitly opts in with FONTIST_YAML=yeptris
420
- # (the switch fontist and lutaml-store share) and the native
421
- # engine answers a probe, else the format's standard adapter.
422
- # Detection used to flip the lane for any process whose bundle
423
- # merely contained yeptris — typically through a transitive
424
- # dependency — which silently switched YAML parsing and dumping
425
- # (including line-wrap behavior) for hosts that never chose the
426
- # engine, and the yeptris YAML build still mis-parses some plain
427
- # scalars as single-element Arrays on several platforms
428
- # (leptris/yeptris#863), so bundle-presence selection is not a
429
- # safe default. The probe matters because a half-initialized
430
- # Yeptris constant (the poison-process state the gem documents)
431
- # passes const_defined? and require while every parse fails;
432
- # without it the lane selection flips with process load order
433
- # and the failure surfaces as a native parse error on valid
434
- # input instead of a clean standard-lane parse (#978).
419
+ # is preferred whenever the engine answers a probe, matching
420
+ # the XML lane's prefer-if-available contract — the parity
421
+ # fixes for the platform scalar materialization landed in
422
+ # yeptris 0.6.57+ (leptris/yeptris#863), lifting the reason
423
+ # bundle-presence selection was unsafe. Adapter choice is
424
+ # centralized: a host that wants a different engine configures
425
+ # it through Config (yaml_adapter_type= / json_adapter_type=),
426
+ # which pins the adapter and bypasses detection entirely; no
427
+ # environment variables are consulted here.
428
+ # The probe matters because a half-initialized Yeptris constant
429
+ # (the poison-process state the gem documents) passes
430
+ # const_defined? and require while every parse fails; without
431
+ # it the lane selection flips with process load order and the
432
+ # failure surfaces as a native parse error on valid input
433
+ # instead of a clean standard-lane parse (#978).
435
434
  def detect_yeptris_kv_adapter(format)
436
435
  default = metadata.dig(format, :default)
437
436
  return default if Lutaml::Model.opal?
438
-
439
- unless yeptris_opted_in?
440
- warn_yeptris_present_once(format)
441
- return default
442
- end
443
437
  return default unless Utils.safe_load("yeptris", :Yeptris)
444
438
 
445
439
  load_adapter(format, :yeptris).available? ? :yeptris : default
446
440
  end
447
441
 
448
- # The consumer-neutral opt-in; FONTIST_YAML=yeptris stays honored
449
- # as the legacy spelling fontist and lutaml-store already ship
450
- # (#1115: glossarist is not fontist — the switch must not carry
451
- # one consumer's namespace).
452
- def yeptris_opted_in?
453
- %w[LUTAML_YAML FONTIST_YAML].any? { |k| ENV[k] == "yeptris" }
454
- end
455
-
456
- # Make the gated engine visible (#1115 ask 3): a process whose
457
- # bundle merely contains yeptris used to get it auto-selected;
458
- # the gate keeps that from happening silently, but the presence
459
- # of an unused native engine is exactly the kind of fact an
460
- # upgrading consumer needs to see once.
461
- def warn_yeptris_present_once(_format)
462
- return if Lutaml::Model.opal?
463
- return if @yeptris_presence_warned
464
- return unless Utils.safe_load("yeptris", :Yeptris)
465
-
466
- @yeptris_presence_warned = true
467
- warn "[Lutaml::Model] yeptris is present in this bundle but the " \
468
- "native YAML engine is not enabled (its parity fixes are " \
469
- "still landing, leptris/yeptris#863); the standard adapter " \
470
- "serves YAML. Enable explicitly with LUTAML_YAML=yeptris."
471
- end
472
-
473
442
  # Detect available XML adapter.
474
443
  #
475
444
  # Delegates to moxml which is the authority on XML adapter
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lutaml
4
4
  module Model
5
- VERSION = "0.8.170"
5
+ VERSION = "0.8.172"
6
6
  end
7
7
  end
@@ -12,8 +12,6 @@ module Lutaml
12
12
  # - Used by model's serialization pipeline via Transform.for(:xml)
13
13
  #
14
14
  class ModelTransform < ::Lutaml::Model::Transform
15
- require "cgi" unless Lutaml::Model.opal?
16
-
17
15
  # Per (model class, register): compiled records for the mapping
18
16
  # rules — attribute, derived/valid flags, and #765 group-skip —
19
17
  # keyed on the mapping's finalize version so late changes rebuild.
@@ -2,39 +2,93 @@
2
2
 
3
3
  require "spec_helper"
4
4
 
5
- # lutaml-model#1115: the yeptris opt-in is consumer-neutral
6
- # (LUTAML_YAML; FONTIST_YAML stays honored as the legacy spelling), and
7
- # a bundle containing yeptris without the opt-in sees a one-time
8
- # warning naming the switch — the gated engine is visible, not silent.
9
- RSpec.describe "yeptris engine opt-in switch" do
5
+ # The yeptris YAML engine is preferred whenever it answers a probe,
6
+ # matching the XML lane's prefer-if-available contract: the platform
7
+ # parity fixes for plain-scalar materialization landed in yeptris
8
+ # 0.6.57+ (leptris/yeptris#863). Adapter choice is centralized in
9
+ # Config (yaml_adapter_type= / json_adapter_type=) — a host that wants
10
+ # a different engine pins it there, and the detection path consults no
11
+ # environment variables.
12
+ RSpec.describe "yeptris engine preference" do
13
+ # Reset only the key-value resolution entries: the explicit pins, the
14
+ # lazy detection cache, and the resolved-class cache. The resolver-wide
15
+ # reset! would also wipe the adapters other specs configured (the XML
16
+ # lane in particular), silently re-detecting a different runtime for
17
+ # the rest of the process.
18
+ def with_fresh_kv_resolution
19
+ resolver = Lutaml::Model::AdapterResolver
20
+ types = resolver.__send__(:configured_types)
21
+ detected = resolver.__send__(:detected_types)
22
+ detected_flags = resolver.__send__(:detected_formats)
23
+ resolved = resolver.__send__(:resolved)
24
+ saved = types.slice(:yaml, :json)
25
+ saved_detected = detected.slice(:yaml, :json)
26
+ saved_resolved = resolved.slice(:yaml, :json)
27
+ %i[yaml json].each do |format|
28
+ types.delete(format)
29
+ detected.delete(format)
30
+ detected_flags.delete(format)
31
+ resolved.delete(format)
32
+ end
33
+ yield
34
+ ensure
35
+ %i[yaml json].each do |format|
36
+ types.delete(format)
37
+ detected.delete(format)
38
+ detected_flags.delete(format)
39
+ resolved.delete(format)
40
+ end
41
+ saved.each { |format, type| types[format] = type }
42
+ saved_detected.each { |format, type| detected[format] = type }
43
+ saved_resolved.each { |format, klass| resolved[format] = klass }
44
+ %i[yaml json].each { |format| detected_flags.delete(format) }
45
+ end
46
+
10
47
  around do |example|
11
- old = ENV.to_h.slice("LUTAML_YAML", "FONTIST_YAML")
12
- ENV.delete("LUTAML_YAML")
13
- ENV.delete("FONTIST_YAML")
14
- example.run
15
- old.each { |k, v| ENV[k] = v }
48
+ with_fresh_kv_resolution do
49
+ example.run
50
+ end
51
+ end
52
+
53
+ def yeptris_engine_available?
54
+ return false if RUBY_ENGINE == "opal"
55
+
56
+ Lutaml::Model::Utils.safe_load("yeptris", :Yeptris)
16
57
  end
17
58
 
18
- it "selects yeptris with LUTAML_YAML=yeptris" do
59
+ it "prefers yeptris by default when the engine is available" do
19
60
  skip "yeptris engine not available on this platform" unless
20
- Lutaml::Model::AdapterResolver.send(:yeptris_opted_in?)
61
+ yeptris_engine_available?
21
62
 
22
63
  expect(Lutaml::Model::Config.adapter_for(:yaml))
23
64
  .to be(Lutaml::Yaml::Adapter::YeptrisAdapter)
24
65
  end
25
66
 
26
- it "honors the legacy FONTIST_YAML spelling" do
27
- expect(Lutaml::Model::AdapterResolver.send(:yeptris_opted_in?)).to be(false)
67
+ it "keeps a centrally configured adapter ahead of detection" do
68
+ skip "yeptris engine not available on this platform" unless
69
+ yeptris_engine_available?
70
+
71
+ Lutaml::Model::AdapterResolver.set_adapter_type(:yaml, :standard)
28
72
 
29
- ENV["FONTIST_YAML"] = "yeptris"
30
- expect(Lutaml::Model::AdapterResolver.send(:yeptris_opted_in?)).to be(true)
73
+ expect(Lutaml::Model::Config.adapter_for(:yaml))
74
+ .not_to be(Lutaml::Yaml::Adapter::YeptrisAdapter)
31
75
  end
32
76
 
33
- it "selects yeptris with FONTIST_YAML=yeptris" do
34
- skip "yeptris engine not available on this platform" if
35
- RUBY_ENGINE == "opal"
77
+ # leptris/yeptris#863: plain string scalars must materialize as
78
+ # strings on every platform build; the 0.6.53 linux build turned
79
+ # them into single-element Arrays, corrupting checksum consumers.
80
+ it "parses plain string scalars as strings through the engine" do
81
+ skip "yeptris engine not available on this platform" unless
82
+ yeptris_engine_available?
83
+
84
+ parsed = Lutaml::Yaml::Adapter::YeptrisAdapter.parse(<<~YAML)
85
+ resources:
86
+ andale32.exe:
87
+ sha256: 0524fe42951adc3a7eb870e32f0920313c71f170c859b5f770d82b4ee111e970
88
+ YAML
36
89
 
37
- ENV["FONTIST_YAML"] = "yeptris"
38
- expect(Lutaml::Model::Config.adapter_for(:yaml)).not_to be_nil
90
+ expect(
91
+ parsed["resources"]["andale32.exe"]["sha256"],
92
+ ).to be_a(String)
39
93
  end
40
94
  end
@@ -24,7 +24,7 @@ RSpec.describe "yeptris adapter error parity" do
24
24
  nil
25
25
  end
26
26
  args = libs.flat_map { |l| ["-I", l] } + ["-e", probe]
27
- Open3.capture2e({ "FONTIST_YAML" => "yeptris" }, Gem.ruby, *args).first
27
+ Open3.capture2e(Gem.ruby, *args).first
28
28
  end
29
29
 
30
30
  def yeptris_installed?
@@ -73,11 +73,28 @@ RSpec.describe "yeptris adapter error parity" do
73
73
  # Installed is not enough: a binding/native desync (yeptris
74
74
  # 0.6.34.2 x64-mingw-ucrt) leaves the gem resolvable while every
75
75
  # parse raises. The parity contract only holds when the engines
76
- # actually answer a probe — detection then selects them.
76
+ # actually answer a probe — detection then selects them. The probe
77
+ # runs in a subprocess: the suite deliberately never loads the
78
+ # optional yeptris engine in-process, so the adapter classes are
79
+ # not referenced here.
77
80
  def yeptris_usable?
78
- yeptris_installed? &&
79
- Lutaml::Json::Adapter::YeptrisAdapter.available? &&
80
- Lutaml::Yaml::Adapter::YeptrisAdapter.available?
81
+ yeptris_installed? && yeptris_native_available?
82
+ end
83
+
84
+ def yeptris_native_available?
85
+ libs = %w[lutaml-model yeptris moxml leptris].filter_map do |g|
86
+ "#{Gem::Specification.find_by_name(g).gem_dir}/lib"
87
+ rescue Gem::LoadError
88
+ nil
89
+ end
90
+ probe = <<~RUBY
91
+ require "lutaml/json/adapter/yeptris_adapter"
92
+ require "lutaml/yaml/adapter/yeptris_adapter"
93
+ exit(Lutaml::Json::Adapter::YeptrisAdapter.available? &&
94
+ Lutaml::Yaml::Adapter::YeptrisAdapter.available? ? 0 : 1)
95
+ RUBY
96
+ args = libs.flat_map { |l| ["-I", l] } + ["-e", probe]
97
+ Open3.capture2e(Gem.ruby, *args).last.success?
81
98
  end
82
99
 
83
100
  before { skip "yeptris is not usable on this platform" unless yeptris_usable? }
@@ -47,9 +47,8 @@ RSpec.describe Lutaml::Model::AdapterResolver, ".adapter_for yeptris native dete
47
47
  it "resolves the yeptris lane when the native engine answers a probe" do
48
48
  skip "optional yeptris engine not resolvable outside the bundle" unless subprocess_yeptris_capable?
49
49
 
50
- stdout, stderr, status = Open3.capture3({ "FONTIST_YAML" => "yeptris" },
51
- RbConfig.ruby, "-I", "lib", "-e",
52
- parse_probe)
50
+ stdout, stderr, status = Open3.capture3(RbConfig.ruby, "-I", "lib",
51
+ "-e", parse_probe)
53
52
  expect(status).to be_success, stderr
54
53
  expect(stdout).to include("ADAPTER=YeptrisAdapter")
55
54
  expect(stdout).to include("PARSED=scalar")
@@ -71,9 +70,8 @@ RSpec.describe Lutaml::Model::AdapterResolver, ".adapter_for yeptris native dete
71
70
  #{parse_probe}
72
71
  RUBY
73
72
 
74
- stdout, stderr, status = Open3.capture3({ "FONTIST_YAML" => "yeptris" },
75
- RbConfig.ruby, "-I", "lib", "-e",
76
- poison)
73
+ stdout, stderr, status = Open3.capture3(RbConfig.ruby, "-I", "lib",
74
+ "-e", poison)
77
75
  expect(status).to be_success, stderr
78
76
  expect(stdout).to include("ADAPTER=StandardAdapter")
79
77
  expect(stdout).to include("PARSED=scalar")
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.170
4
+ version: 0.8.172
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-07 00:00:00.000000000 Z
11
+ date: 2026-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64