expressir 2.4.88 → 2.4.89

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: 3e1d24f164cd457a1e99aff55870c0a6ee3415f67cb0ae5050c02a7b27d7c615
4
- data.tar.gz: b2c95b87b33b7f4fa612df7dcec96ad8b9fcee8f9e1e01cc78f41461e084ff34
3
+ metadata.gz: 2a780c521c53a7e1fedee062eafd8483f0e2759355953116ac63e7a07b6ad1eb
4
+ data.tar.gz: 8094678581f4c26f11e020f8ca01bb5cb00acb2913cdbb5b1d4f28b59c218b7d
5
5
  SHA512:
6
- metadata.gz: 176601aeec3f2696499a42fb31c1e9b63e6e0a297670494a3f3e64487af3aa6254f41527a34c6e4872724ab56c1dee2d54e04a260bbb405d14772495c3295cd9
7
- data.tar.gz: dae9fbddee198d7423af937025f67471e7269f068b439cbca2872c7e49fbf1563d137787bdb609c44d0d62b276f4bcb9b1b58506d7e7554d7ecaf19049804d57
6
+ metadata.gz: af935ffb222723fc93b73c550a5be3c8661e1231be9257b679fe881f6cf50eedfdafdf19daaf05ea09e670ee0e3c3ad97935d7ca0ec0ba52f2192db5471ee795
7
+ data.tar.gz: 07375c0e8fb3977584cc5110bad2537edc17c8f53434a44bd1d1c0a790b9001d4a1aec65f5dc4e9abc154f2d23a330b63e62602ad3371083c4892a7a812639fb
data/ENGINE-COMPAT.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
- "engine_commit": "2b0c6fdde8e1aae8fbc48fc1724a789ff7fe1ebb",
3
- "rubygems": "2.4.83",
4
- "ext": "v0.1.63",
2
+ "engine_commit": "4d45ce7dc2cef17e5d7abf3ed7afb6c35a28388f",
3
+ "rubygems": "2.4.88",
4
+ "ext": "v0.1.66",
5
5
  "crates": "1.5.1",
6
6
  "npm": null,
7
7
  "pypi": null,
8
- "released_at": "2026-11-25T00:00:00Z",
8
+ "released_at": "2026-11-26T00:00:00Z",
9
9
  "_comment": "expressir#618 \u2014 the engine-compat manifest, mirroring parsanol-rs#423. Maps the expressir gem train to the expressir-rs ext tag and its engine commit; the null fields fill as the crates/npm/pypi tiers land (expressir#619/#622/#621). tools/check_engine_compat.rb verifies the pairings in CI; every release train updates this file."
10
10
  }
@@ -13,7 +13,7 @@ magnus = { version = "0.9" }
13
13
  # Pinned core release (M1, TODO.parity-ee/19): the ext never floats
14
14
  # main — bump the tag per expressir release, alongside the validation
15
15
  # run that pins it.
16
- expressir = { git = "https://github.com/lutaml/expressir-rs", tag = "v0.1.63" }
16
+ expressir = { git = "https://github.com/lutaml/expressir-rs", tag = "v0.1.66" }
17
17
  serde_json = "1.0"
18
18
 
19
19
 
@@ -783,6 +783,7 @@ fn init(ruby: &Ruby) -> Result<(), Error> {
783
783
  module.define_singleton_method("lsp_rename_edits", function!(lsp_rename_edits, 2))?;
784
784
  module.define_singleton_method("write_set", function!(set_write, 3))?;
785
785
  module.define_singleton_method("concat_schema", function!(concat_schema, 2))?;
786
+ module.define_singleton_method("flatten_schema", function!(flatten_schema, 3))?;
786
787
  let batch_class = module.define_class("BatchStream", ruby.class_object())?;
787
788
  batch_class.define_singleton_method("start", function!(batch_start, 2))?;
788
789
  batch_class.define_method("next", method!(batch_next, 0))?;
@@ -823,3 +824,21 @@ fn concat_schema(ruby: &Ruby, wire_json: String, root_id: String) -> Result<RArr
823
824
  out.push(ruby.str_new(&artifact));
824
825
  Ok(out)
825
826
  }
827
+
828
+ /// The SHTOLO longform over a hydrated repository (#636): the full
829
+ /// stage order runs in Rust over the repository's flat wire. Returns
830
+ /// the longform schema wire JSON string.
831
+ fn flatten_schema(
832
+ ruby: &Ruby,
833
+ wire_json: String,
834
+ root_id: String,
835
+ longform_name: String,
836
+ ) -> Result<String, Error> {
837
+ let wire: serde_json::Value = serde_json::from_str(&wire_json).map_err(|e| {
838
+ Error::new(ruby.exception_runtime_error(), format!("wire json: {e}"))
839
+ })?;
840
+ let longform = expressir::expand::shtolo_flatten(&root_id, &wire, &longform_name);
841
+ serde_json::to_string(&longform).map_err(|e| {
842
+ Error::new(ruby.exception_runtime_error(), format!("serialize: {e}"))
843
+ })
844
+ }
@@ -271,9 +271,25 @@ module Expressir
271
271
  wire = JSON.generate(
272
272
  "schemas" => Array(repository.schemas).map(&:to_hash),
273
273
  )
274
- ids, artifact = ::Expressir::Core.concat_schema(wire, root.id)
274
+ root_id = root.respond_to?(:id) ? root.id : root.to_s
275
+ ids, artifact = ::Expressir::Core.concat_schema(wire, root_id)
275
276
  [ids, artifact]
276
277
  end
278
+
279
+ # The SHTOLO longform over a resolved repository (#636): the
280
+ # full stage order runs in Rust over the repository's flat wire.
281
+ # Returns the longform schema's wire JSON string.
282
+ def self.flatten_schema(repository, root, longform_name)
283
+ unless NATIVE_AVAILABLE && ::Expressir::Core.respond_to?(:flatten_schema)
284
+ raise NotImplementedError, "core flatten unavailable"
285
+ end
286
+
287
+ root_id = root.respond_to?(:id) ? root.id : root.to_s
288
+ wire = JSON.generate(
289
+ "schemas" => Array(repository.schemas).map(&:to_hash),
290
+ )
291
+ ::Expressir::Core.flatten_schema(wire, root_id, longform_name)
292
+ end
277
293
  end
278
294
  end
279
295
  end
@@ -28,7 +28,23 @@ module Expressir
28
28
  current_node_path_parts = current_node.path.split(".")
29
29
  return node.id if node_base_path_parts[0..1] == current_node_path_parts[0..1]
30
30
 
31
- "{{{<<express:#{node.base_path},#{node.id}>>}}}"
31
+ # The anchor namespace keys on schema.item, not on the
32
+ # file-prefixed path: the file rides the filesystem path as
33
+ # its id (model/exp_file), so base_path carries
34
+ # `<path>.exp.schema.item` and the link must shed the file
35
+ # part (#786) — otherwise no listing link finds its target on
36
+ # the document pages. Strip up to the LAST `.exp.` boundary
37
+ # (the greedy form WG 12's templates apply as a workaround),
38
+ # which also covers nested items (`schema.entity.attr`) and
39
+ # absolute paths.
40
+ exp_boundary = node_base_path_parts.rindex("exp")
41
+ anchor = if exp_boundary
42
+ node_base_path_parts[(exp_boundary + 1)..].join(".")
43
+ else
44
+ node.base_path
45
+ end
46
+
47
+ "{{{<<express:#{anchor},#{node.id}>>}}}"
32
48
  end
33
49
  end
34
50
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "json"
4
+
3
5
  module Expressir
4
6
  module Express
5
7
  # SHTOLO — short-to-long conversion per ISO 10303-11:2004 Annex G
@@ -52,10 +54,45 @@ module Expressir
52
54
  end
53
55
 
54
56
  def flatten
57
+ return native_flatten if native_available? && native_options?
58
+
55
59
  @schema = build_longform
56
60
  self
57
61
  end
58
62
 
63
+ # The Rust flatten runs one fixed pipeline: stage :longform, the
64
+ # annex G.1.9 prune on, extenders :all. Any other option set takes
65
+ # the Ruby stages (the binding carries no options).
66
+ def native_options?
67
+ @stage == :longform && @prune && @extenders == :all
68
+ end
69
+
70
+ # The Rust flatten runs the full stage order over the resolved
71
+ # repository's wire and hydrates the longform schema from the
72
+ # returned wire (#636). The Ruby stages stay as the no-native
73
+ # fallback; the oracle differential gates both.
74
+ def native_flatten
75
+ raise NotImplementedError, "core flatten unavailable" unless
76
+ Expressir::Express::Core::NATIVE_AVAILABLE &&
77
+ ::Expressir::Core.respond_to?(:flatten_schema)
78
+
79
+ wire = Expressir::Express::Core.flatten_schema(@repository, @root.id, @longform_name)
80
+ schema = Expressir::Model::ExpFile.from_hash(
81
+ # The G.1.6 dependent-instantiability rule chains its REFERENCE
82
+ # union left-deep, one level per entry over the whole closure —
83
+ # real modules reach hundreds of levels, past JSON.parse's
84
+ # default cap of 100.
85
+ "schemas" => [JSON.parse(wire, max_nesting: 1_000_000)],
86
+ )&.schemas&.first
87
+ @schema = schema
88
+ self
89
+ end
90
+
91
+ def native_available?
92
+ Expressir::Express::Core::NATIVE_AVAILABLE &&
93
+ ::Expressir::Core.respond_to?(:flatten_schema)
94
+ end
95
+
59
96
  IdPlan = Struct.new(:global, :own_by_schema, keyword_init: true) do
60
97
  def own(schema)
61
98
  own_by_schema[schema] || {}
@@ -384,7 +421,7 @@ module Expressir
384
421
 
385
422
  remarks = ["Original 2003 schemas:"] + names.map do |id|
386
423
  contributing = closure.values.find { |s| s.id == id }
387
- version = contributing&.version&.id
424
+ version = contributing&.version&.value
388
425
  line = "schema = #{id};"
389
426
  line = "schema = #{id} schema_version_id = '#{version}';" if version
390
427
  line
@@ -3,6 +3,6 @@ module Expressir
3
3
  # autoload it (Ruby autoload only works for module/class constants, not
4
4
  # for string constants like `Expressir::VERSION`).
5
5
  module Version
6
- VERSION = "2.4.88".freeze
6
+ VERSION = "2.4.89".freeze
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: expressir
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.88
4
+ version: 2.4.89
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.