lutaml-model 0.8.170 → 0.8.171

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: ad87ede1dc1046dc1129810d396b384572f654bab3f426b303c2a26c46d30507
4
+ data.tar.gz: f0a37ec49e92932743c014ba0f8ef5f8de44dcc21fd7f0b7119090308d6089ab
5
5
  SHA512:
6
- metadata.gz: d9de4cf6473267fbe06c5b3b3b96020666ab597514d7a44a2f081a23a432b93cb3c4bf89f32b7cbfe057f4e9882eefcf687b2f1dfcbdd8de30c0ac3219589201
7
- data.tar.gz: 6a022ad30b74a4c6f5211ff2f1d484399492df597c68a3ab9efdd61e42b889577795b3b4e14dd00b90c0eb9ab84afe7730baa513cea9f307e4c498d718cc13d4
6
+ metadata.gz: 54efd8912a0ede8e60e9c2215a2819d10d7f9cd6298460bccd3bcbd2b2b0005f8ec2fe60093ee5e5a399f17460b15a352bc381858fc3d252b17ac336bb8e905b
7
+ data.tar.gz: 7816771d96e7d0751b627769bde1a609c735e9a9442f6922f07d687fe2bd614b7cd76c3599078edcc8ab1df7e7e7db0083b02a751aeb45675d668c880194a03f
@@ -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.058778864333329274,
4
+ "min_time": 0.05830439700000056,
5
+ "max_time": 0.05932801200000881,
6
6
  "allocations": 51133,
7
- "ips": 26.71070442697939
7
+ "ips": 17.012918016399507
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.07925129733333354,
11
+ "min_time": 0.07819793400000208,
12
+ "max_time": 0.08018583899999498,
13
13
  "allocations": 71910,
14
- "ips": 19.791022242118608
14
+ "ips": 12.61808997011074
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.4650558216666667,
18
+ "min_time": 0.4527184709999972,
19
+ "max_time": 0.4820626730000015,
20
20
  "allocations": 406451,
21
- "ips": 3.33350318272827
21
+ "ips": 2.150279500676286
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.63353054833334,
25
+ "min_time": 0.6305890920000081,
26
+ "max_time": 0.6364362909999954,
27
27
  "allocations": 587536,
28
- "ips": 2.403858760621466
28
+ "ips": 1.5784558497309233
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.01583877299999396,
4
+ "min_time": 0.01537591099999247,
5
+ "max_time": 0.01672697600000106,
6
6
  "allocations": 7544,
7
- "ips": 84.57050586691008
7
+ "ips": 63.136203795608495
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.14416509699999835,
11
+ "min_time": 0.14264834999998754,
12
+ "max_time": 0.145113625999997,
13
13
  "allocations": 72378,
14
- "ips": 9.731724133492762
14
+ "ips": 6.936491708530612
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.6785376123333341,
18
+ "min_time": 0.6706088810000068,
19
+ "max_time": 0.6903751819999968,
20
20
  "allocations": 259437,
21
- "ips": 2.173371925840666
21
+ "ips": 1.4737576544375057
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.07073791833333114,
4
+ "min_time": 0.06960952800000086,
5
+ "max_time": 0.07274033499999177,
6
6
  "allocations": 32998,
7
- "ips": 13.21698794792725
7
+ "ips": 14.13668967876325
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.2049442063333231,
11
+ "min_time": 0.20431456800000092,
12
+ "max_time": 0.20608122899997738,
13
13
  "allocations": 134786,
14
- "ips": 4.546001415649038
14
+ "ips": 4.879376772298657
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": 8.094979964666683,
18
+ "min_time": 8.011807766000004,
19
+ "max_time": 8.253521833999997,
20
20
  "allocations": 1733464,
21
- "ips": 0.1280690909344808
21
+ "ips": 0.1235333508377838
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.823126560000001,
25
+ "min_time": 0.8167314490000024,
26
+ "max_time": 0.8273381509999922,
27
27
  "allocations": 883501,
28
- "ips": 1.0491371688194684
28
+ "ips": 1.2148800058158722
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.3023703103333257,
4
+ "min_time": 0.3015562899999509,
5
+ "max_time": 0.3033698390000268,
6
6
  "allocations": 134002,
7
- "ips": 2.3726597993729963
7
+ "ips": 3.3072030084488926
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.3043722769999988,
4
+ "min_time": 0.2995728340000028,
5
+ "max_time": 0.3132120479999969,
6
+ "allocations": 183151,
7
+ "ips": 3.285450336858386
8
8
  },
9
9
  "medium": {
10
- "avg_time": 0.6549090059999875,
11
- "min_time": 0.6454114659999846,
12
- "max_time": 0.6686907289999908,
10
+ "avg_time": 0.7569878543333269,
11
+ "min_time": 0.7486214030000156,
12
+ "max_time": 0.7709131660000139,
13
13
  "allocations": 474403,
14
- "ips": 1.5269296815869702
14
+ "ips": 1.3210251581654398
15
15
  },
16
16
  "citygml": {
17
- "avg_time": 0.7382608636666722,
18
- "min_time": 0.7349978900000167,
19
- "max_time": 0.7414869970000098,
17
+ "avg_time": 0.8518815016666679,
18
+ "min_time": 0.8465627909999967,
19
+ "max_time": 0.8623405149999996,
20
20
  "allocations": 586804,
21
- "ips": 1.3545347575833357
21
+ "ips": 1.1738721853257112
22
22
  },
23
23
  "large": {
24
- "avg_time": 6.100064923666669,
25
- "min_time": 5.998476953000022,
26
- "max_time": 6.217400171000008,
24
+ "avg_time": 7.076599947333325,
25
+ "min_time": 6.997333662999978,
26
+ "max_time": 7.230798198000002,
27
27
  "allocations": 4531263,
28
- "ips": 0.1639326814572513
28
+ "ips": 0.14131080002294463
29
29
  }
30
30
  }
@@ -416,60 +416,30 @@ 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 (the former
428
+ # LUTAML_YAML / FONTIST_YAML spellings are not read anymore).
429
+ # The probe matters because a half-initialized Yeptris constant
430
+ # (the poison-process state the gem documents) passes
431
+ # const_defined? and require while every parse fails; without
432
+ # it the lane selection flips with process load order and the
433
+ # failure surfaces as a native parse error on valid input
434
+ # instead of a clean standard-lane parse (#978).
435
435
  def detect_yeptris_kv_adapter(format)
436
436
  default = metadata.dig(format, :default)
437
437
  return default if Lutaml::Model.opal?
438
-
439
- unless yeptris_opted_in?
440
- warn_yeptris_present_once(format)
441
- return default
442
- end
443
438
  return default unless Utils.safe_load("yeptris", :Yeptris)
444
439
 
445
440
  load_adapter(format, :yeptris).available? ? :yeptris : default
446
441
  end
447
442
 
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
443
  # Detect available XML adapter.
474
444
  #
475
445
  # 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.171"
6
6
  end
7
7
  end
@@ -2,39 +2,106 @@
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
16
51
  end
17
52
 
18
- it "selects yeptris with LUTAML_YAML=yeptris" do
53
+ def yeptris_engine_available?
54
+ return false if RUBY_ENGINE == "opal"
55
+
56
+ Lutaml::Model::Utils.safe_load("yeptris", :Yeptris)
57
+ end
58
+
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)
75
+ end
76
+
77
+ it "does not consult environment variables for engine choice" do
78
+ ENV["LUTAML_YAML"] = "standard"
79
+ ENV["FONTIST_YAML"] = "standard"
80
+
81
+ if yeptris_engine_available?
82
+ expect(Lutaml::Model::Config.adapter_for(:yaml))
83
+ .to be(Lutaml::Yaml::Adapter::YeptrisAdapter)
84
+ else
85
+ expect(Lutaml::Model::Config.adapter_for(:yaml))
86
+ .not_to be(Lutaml::Yaml::Adapter::YeptrisAdapter)
87
+ end
31
88
  end
32
89
 
33
- it "selects yeptris with FONTIST_YAML=yeptris" do
34
- skip "yeptris engine not available on this platform" if
35
- RUBY_ENGINE == "opal"
90
+ # leptris/yeptris#863: plain string scalars must materialize as
91
+ # strings on every platform build; the 0.6.53 linux build turned
92
+ # them into single-element Arrays, corrupting checksum consumers.
93
+ it "parses plain string scalars as strings through the engine" do
94
+ skip "yeptris engine not available on this platform" unless
95
+ yeptris_engine_available?
96
+
97
+ parsed = Lutaml::Yaml::Adapter::YeptrisAdapter.parse(<<~YAML)
98
+ resources:
99
+ andale32.exe:
100
+ sha256: 0524fe42951adc3a7eb870e32f0920313c71f170c859b5f770d82b4ee111e970
101
+ YAML
36
102
 
37
- ENV["FONTIST_YAML"] = "yeptris"
38
- expect(Lutaml::Model::Config.adapter_for(:yaml)).not_to be_nil
103
+ expect(
104
+ parsed["resources"]["andale32.exe"]["sha256"],
105
+ ).to be_a(String)
39
106
  end
40
107
  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.171
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-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64