suma 0.5.36 → 0.5.37

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: d74d74822e8dfd682182777697d439c65249cc71b48a83daa311c0637f6b5321
4
- data.tar.gz: 5c7b877a799c169fe3b286a662fe69c941879203f3e97a0f7c882510d9a9ca9a
3
+ metadata.gz: bea94fe44851bdeb821c7aa737d36f7185928cf57b0e573b691cee5572334d99
4
+ data.tar.gz: f9b299305d868f1752948ad164cae19f72347b9911a2547c85e8593cae9cf995
5
5
  SHA512:
6
- metadata.gz: 8b95fa69a6e698d5c10ee91a119567b2731f13de6a7135c1432bb5e2e18ef2257c6a6890ff6682ff2595ea6a09e808b15a930ffb96d56737d58786053efc8175
7
- data.tar.gz: 8dd56fc317ca56a2194e2211e0906341d44b14d0e197d5887bde063280204f3f659ae6cc11139d11548c39661fc85e88fe13e0eb4eecbb098c331ffc1e5fdb0d
6
+ metadata.gz: c1aed5fb8b9e4f65472cabd8736424d0b86e77dc6955da8b9ccf7b7d02fd7f92aeacd8c2b2e7430baaea2712049f4c62550bc08d8e69e9e68fe7ab4828f80c8b
7
+ data.tar.gz: 983717feaf8b5c99f1eb50bb5d26d2af7d66e545b2dbc9ce40c5fd50a68857923976a65fcca2ccbe88fa4ca68f828dc9555c1bbf48e24859f10eddd4b7dfed4e
@@ -143,7 +143,7 @@ module Suma
143
143
 
144
144
  def expectation_failures(result)
145
145
  expectations = load_expectations or return []
146
- expectations.violations(result.report["inventory"],
146
+ expectations.violations(result.report,
147
147
  result.report["broken_links"])
148
148
  end
149
149
 
@@ -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 +inventory+
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(inventory, broken_links)
31
- actuals(inventory, broken_links).filter_map do |name, actual|
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
- def actuals(inventory, broken_links)
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" => inventory["missing_express_pages"].size,
69
+ "missing_express_max" =>
70
+ Array(report["missing_express_pages"]).size,
67
71
  "broken_links_max" => broken_links.size,
68
72
  }
69
73
  end
@@ -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
- declarers = declaring_schemas(schema, entity_id, [])
312
- declarers.uniq.one? ? declarers.first : nil
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Suma
4
- VERSION = "0.5.36"
4
+ VERSION = "0.5.37"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: suma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.36
4
+ version: 0.5.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.