leptris 1.9.144.1 → 1.9.156.0

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: '01429a81e019ba9e4ecf9d2a7c23ada3b4d2c6dc3849c5a0be469bbab52b5c92'
4
- data.tar.gz: 21bc4d37174f592fe72821f9fd7074eb7521c7ff4eacad42141720f2e235c97b
3
+ metadata.gz: cd58b08303252f035517604c63e63c1db6583e84fb622c03026ea259fbbd0baa
4
+ data.tar.gz: 9ebde3d10256cb54d4b091257d7cc08236c10448e8b2427251c855360bd2a1e4
5
5
  SHA512:
6
- metadata.gz: 181136f9e8da6a067bba876bbbfe5e841c062470fce5c6a521de413f5abd4a33d824eb387155021b486ff5063e70d96077156b79656440ee418d4b388bc5297c
7
- data.tar.gz: 3e088d8220ec7c3c40f4e9869caf8cc73e08606ac4f7035a9f8a277454fafc1d7921c11fe17aa64f4c328254362103962bf05218385e1855c27fad3663b5b915
6
+ metadata.gz: ff02784b8881a170661ecfb091bc38a1c0d61cff7034b01aecef96a2773da963c2482d09d289978fc0d7c18e7a481417f82dd3d026afc0cfa41c79ef8eb2f0fd
7
+ data.tar.gz: c5f9ef06098af10c1b0b63b6e878b58142f814f5f111dd697080d02591839cef3cd95ff4c6168493c498ac05c3f885a3eb85341e9819b8a2bdb15e1a4e5f5212
data/CHANGELOG.md CHANGED
@@ -5,6 +5,61 @@ All notable changes to Leptris will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.9.152.1] - 2026-09-13
9
+
10
+ ### Fixed
11
+
12
+ - **#178 (ask 1): attach seams lift in-scope namespace
13
+ declarations on adoption.** The engine's attach entries move a
14
+ subtree but not the source's in-scope declarations — a
15
+ cross-document (or out-of-scope) `add_child` /
16
+ `prepend_child` / `add_next_sibling` / `add_previous_sibling` /
17
+ `Document#root=` produced serialized output with UNDECLARED
18
+ prefixes. `Element.lift_namespaces_for_adoption` snapshots the
19
+ node's scope before the move and re-declares on the moved
20
+ element everything the target does not already resolve
21
+ identically (own declarations and identical target scopes add
22
+ nothing — same-scope moves stay output-identical).
23
+
24
+ ### Added
25
+
26
+ - **#178 (ask 3): `benchmark/consumer_pipeline.rb`** — the
27
+ model-pipeline leg: a nested 7000-item document walked into
28
+ typed objects, with `GC.stat` allocation deltas (load
29
+ independent: ~799k allocations per run) and fresh-process
30
+ one-shot medians (n=9, the CLI-workload shape where YJIT never
31
+ amortizes).
32
+
33
+ ## [1.9.156.0] - 2026-09-13
34
+
35
+ ### Changed
36
+
37
+ - **Lockstep with libleptris 1.9.156** (1.9.152 → 1.9.156; audit
38
+ 290/290 — new symbol `leptris_element_create_child` attached):
39
+ pulls in the leptris/leptris#1038 heap-corruption fix — stale
40
+ root-doc map entries (pool-fallback creates + XInclude
41
+ adopted-child free) resolved freed documents after address
42
+ recycling, corrupting the heap in ~5-10% of long-running
43
+ processes; entries now die with their document. 1.9.152 and
44
+ 1.9.152.1 shipped inside the affected range (1.9.151-154).
45
+ Also rides: WHATWG `<template>` cgroup drops and `</template>`
46
+ pop-through (html5lib corpus 1200 → 1206), frame/frameset
47
+ in-template drops (1.9.154), and the lane-18 DOM perf rows.
48
+
49
+ ## [1.9.152.0] - 2026-09-13
50
+
51
+ ### Changed
52
+
53
+ - **Lockstep with libleptris 1.9.152** (1.9.144 → 1.9.152; no new
54
+ C surface — audit 289/289): the lane-18 DOM mutation performance
55
+ arc rides the binding directly — attr-heavy parse up to 2.7x
56
+ faster (1.9.147/1.9.149), the DOM create path 91.6 → 6.6 ns/op
57
+ and the append row 401 → ~258 µs (1.9.150–1.9.152), set-attr row
58
+ 390 → 262 µs. WHATWG HTML: `<template>` insertion modes
59
+ (1.9.146/1.9.148) — an open template is a scope boundary for
60
+ table-context starts, and each open template tracks its saved
61
+ insertion mode (implied tr/tbody/rows per WHATWG 13.2.6.4.10).
62
+
8
63
  ## [1.9.144.1] - 2026-09-12
9
64
 
10
65
  ### Fixed
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ RSpec::Core::RakeTask.new(:spec)
8
8
  # Pin for `rake compile` and the platform-gem builds. Keep in lockstep
9
9
  # with .github/workflows/build.yml (which calls `rake compile`) and the
10
10
  # CHANGELOG when libleptris releases.
11
- LIBLEPTRIS_VERSION = "1.9.144"
11
+ LIBLEPTRIS_VERSION = "1.9.156"
12
12
  # Vendored alongside libleptris for fn:normalize-unicode (TODO
13
13
  # .restructure/20): built per platform with a RELOCATABLE @rpath
14
14
  # install name, loaded by ffi.rb before libleptris so the
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Leptris
4
- VERSION = "1.9.144.1"
4
+ VERSION = "1.9.156.0"
5
5
  end
@@ -244,6 +244,9 @@ class Leptris::XML::Document
244
244
  # document's pool until #free).
245
245
  def root=(element)
246
246
  raise Leptris::XML::UseAfterFreeError if @freed.state == :freed
247
+ # A document root has no in-scope declarations of its own —
248
+ # lift everything the element's source scope carried (#178).
249
+ Leptris::XML::Element.lift_namespaces_for_adoption(element, {})
247
250
  Leptris::XML::FFI.check_status(
248
251
  Leptris::XML::FFI.leptris_document_set_root(@c_ptr, element.c_ptr))
249
252
  @version += 1
@@ -215,8 +215,35 @@ class Leptris::XML::Element < Leptris::XML::Node
215
215
  p ? "#{p}:#{name}" : name
216
216
  end
217
217
 
218
+ # Cross-document and cross-scope adoption (#178 ask 1): the
219
+ # engine's attach entries move a subtree but do not lift the
220
+ # source's in-scope namespace declarations, so serialized output
221
+ # can carry undeclared prefixes. Re-declares on +node+ everything
222
+ # from its in-scope set that +target_scope+ (the attach target's
223
+ # in-scope map) does not already resolve identically — the
224
+ # declarations ride the moved element, staying local to the
225
+ # adopted subtree. Call BEFORE attaching: the source scope is
226
+ # read through the node's current ancestors. Identical scopes
227
+ # (the common same-document move) add nothing.
228
+ def self.lift_namespaces_for_adoption(node, target_scope)
229
+ return unless node.is_a?(Leptris::XML::Element)
230
+ # Declarations the node already carries (its own definitions —
231
+ # preserved by the C copy and by moves) ride it as-is; lifting
232
+ # must not duplicate them, only what came from ANCESTORS.
233
+ own = node.namespace_definitions.each_with_object({}) do |ns, h|
234
+ h[ns.prefix ? "xmlns:#{ns.prefix}" : "xmlns"] = ns.href
235
+ end
236
+ node.namespaces.each do |key, uri|
237
+ next if target_scope[key] == uri || own[key] == uri
238
+ prefix = key.start_with?("xmlns:") ? key.delete_prefix("xmlns:") : nil
239
+ node.add_namespace_definition(prefix, uri)
240
+ end
241
+ nil
242
+ end
243
+
218
244
  def prepend_child(node)
219
245
  ensure_writable!
246
+ Leptris::XML::Element.lift_namespaces_for_adoption(node, namespaces)
220
247
  Leptris::XML::FFI.check_status(
221
248
  Leptris::XML::FFI.leptris_element_prepend_child(@c_ptr, node.c_ptr))
222
249
  node
@@ -224,6 +251,7 @@ class Leptris::XML::Element < Leptris::XML::Node
224
251
 
225
252
  def add_next_sibling(node)
226
253
  ensure_writable!
254
+ Leptris::XML::Element.lift_namespaces_for_adoption(node, namespaces)
227
255
  Leptris::XML::FFI.check_status(
228
256
  Leptris::XML::FFI.leptris_element_insert_after(@c_ptr, node.c_ptr))
229
257
  node
@@ -231,6 +259,7 @@ class Leptris::XML::Element < Leptris::XML::Node
231
259
 
232
260
  def add_previous_sibling(node)
233
261
  ensure_writable!
262
+ Leptris::XML::Element.lift_namespaces_for_adoption(node, namespaces)
234
263
  Leptris::XML::FFI.check_status(
235
264
  Leptris::XML::FFI.leptris_element_insert_before(@c_ptr, node.c_ptr))
236
265
  node
@@ -306,6 +335,7 @@ class Leptris::XML::Element < Leptris::XML::Node
306
335
  ensure_writable!
307
336
  case node_or_markup
308
337
  when Leptris::XML::Node
338
+ Leptris::XML::Element.lift_namespaces_for_adoption(node_or_markup, namespaces)
309
339
  Leptris::XML::FFI.check_status(
310
340
  Leptris::XML::FFI.leptris_element_append_child(@c_ptr, node_or_markup.c_ptr))
311
341
  node_or_markup
@@ -435,6 +435,8 @@ attach_function :leptris_parse_string,
435
435
 
436
436
  attach_function :leptris_element_create,
437
437
  [:leptris_document, :string], :leptris_element
438
+ attach_function :leptris_element_create_child,
439
+ [:leptris_element, :string], :leptris_element
438
440
  attach_function :leptris_element_set_name,
439
441
  [:leptris_element, :string], :leptris_status
440
442
  attach_function :leptris_element_set_text,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leptris
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.144.1
4
+ version: 1.9.156.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-09-12 00:00:00.000000000 Z
11
+ date: 2026-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi