suma 0.5.36 → 0.5.38
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 +4 -4
- data/lib/suma/cli/delivery.rb +20 -7
- data/lib/suma/delivery/cross_page_fragments.rb +10 -1
- data/lib/suma/delivery/expectations.rb +10 -6
- data/lib/suma/term_extractor.rb +11 -2
- data/lib/suma/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: afd727de6d181c16bca36f90e25d84cce00b70b3d1ff5b30190812c5dccbc4ec
|
|
4
|
+
data.tar.gz: b75f867c8e9f2a47cf380cb076938924aaaef297546244c6c29c1e09cf23b16b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 07bb788123a2cd052a2ccffd4deb2b1468f0cc6dc83cd4964c4af185ded66d037fb5fd2be2486c900759c8a3ac4e850ca138fcd23ecd57e7e4c2e69165751cbf
|
|
7
|
+
data.tar.gz: 3b0cc365321032218dd12f98752bb38d4e87569fe1487228f77d46c754e60b22a65e1066086e112943fc832a10eec7804f6f868295807e6e52e0e2b5cf4d81bb
|
data/lib/suma/cli/delivery.rb
CHANGED
|
@@ -14,8 +14,9 @@ module Suma
|
|
|
14
14
|
class Delivery < Thor
|
|
15
15
|
desc "verify SITE_DIR",
|
|
16
16
|
"Verify every link in the stitched site resolves: cross-file " \
|
|
17
|
-
"hrefs to files, fragments to anchors in their target.
|
|
18
|
-
"
|
|
17
|
+
"hrefs to files, fragments to anchors in their target. Without " \
|
|
18
|
+
"--expectations the gate is zero broken links; with one, the " \
|
|
19
|
+
"manifest's thresholds (broken_links_max included) govern. " \
|
|
19
20
|
"Intra-file fragment hrefs are reported but do not fail."
|
|
20
21
|
option :out, type: :string,
|
|
21
22
|
desc: "Also write the report as JSON to this path"
|
|
@@ -33,10 +34,22 @@ module Suma
|
|
|
33
34
|
**verify_options).verify
|
|
34
35
|
log_verify(result)
|
|
35
36
|
failures = expectation_failures(result)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
verify_failures(result, failures)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Without an expectations manifest the contract is zero broken
|
|
41
|
+
# links. With one, broken_links_max IS the broken-link contract:
|
|
42
|
+
# the unconditional raise would fire first and make the cap
|
|
43
|
+
# unreachable (TRThurman, iso-10303#835).
|
|
44
|
+
def verify_failures(result, failures)
|
|
45
|
+
if options[:expectations]
|
|
46
|
+
raise "expectations violated: #{failures.join('; ')}" unless
|
|
47
|
+
failures.empty?
|
|
48
|
+
elsif result.broken_count.zero?
|
|
49
|
+
nil
|
|
50
|
+
else
|
|
51
|
+
raise "broken links found (#{result.broken_count})"
|
|
52
|
+
end
|
|
40
53
|
end
|
|
41
54
|
|
|
42
55
|
desc "resolve-fragments SITE_DIR",
|
|
@@ -143,7 +156,7 @@ module Suma
|
|
|
143
156
|
|
|
144
157
|
def expectation_failures(result)
|
|
145
158
|
expectations = load_expectations or return []
|
|
146
|
-
expectations.violations(result.report
|
|
159
|
+
expectations.violations(result.report,
|
|
147
160
|
result.report["broken_links"])
|
|
148
161
|
end
|
|
149
162
|
|
|
@@ -106,7 +106,16 @@ module Suma
|
|
|
106
106
|
end
|
|
107
107
|
|
|
108
108
|
def relative_href(from, to)
|
|
109
|
-
|
|
109
|
+
# The path FROM the citing page's directory TO the target page's
|
|
110
|
+
# own location. Joining the target's basename loses its directory:
|
|
111
|
+
# a schema-doc page citing a member page then emitted
|
|
112
|
+
# `member_0.xml.11.html#…`, unresolvable from schema_docs/ depth
|
|
113
|
+
# (TRThurman, iso-10303#835 — every remapped link broke).
|
|
114
|
+
to.realpath.relative_path_from(from.dirname.realpath).to_s
|
|
115
|
+
rescue Errno::ENOENT
|
|
116
|
+
# The target page does not exist on disk; leave the relative
|
|
117
|
+
# computation to fail softly by naming the page as stored.
|
|
118
|
+
to.basename.to_s
|
|
110
119
|
end
|
|
111
120
|
|
|
112
121
|
def html_pages
|
|
@@ -23,12 +23,12 @@ module Suma
|
|
|
23
23
|
map "broken_links_max", to: :broken_links_max
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
# Human-readable violation lines for every threshold the +
|
|
26
|
+
# Human-readable violation lines for every threshold the +report+
|
|
27
27
|
# and +broken_links+ breach; unset thresholds stay silent. The name
|
|
28
28
|
# suffix is the comparison: `_min` floors, `_max` caps, a bare name
|
|
29
29
|
# (index_pages) is exact.
|
|
30
|
-
def violations(
|
|
31
|
-
actuals(
|
|
30
|
+
def violations(report, broken_links)
|
|
31
|
+
actuals(report, broken_links).filter_map do |name, actual|
|
|
32
32
|
limit = public_send(name) or next
|
|
33
33
|
relation = relation_of(name)
|
|
34
34
|
next if relation_met?(relation, actual, limit)
|
|
@@ -56,14 +56,18 @@ module Suma
|
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
-
# Every threshold's observed value, keyed by threshold name.
|
|
60
|
-
|
|
59
|
+
# Every threshold's observed value, keyed by threshold name. The
|
|
60
|
+
# inventory carries the shape counts; missing_express_pages is a
|
|
61
|
+
# top-level report key.
|
|
62
|
+
def actuals(report, broken_links)
|
|
63
|
+
inventory = report["inventory"] || {}
|
|
61
64
|
{
|
|
62
65
|
"sections_min" => inventory["sections"],
|
|
63
66
|
"index_pages" => inventory["index_pages"],
|
|
64
67
|
"schema_attachments_min" => inventory["schema_attachments"],
|
|
65
68
|
"schema_docs_min" => inventory["schema_docs"],
|
|
66
|
-
"missing_express_max" =>
|
|
69
|
+
"missing_express_max" =>
|
|
70
|
+
Array(report["missing_express_pages"]).size,
|
|
67
71
|
"broken_links_max" => broken_links.size,
|
|
68
72
|
}
|
|
69
73
|
end
|
data/lib/suma/term_extractor.rb
CHANGED
|
@@ -308,8 +308,17 @@ module Suma
|
|
|
308
308
|
# wrong (iso-10303#835: the declarer can sit more than one USE FROM
|
|
309
309
|
# away, and sibling branches must all be searched before settling).
|
|
310
310
|
def declaring_schema_id(schema, entity_id)
|
|
311
|
-
|
|
312
|
-
|
|
311
|
+
# The closure walk is deterministic per (schema, entity); the
|
|
312
|
+
# corpus repeats the same lookups across thousands of concepts and
|
|
313
|
+
# the walk dominated extract-terms wall time once the transitive
|
|
314
|
+
# USE FROM and REFERENCE FROM edges landed (TRThurman: 2m24s on
|
|
315
|
+
# 0.5.31 → 9m16s on 0.5.33).
|
|
316
|
+
@declaring_schema_cache ||= {}
|
|
317
|
+
@declaring_schema_cache.fetch([schema.id, entity_id]) do
|
|
318
|
+
declarers = declaring_schemas(schema, entity_id, [])
|
|
319
|
+
@declaring_schema_cache[[schema.id, entity_id]] =
|
|
320
|
+
declarers.uniq.one? ? declarers.first : nil
|
|
321
|
+
end
|
|
313
322
|
end
|
|
314
323
|
|
|
315
324
|
# Distinct schema ids within +schema+'s USE-FROM closure declaring
|
data/lib/suma/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: suma
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.38
|
|
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-
|
|
11
|
+
date: 2026-11-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|