makiri 0.2.0-aarch64-linux → 0.3.0-aarch64-linux

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.
@@ -24,7 +24,7 @@ root = File.expand_path("..", __dir__)
24
24
  spec = Gem::Specification.load(File.join(root, "makiri.gemspec"))
25
25
 
26
26
  libs = Dir[File.join(root, "lib", "makiri", "*", "makiri.{so,bundle}")].sort
27
- abort "no precompiled libraries found under lib/makiri/*/ stage them first" if libs.empty?
27
+ abort "no precompiled libraries found under lib/makiri/*/ - stage them first" if libs.empty?
28
28
 
29
29
  # Native gem: ship binaries, not the C sources or the vendored Lexbor tree, and
30
30
  # declare no extension so install never tries to compile.
@@ -34,7 +34,7 @@ spec.files = spec.files.reject { |f| f.start_with?("ext/", "vendor/") }
34
34
  spec.files += libs.map { |p| p.sub("#{root}/", "") }
35
35
  spec.files.uniq!
36
36
 
37
- # Bound the Ruby versions this binary gem serves one subdir per ABI minor.
37
+ # Bound the Ruby versions this binary gem serves - one subdir per ABI minor.
38
38
  abis = libs.map { |p| File.basename(File.dirname(p)) }.sort_by { |v| v.split(".").map(&:to_i) }
39
39
  lo_major, lo_minor = abis.first.split(".").map(&:to_i)
40
40
  hi_major, hi_minor = abis.last.split(".").map(&:to_i)
@@ -62,6 +62,38 @@ RULES = [
62
62
  message: "mkr_verified_text_t must be minted only by mkr_verified_text_from_view (the validated boundary)",
63
63
  regex: /\(\s*mkr_verified_text_t\s*\)\s*\{/
64
64
  ),
65
+ # --- HTML/XML representation boundary (see docs/html_xml_boundary_hardening) ---
66
+ # These symbols assume one DOM representation; using them outside their
67
+ # representation-correct / kind-checked home is how shared glue (XPath, NodeSet,
68
+ # node identity) silently treats an XML node as HTML (or vice versa) - an
69
+ # assert-abort or memory type-confusion. Each is allowlisted only in the files
70
+ # that legitimately own it; anywhere else trips the lint.
71
+ Rule.new(
72
+ id: "html_doc_unwrap_boundary",
73
+ message: "mkr_html_doc_unwrap is HTML-only; shared/XML code must use the kind-aware mkr_node_unwrap",
74
+ regex: /\bmkr_html_doc_unwrap\s*\(/
75
+ ),
76
+ Rule.new(
77
+ id: "parsed_html_doc_boundary",
78
+ message: "mkr_parsed_html_doc (asserts kind==HTML) may only be used in a kind-checked / HTML-only site",
79
+ regex: /\bmkr_parsed_html_doc\s*\(/
80
+ ),
81
+ Rule.new(
82
+ id: "parsed_xml_doc_boundary",
83
+ message: "mkr_parsed_xml_doc may only be used in a kind-checked / XML-representation site",
84
+ regex: /\bmkr_parsed_xml_doc\s*\(/
85
+ ),
86
+ Rule.new(
87
+ id: "owner_document_boundary",
88
+ message: "owner_document is an HTML-only lxb field; shared code must compare documents via mkr_node_document",
89
+ regex: /\bowner_document\b/
90
+ ),
91
+ Rule.new(
92
+ id: "node_raw_boundary",
93
+ message: "mkr_node_raw is the kind-agnostic raw pointer (identity / kind-guaranteed only); " \
94
+ "to dereference a node use mkr_html_node or mkr_xml_node_unwrap (kind-checked)",
95
+ regex: /\bmkr_node_raw\s*\(/
96
+ ),
65
97
  ].freeze
66
98
 
67
99
  def load_config
@@ -10,3 +10,86 @@ ignore_paths:
10
10
  - path: ext/makiri/bridge/text_token.c
11
11
  rule: verified_text_forge
12
12
  reason: mkr_verified_text_from_view, the sole sanctioned mint of mkr_verified_text_t; its input view is already validated by the bridge string helpers.
13
+ # --- HTML/XML representation boundary: each per-rep symbol is exempt only in
14
+ # the files that own it (declaration, definition, or a kind-checked use), so
15
+ # a new use anywhere else — especially shared glue — trips the lint ---
16
+ # mkr_html_doc_unwrap (HTML-only document unwrap)
17
+ - path: ext/makiri/glue/glue.h
18
+ rule: html_doc_unwrap_boundary
19
+ reason: declaration of the HTML-only document unwrap.
20
+ - path: ext/makiri/glue/ruby_doc.c
21
+ rule: html_doc_unwrap_boundary
22
+ reason: definition + HTML Document methods (parse/serialize/title/compat_mode) — all HTML-only.
23
+ - path: ext/makiri/glue/ruby_node.c
24
+ rule: html_doc_unwrap_boundary
25
+ reason: the kind-aware mkr_node_raw calls it only on its HTML branch (after a MKR_DOC_XML check).
26
+ - path: ext/makiri/glue/ruby_html_node.c
27
+ rule: html_doc_unwrap_boundary
28
+ reason: mkr_html_node_unwrap resolves an HTML Document (after rejecting an XML one at the type boundary).
29
+ - path: ext/makiri/glue/ruby_html_mutate.c
30
+ rule: html_doc_unwrap_boundary
31
+ reason: HTML tree/fragment mutation; XML mutation has its own arena path.
32
+ - path: ext/makiri/glue/ruby_xpath.c
33
+ rule: html_doc_unwrap_boundary
34
+ reason: the HTML branch of mkr_xpath_context_for, entered only after the XML kind returns early.
35
+ # mkr_parsed_html_doc (asserts kind == HTML)
36
+ - path: ext/makiri/lexbor_compat/compat.h
37
+ rule: parsed_html_doc_boundary
38
+ reason: declaration of the HTML parsed-document accessor.
39
+ - path: ext/makiri/lexbor_compat/post_parse.c
40
+ rule: parsed_html_doc_boundary
41
+ reason: definition (the kind assert lives here) + HTML post-parse pipeline.
42
+ - path: ext/makiri/glue/ruby_doc.c
43
+ rule: parsed_html_doc_boundary
44
+ reason: mkr_html_doc_unwrap is defined here over the HTML parsed document.
45
+ # mkr_parsed_xml_doc (XML arena accessor) — kept out of the pure-HTML glue files
46
+ - path: ext/makiri/lexbor_compat/compat.h
47
+ rule: parsed_xml_doc_boundary
48
+ reason: declaration of the XML parsed-document accessor.
49
+ - path: ext/makiri/lexbor_compat/post_parse.c
50
+ rule: parsed_xml_doc_boundary
51
+ reason: definition + XML document wrapping/teardown.
52
+ - path: ext/makiri/glue/ruby_xml.c
53
+ rule: parsed_xml_doc_boundary
54
+ reason: XML parse entry / Document construction.
55
+ - path: ext/makiri/glue/ruby_xml_node.c
56
+ rule: parsed_xml_doc_boundary
57
+ reason: XML node read + mutation surface over the arena.
58
+ - path: ext/makiri/glue/ruby_doc.c
59
+ rule: parsed_xml_doc_boundary
60
+ reason: shared Document glue, used only on kind-checked XML branches.
61
+ - path: ext/makiri/glue/ruby_xpath.c
62
+ rule: parsed_xml_doc_boundary
63
+ reason: the XML branch of mkr_xpath_context_for (kind-checked).
64
+ - path: ext/makiri/glue/ruby_node.c
65
+ rule: parsed_xml_doc_boundary
66
+ reason: the kind-aware mkr_node_raw resolves an XML Document only after a MKR_DOC_XML check.
67
+ # owner_document (HTML-only lxb_dom_node_t field)
68
+ - path: ext/makiri/lexbor_compat/post_parse.c
69
+ rule: owner_document_boundary
70
+ reason: mkr_lxb_document_bytes resolves a Lexbor node's owner document to size its mraw pools (HTML-only; the XML serializer uses arena_bytes instead).
71
+ - path: ext/makiri/glue/ruby_html_node.c
72
+ rule: owner_document_boundary
73
+ reason: HTML node readers operate on lxb_dom_node_t.
74
+ - path: ext/makiri/glue/ruby_doc.c
75
+ rule: owner_document_boundary
76
+ reason: HTML Document operations.
77
+ - path: ext/makiri/glue/ruby_html_mutate.c
78
+ rule: owner_document_boundary
79
+ reason: HTML tree mutation over Lexbor nodes.
80
+ - path: ext/makiri/xpath/mkr_xpath_node_access_html.h
81
+ rule: owner_document_boundary
82
+ reason: the HTML monomorphization of the engine's node-access layer.
83
+ # mkr_node_raw (kind-agnostic void* raw pointer; never dereferenced as a typed node)
84
+ - path: ext/makiri/glue/glue.h
85
+ rule: node_raw_boundary
86
+ reason: declaration of the kind-agnostic accessor.
87
+ - path: ext/makiri/glue/ruby_node.c
88
+ rule: node_raw_boundary
89
+ reason: defines mkr_node_raw / mkr_node_id (node identity — the pointer is only compared, never dereferenced).
90
+ - path: ext/makiri/glue/ruby_xpath.c
91
+ rule: node_raw_boundary
92
+ reason: the XPath context node / handler-result node, where same-document (hence the representation) is verified before the engine takes the raw pointer.
93
+ - path: ext/makiri/glue/ruby_node_set.c
94
+ rule: node_raw_boundary
95
+ reason: NodeSet.new stores representation-opaque pointers; mkr_node_raw takes a seed node's pointer only after same-document validation guarantees its kind matches the set.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: makiri
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - takahashim
@@ -77,19 +77,26 @@ files:
77
77
  - lib/makiri/3.3/makiri.so
78
78
  - lib/makiri/3.4/makiri.so
79
79
  - lib/makiri/4.0/makiri.so
80
- - lib/makiri/attribute.rb
81
- - lib/makiri/cdata.rb
80
+ - lib/makiri/attr.rb
81
+ - lib/makiri/cdata_section.rb
82
82
  - lib/makiri/comment.rb
83
+ - lib/makiri/compat_aliases.rb
83
84
  - lib/makiri/css.rb
84
85
  - lib/makiri/document.rb
85
86
  - lib/makiri/document_fragment.rb
86
87
  - lib/makiri/document_type.rb
87
88
  - lib/makiri/element.rb
89
+ - lib/makiri/html.rb
90
+ - lib/makiri/html/document.rb
91
+ - lib/makiri/html/node_methods.rb
88
92
  - lib/makiri/node.rb
89
93
  - lib/makiri/node_set.rb
90
94
  - lib/makiri/processing_instruction.rb
91
95
  - lib/makiri/text.rb
92
96
  - lib/makiri/version.rb
97
+ - lib/makiri/xml.rb
98
+ - lib/makiri/xml/document.rb
99
+ - lib/makiri/xml/node_methods.rb
93
100
  - lib/makiri/xpath.rb
94
101
  - lib/makiri/xpath_context.rb
95
102
  - script/build_native_gem.rb
data/lib/makiri/cdata.rb DELETED
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Makiri
4
- class CData < Node
5
- end
6
- end