leptris 1.9.181.0 → 1.9.186.1

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: 35e0cd2470e2f0e12a01424ec1ca0fe753d5835fc07d67ec54c2fd5ba257afcc
4
- data.tar.gz: 69a9520e7bb23117005fa8695c353f75aed6da034ca0f70e79a556c47c3df78c
3
+ metadata.gz: 5b96846659a7745d4cd915d4bb375f7081c7c5ba703bc4482fc44a3073c59961
4
+ data.tar.gz: dfed75d7ae1d31974ba748491de60e57bc4b6ecaf59902e7d53a88f6ff5ba0bb
5
5
  SHA512:
6
- metadata.gz: 7579134233ffb721e9ef41955b47389fd71ba327ca1d00d28a34bb8e72454ce23bf823ca3572b94054edb44eef68563f67a2510f6544394f36379ecc9e2f7613
7
- data.tar.gz: d23c31c7c660c429d0d05ee158028cc72adeb7b48c2917f07387e4e1a63a608c304dea736614da99c7d906bf6091d26cbac833618a0bb47b75896729ce69cf69
6
+ metadata.gz: 201cd532c264025a6a614e0f40fb576f63603175307b650a1dcd2d09dd53b74fff00bc9141e40c66246f4424643f8d4cba1439af8014d03aeb5bce0fcb12ac0c
7
+ data.tar.gz: 616ee2ad30c627196720c1be0301572cdb8e909f872f2ea78b7678eddf3b127ca43442a3e5b7ce053bce6967b45707b13ef1459b69a7341cd83c2bb220307323
data/CHANGELOG.md CHANGED
@@ -5,6 +5,43 @@ 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.186.1] - 2026-09-17
9
+
10
+ ### Added
11
+
12
+ - `RelaxNG::Schema#validate_errors(document)` — structured
13
+ `[{ line:, column:, message: }]` rows (Jing's exact attribution,
14
+ upstream #878 accumulation), for callers that need the fields
15
+ for log formatting instead of re-parsing the Jing-form strings
16
+ from `#validate`. `#validate` now renders its strings from the
17
+ same rows (one enumeration of the error surface; identical
18
+ output, including the back-compat zero-count fallback).
19
+
20
+ ## [1.9.186.0] - 2026-09-17
21
+
22
+ ### Changed — libleptris 1.9.181 → 1.9.186 (lockstep)
23
+
24
+ - **RNG regression fix (upstream #1137)**: documents omitting an
25
+ `<optional>` element failed validation since 1.9.179 — the #1121
26
+ name-mismatch diagnostics engaged the matcher's short-circuit
27
+ during backtracking probes. Verdict probes are side-effect-free
28
+ again; spec-pinned here (omitted + present forms, and error
29
+ accumulation still works).
30
+ - **Immutable parse buffer (upstream #1125, then the 1.9.185
31
+ scratch-copy scanner)**: `leptris_parse_string_inplace` never
32
+ writes the caller's buffer (attached-only in this binding; the
33
+ parse faces use the copying variant). Attr-heavy parse
34
+ allocations stay pool-backed — 39,684 mallocs for one 48 KB
35
+ document in the 1.9.182 log-replay design, now 8.
36
+ - **One arena per document (upstream #1127)**:
37
+ `leptris_document_create` routes through the arena-backed pool —
38
+ the same allocation path as the parser (the fresh-document
39
+ build lane); the dead `compact_allocator` is deleted.
40
+ - **Parse perf (upstream 1.9.185/1.9.186)**: scratch-copy scanner
41
+ (attr-heavy 472 → 70 µs vs pugixml) and chunked element-block
42
+ zeroing (tag-dense text parse −8%).
43
+ - No public-symbol changes: audit 322/322.
44
+
8
45
  ## [1.9.181.0] - 2026-09-16
9
46
 
10
47
  ### Changed — libleptris 1.9.178 → 1.9.181 (lockstep)
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.181"
11
+ LIBLEPTRIS_VERSION = "1.9.186"
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.181.0"
4
+ VERSION = "1.9.186.1"
5
5
  end
@@ -22,6 +22,7 @@ module Leptris::XML::RelaxNG
22
22
  # rng = Leptris::XML::RelaxNG.parse(schema_xml)
23
23
  # rng.valid?(doc) # => true/false
24
24
  # rng.validate(doc) # => [] or ["1:0: error: element ..."]
25
+ # rng.validate_errors(doc) # => [] or [{line:, column:, message:}]
25
26
  #
26
27
  class Schema
27
28
  # GC-managed compiled handle.
@@ -63,25 +64,45 @@ module Leptris::XML::RelaxNG
63
64
  # libleptris 1.9.179 (#878): errors accumulate — every failure
64
65
  # from the validate call is returned, not just the first.
65
66
  def validate(document)
67
+ structured = validate_errors(document)
68
+ unless structured.empty?
69
+ return structured.map do |e|
70
+ e[:line] > 0 ? "#{e[:line]}:#{e[:column]}: error: #{e[:message]}"
71
+ : e[:message]
72
+ end
73
+ end
74
+ # Invalid verdict with nothing accumulated: the back-compat
75
+ # single-error accessor is the last resort (nil-safe).
76
+ return [] if valid?(document)
77
+ [Leptris::XML::FFI.leptris_rng_error(@handle)].compact
78
+ end
79
+
80
+ def valid?(document)
81
+ Leptris::XML::FFI.leptris_rng_validate(@handle,
82
+ document.c_ptr) != 0
83
+ end
84
+
85
+ # Structured errors: [{ line:, column:, message: }] — the fields
86
+ # callers need for log formatting, instead of re-parsing the
87
+ # Jing-form strings from #validate. Empty when valid. Message,
88
+ # line, and column carry Jing's exact attribution (libleptris
89
+ # >= 1.9.179, upstream #878). This is the single enumeration of
90
+ # the error-accumulation surface; #validate renders these rows.
91
+ def validate_errors(document)
66
92
  ok = Leptris::XML::FFI.leptris_rng_validate(@handle,
67
93
  document.c_ptr)
68
94
  return [] if ok != 0
69
95
  count = Leptris::XML::FFI.leptris_rng_error_count(@handle)
70
- return [Leptris::XML::FFI.leptris_rng_error(@handle)].compact if count.zero?
71
- # Jing's rendering for every accumulated error, matching the
72
- # single-error accessor's format ("line:col: error: msg").
96
+ return [] if count.zero?
73
97
  Array.new(count) do |i|
74
98
  msg = Leptris::XML::FFI.leptris_rng_error_message(@handle, i)
75
99
  next nil if msg.nil?
76
- line = Leptris::XML::FFI.leptris_rng_error_line(@handle, i)
77
- col = Leptris::XML::FFI.leptris_rng_error_column(@handle, i)
78
- line > 0 ? "#{line}:#{col}: error: #{msg}" : msg
100
+ {
101
+ line: Leptris::XML::FFI.leptris_rng_error_line(@handle, i),
102
+ column: Leptris::XML::FFI.leptris_rng_error_column(@handle, i),
103
+ message: msg,
104
+ }
79
105
  end.compact
80
106
  end
81
-
82
- def valid?(document)
83
- Leptris::XML::FFI.leptris_rng_validate(@handle,
84
- document.c_ptr) != 0
85
- end
86
107
  end
87
108
  end
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.181.0
4
+ version: 1.9.186.1
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-16 00:00:00.000000000 Z
11
+ date: 2026-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi