ambitgraph 0.9.3__tar.gz → 0.9.5__tar.gz

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.
Files changed (116) hide show
  1. {ambitgraph-0.9.3/ambitgraph.egg-info → ambitgraph-0.9.5}/PKG-INFO +1 -1
  2. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/_delimited.py +28 -7
  3. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/edges.py +65 -9
  4. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/jscalls.py +22 -18
  5. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/langs.py +109 -19
  6. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/omniscient_next/library.js +35 -9
  7. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/omniscient_next/next_embed.css +1 -0
  8. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/symbols.py +858 -86
  9. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/tables.py +80 -3
  10. {ambitgraph-0.9.3 → ambitgraph-0.9.5/ambitgraph.egg-info}/PKG-INFO +1 -1
  11. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/pyproject.toml +1 -1
  12. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/LICENSE +0 -0
  13. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/MANIFEST.in +0 -0
  14. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/README.md +0 -0
  15. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_contracts/__init__.py +0 -0
  16. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_contracts/edge.py +0 -0
  17. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_contracts/envelope.py +0 -0
  18. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_contracts/fields.py +0 -0
  19. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_contracts/grant.py +0 -0
  20. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_contracts/household.py +0 -0
  21. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_map/__init__.py +0 -0
  22. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_map/__main__.py +0 -0
  23. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_map/ambit-map-enrich.md +0 -0
  24. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_map/ambit-mapllm-contract.md +0 -0
  25. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_map/assistant.py +0 -0
  26. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_map/cli.py +0 -0
  27. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_map/daemon.py +0 -0
  28. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_map/dialects/__init__.py +0 -0
  29. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_map/dialects/contract.py +0 -0
  30. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_map/dialects/express_pack.py +0 -0
  31. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_map/dialects/fastapi_pack.py +0 -0
  32. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_map/dialects/flask_pack.py +0 -0
  33. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_map/dialects/nextjs_pack.py +0 -0
  34. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_map/dialects/supabase_pack.py +0 -0
  35. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_map/langmirror.py +0 -0
  36. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_map/load.py +0 -0
  37. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_map/mapllm.py +0 -0
  38. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_map/model.py +0 -0
  39. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_map/orchestrate.py +0 -0
  40. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_map/registry.py +0 -0
  41. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_map/serve.py +0 -0
  42. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_telegraph/__init__.py +0 -0
  43. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_telegraph/cli.py +0 -0
  44. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_telegraph/export.py +0 -0
  45. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_telegraph/ledger.py +0 -0
  46. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_telegraph/responsibility.py +0 -0
  47. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambit_telegraph/store.py +0 -0
  48. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/WALKTHROUGH.md +0 -0
  49. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/__init__.py +0 -0
  50. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/__main__.py +0 -0
  51. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/cli.py +0 -0
  52. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/cockpit.py +0 -0
  53. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/codelib.py +0 -0
  54. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/config.py +0 -0
  55. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/console.py +0 -0
  56. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/demo.py +0 -0
  57. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/design_tokens.py +0 -0
  58. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/docs_discovery.py +0 -0
  59. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/doctor.py +0 -0
  60. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/duplication.py +0 -0
  61. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/emit.py +0 -0
  62. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/engine_identity.py +0 -0
  63. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/estimate.py +0 -0
  64. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/eval.py +0 -0
  65. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/explain.py +0 -0
  66. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/explain_stage.py +0 -0
  67. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/families.py +0 -0
  68. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/feeds.py +0 -0
  69. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/gate.py +0 -0
  70. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/gate_check.py +0 -0
  71. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/gate_server.py +0 -0
  72. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/harvest.py +0 -0
  73. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/html_safe.py +0 -0
  74. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/inventory.py +0 -0
  75. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/jsobjects.py +0 -0
  76. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/mds.py +0 -0
  77. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/merge.py +0 -0
  78. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/merge_jsp.py +0 -0
  79. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/objects.py +0 -0
  80. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/omniscient_next/__init__.py +0 -0
  81. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/omniscient_next/_init_js.py +0 -0
  82. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/omniscient_next/charts.js +0 -0
  83. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/omniscient_next/classdiagram.js +0 -0
  84. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/omniscient_next/escape.js +0 -0
  85. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/omniscient_next/filterpanel.js +0 -0
  86. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/omniscient_next/graph.js +0 -0
  87. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/omniscient_next/insideview.js +0 -0
  88. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/omniscient_next/objectcard.js +0 -0
  89. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/omniscient_next/paths.js +0 -0
  90. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/omniscient_next/search.js +0 -0
  91. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/omniscient_next/siderail.js +0 -0
  92. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/omniscient_next/standalone.py +0 -0
  93. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/omniscient_next/wholemap.js +0 -0
  94. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/parameterize.py +0 -0
  95. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/pipeline.py +0 -0
  96. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/portal.py +0 -0
  97. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/prompts.py +0 -0
  98. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/pycalls.py +0 -0
  99. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/pyshapes.py +0 -0
  100. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/ratify.py +0 -0
  101. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/report.py +0 -0
  102. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/reports.py +0 -0
  103. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/responsibility.py +0 -0
  104. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/sample.py +0 -0
  105. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/secretary.py +0 -0
  106. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/shell.py +0 -0
  107. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/stages.py +0 -0
  108. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/tasks.py +0 -0
  109. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/text_capture.py +0 -0
  110. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph/urcode.py +0 -0
  111. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph.egg-info/SOURCES.txt +0 -0
  112. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph.egg-info/dependency_links.txt +0 -0
  113. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph.egg-info/entry_points.txt +0 -0
  114. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph.egg-info/requires.txt +0 -0
  115. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/ambitgraph.egg-info/top_level.txt +0 -0
  116. {ambitgraph-0.9.3 → ambitgraph-0.9.5}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ambitgraph
3
- Version: 0.9.3
3
+ Version: 0.9.5
4
4
  Summary: Read-only codebase scan: reusable units, families, roles, ownership candidates, duplication.
5
5
  Author: AmbitGraph
6
6
  License: Proprietary
@@ -7,6 +7,12 @@ reaching sideways. symbols re-exports the name, so `from
7
7
  ambitgraph.symbols import Delimited` remains the working spelling.
8
8
  """
9
9
 
10
+ # Each closing bracket a hole may end with, and the bracket that opens its
11
+ # pair. A hole's closer is one of these keys: the hole walk counts the pairs
12
+ # of that bracket inside the hole's code, so a pair's own closing bracket
13
+ # does not end the hole.
14
+ OPENING_BRACKET_OF = {"}": "{", ")": "(", "]": "["}
15
+
10
16
 
11
17
  class Delimited(object):
12
18
  """A delimited-span spec, its fields addressed by name rather than position.
@@ -17,12 +23,12 @@ class Delimited(object):
17
23
 
18
24
  __slots__ = ("pattern", "closer", "doubled_closer_escapes",
19
25
  "strict_unterminated", "escapes", "hole_open", "hole_close",
20
- "hole_nested", "hole_quotes", "single_line")
26
+ "hole_nested", "hole_quotes", "single_line", "quoted_string")
21
27
 
22
28
  def __init__(self, pattern, closer, doubled_closer_escapes=False,
23
29
  strict_unterminated=False, escapes=False, hole_open="",
24
30
  hole_close="", hole_nested=(), hole_quotes=(),
25
- single_line=False):
31
+ single_line=False, quoted_string=False):
26
32
  """Build a frozen spec, rejecting any construction that would be silently misread.
27
33
 
28
34
  @param pattern: the span opener, a regex pattern compiled by the
@@ -37,22 +43,28 @@ class Delimited(object):
37
43
  honored and skipped during the closer scan (bool)
38
44
  @param hole_open: the interpolation hole's opening marker,
39
45
  declared together with hole_close or not at all (str)
40
- @param hole_close: the interpolation hole's closing marker,
41
- declared together with hole_open or not at all (str)
46
+ @param hole_close: the interpolation hole's closing marker, one
47
+ closing bracket (a key of OPENING_BRACKET_OF), declared
48
+ together with hole_open or not at all (str)
42
49
  @param hole_nested: the spec set a hole's own nested literals
43
50
  match against; empty means every spec passed in (tuple)
44
51
  @param hole_quotes: the quote characters recognized as opening an
45
52
  escape-aware quoted span inside a hole (tuple)
46
53
  @param single_line: whether the closer scan stops at the first
47
54
  newline; needs escapes or a hole to engage that scan (bool)
55
+ @param quoted_string: whether the form is a quoted string, whose
56
+ delimiters are blanked with its body where strings are
57
+ blanked; off, the delimiters stay as code there (bool)
48
58
  @raises TypeError: when a flag parameter is not a bool
49
59
  @raises ValueError: when hole_open and hole_close are not declared
50
- together, or single_line is set without escapes or a hole
60
+ together, hole_close is not one closing bracket, or
61
+ single_line is set without escapes or a hole
51
62
  """
52
63
  for name, flag in (("doubled_closer_escapes", doubled_closer_escapes),
53
64
  ("strict_unterminated", strict_unterminated),
54
65
  ("escapes", escapes),
55
- ("single_line", single_line)):
66
+ ("single_line", single_line),
67
+ ("quoted_string", quoted_string)):
56
68
  # name, flag: each flag field paired with its own attribute name
57
69
  if not isinstance(flag, bool):
58
70
  raise TypeError(
@@ -65,6 +77,14 @@ class Delimited(object):
65
77
  raise ValueError(
66
78
  "hole_open and hole_close are declared together or not at "
67
79
  "all; a half-declared hole would open spans it cannot close")
80
+ if hole_close and hole_close not in OPENING_BRACKET_OF:
81
+ raise ValueError(
82
+ "hole_close must be one closing bracket (%s), got %r: the "
83
+ "hole walk counts the bracket pairs inside a hole by the "
84
+ "bracket that closes it, and a hole closed by anything else "
85
+ "would be walked without that count -- ended at the first "
86
+ "closer that belongs to the code inside it"
87
+ % (", ".join(sorted(OPENING_BRACKET_OF)), hole_close))
68
88
  if single_line and not (escapes or hole_open):
69
89
  raise ValueError(
70
90
  "single_line needs escapes or a hole to route to the "
@@ -86,6 +106,7 @@ class Delimited(object):
86
106
  object.__setattr__(self, "hole_nested", tuple(hole_nested))
87
107
  object.__setattr__(self, "hole_quotes", tuple(hole_quotes))
88
108
  object.__setattr__(self, "single_line", single_line)
109
+ object.__setattr__(self, "quoted_string", quoted_string)
89
110
 
90
111
  def __setattr__(self, *a):
91
112
  """Refuse any attribute assignment; a Delimited is frozen after construction.
@@ -103,7 +124,7 @@ class Delimited(object):
103
124
  return (self.pattern, self.closer, self.doubled_closer_escapes,
104
125
  self.strict_unterminated, self.escapes, self.hole_open,
105
126
  self.hole_close, self.hole_nested, self.hole_quotes,
106
- self.single_line)
127
+ self.single_line, self.quoted_string)
107
128
 
108
129
  def __hash__(self):
109
130
  """Return the spec's hash, derived from every field.
@@ -964,6 +964,10 @@ _PY_IMPORT = re.compile(r'(?m)^[ \t]*import\s+([\w.]+)')
964
964
  _PY_FROM_IMPORT = re.compile(r'(?m)^[ \t]*from\s+(\.*)([\w.]*)\s+import\b')
965
965
  _JS_REQUIRE = re.compile(r'\brequire\(\s*["\']([^"\']+)["\']\s*\)')
966
966
  _JS_IMPORT = re.compile(r'\bimport\b[^;\n"\']*?\bfrom\s+["\']([^"\']+)["\']')
967
+ # The coverage key counting the matches of the two patterns above that the
968
+ # JavaScript include lane leaves out because the keyword stands in a string's
969
+ # text. Present only when nonzero.
970
+ JS_INCLUDE_IN_STRING_DROPPED = "js_include_in_string_dropped"
967
971
  # ONE regex covers all
968
972
  # four import shapes (static-wildcard/wildcard/static/plain) --
969
973
  # classification happens in code, on the SAME match, from the `static`/
@@ -2367,9 +2371,40 @@ def extract_includes_for_file(uid: str, ext: str, raw: str, webroot: str,
2367
2371
  # `tsconfig_cfg` is optional so every existing caller keeps
2368
2372
  # working; absent, aliases simply do not resolve (never a guessed
2369
2373
  # one) and everything else still does.
2374
+ #
2375
+ # A match counts only where its keyword stands in code. The
2376
+ # comments-only view this lane reads keeps every string's text, so an
2377
+ # import or a require spelled inside a string matches too. The check
2378
+ # is jscalls' two-view cross-check over the keyword and what follows
2379
+ # it up to the specifier's opening quote: the code view blanks every
2380
+ # string, so that stretch reads alike in both views only where it is
2381
+ # code. Where the code view says "in a string", the view that keeps a
2382
+ # hole's code is asked: a require written in a template literal's
2383
+ # `${...}` is code there, and a template literal the string reader
2384
+ # declined is kept there as written, so its matches stay as they
2385
+ # were. A match that is text in both is left out and counted. Each
2386
+ # view is built once per file, the second only for a file that
2387
+ # needs it.
2388
+ code_view = None # the code view, built at the first match
2389
+ hole_code_view = None # the view keeping a hole's code, built at the first match in a string
2390
+ in_string = 0 # the matches left out for standing in a string's text
2370
2391
  for pattern, kind in ((_JS_REQUIRE, "require"),
2371
2392
  (_JS_IMPORT, "import")):
2372
2393
  for m in pattern.finditer(blanked):
2394
+ # the keyword up to the specifier's opening quote: the quoted
2395
+ # specifier is blanked by the code view wherever it stands
2396
+ clause = (m.start(), m.start(1) - 1)
2397
+ if code_view is None:
2398
+ code_view = (cache.blanked_for_ext(uid, ext) if cache is not None
2399
+ else sym.blank_for_ext(ext, raw))
2400
+ if not jscalls._two_view_real(code_view, blanked, clause):
2401
+ if hole_code_view is None:
2402
+ hole_code_view = (
2403
+ cache.blanked_keeping_hole_code(uid, ext) if cache is not None
2404
+ else sym.blank_for_ext(ext, raw, keep_hole_code=True))
2405
+ if not jscalls._two_view_real(hole_code_view, blanked, clause):
2406
+ in_string += 1
2407
+ continue
2373
2408
  spec = m.group(1)
2374
2409
  resolved_uid, _method, _alias = resolve_js_specifier(
2375
2410
  spec, uid, tsconfig_cfg or {}, known_uids)
@@ -2378,14 +2413,15 @@ def extract_includes_for_file(uid: str, ext: str, raw: str, webroot: str,
2378
2413
  "kind": kind,
2379
2414
  "line": blanked.count("\n", 0, m.start()) + 1,
2380
2415
  "resolved": resolved_uid is not None})
2381
- # ADD-not-REDIRECT -- the two loops above are byte-unchanged;
2382
- # these are NEW rows, from the SAME hoisted `js_facts` pass
2383
- # build_call_graph already shares, never a second read/re-parse of
2384
- # this file. `js_facts` is optional and defaults to None so every
2385
- # existing caller of this function (including every test that
2386
- # calls it directly without threading facts) keeps producing
2387
- # exactly the rows it always did -- the same tsconfig_cfg
2388
- # precedent.
2416
+ if in_string and coverage_out is not None:
2417
+ coverage_out[JS_INCLUDE_IN_STRING_DROPPED] = (
2418
+ coverage_out.get(JS_INCLUDE_IN_STRING_DROPPED, 0) + in_string)
2419
+ # ADD-not-REDIRECT -- the rows below are NEW rows, from the SAME
2420
+ # hoisted `js_facts` pass build_call_graph already shares, never a
2421
+ # second read/re-parse of this file. `js_facts` is optional and
2422
+ # defaults to None, so a caller that threads no facts (every test
2423
+ # that calls this function directly included) gets none of these
2424
+ # rows -- the same tsconfig_cfg precedent.
2389
2425
  if js_facts is not None:
2390
2426
  for site in js_facts.reexports:
2391
2427
  resolved_uid, _method, _alias = resolve_js_specifier(
@@ -2804,8 +2840,11 @@ def _collect_js_facts(files: list, repo: Path, cache=None) -> tuple:
2804
2840
  # straight through instead of a second, uncached computation
2805
2841
  comments_blanked = (
2806
2842
  cache.blanked_comments_only(uid, ext) if cache is not None else None)
2843
+ # the code view too: the include lane reads the same one from the cache
2844
+ full_blanked = cache.blanked_for_ext(uid, ext) if cache is not None else None
2807
2845
  facts[uid] = jscalls.extract_js_file_facts(
2808
- raw, ext, MIN_CALL_NAME_LEN, comments_blanked=comments_blanked)
2846
+ raw, ext, MIN_CALL_NAME_LEN, comments_blanked=comments_blanked,
2847
+ full_blanked=full_blanked)
2809
2848
  return facts, sorted(unreadable)
2810
2849
 
2811
2850
 
@@ -6950,6 +6989,18 @@ def build_edges_artifact(repo, symbols_artifact: dict, cfg, *,
6950
6989
  # channel systems. JS/TS only, 0 on every corpus with none.
6951
6990
  "event_sites_refused": event_sites_refused,
6952
6991
  }
6992
+ # the files whose block comment never closes, as the table plane listed
6993
+ # them: the text after such a comment's opener was not read. Present only
6994
+ # when there is such a file, so a scan with none carries no key; its
6995
+ # sentence rides table_result["blind"] under the same condition.
6996
+ if table_result.get("comment_unclosed_files"):
6997
+ coverage["comment_unclosed_files"] = table_result["comment_unclosed_files"]
6998
+ # the files, each with its lines, where a string that holds code could not
6999
+ # be closed and was read as ending at its first closing quote. Present
7000
+ # only when there is such a string; its sentence rides
7001
+ # table_result["blind"] under the same condition.
7002
+ if table_result.get("string_reader_declined"):
7003
+ coverage["string_reader_declined"] = table_result["string_reader_declined"]
6953
7004
  # The java exact-evidence tiers' counters: each token is its own
6954
7005
  # flat, additive coverage key, present only when nonzero -- a scan
6955
7006
  # with no such site (every non-java corpus included) carries none of
@@ -6972,6 +7023,11 @@ def build_edges_artifact(repo, symbols_artifact: dict, cfg, *,
6972
7023
  if len(counted_files) > JAVA_CALL_COUNTER_SAMPLE_CAP:
6973
7024
  coverage["java_call_counter_samples_omitted"] = (
6974
7025
  len(counted_files) - JAVA_CALL_COUNTER_SAMPLE_CAP)
7026
+ # the JavaScript include lane's matches left out for standing in a
7027
+ # string's text: a flat coverage key, present only when nonzero, like
7028
+ # the counters below
7029
+ if import_coverage.get(JS_INCLUDE_IN_STRING_DROPPED):
7030
+ coverage[JS_INCLUDE_IN_STRING_DROPPED] = import_coverage[JS_INCLUDE_IN_STRING_DROPPED]
6975
7031
  # the C include lane's cause counters -- each its own flat,
6976
7032
  # additive coverage key, present only when nonzero, the same home
6977
7033
  # java_import_cross_root_held and the java call counters already
@@ -374,24 +374,24 @@ def _extract_import_bindings(full_blanked: str, comments_blanked: str) -> tuple:
374
374
  `comments_blanked` match's own offsets is always a valid, aligned
375
375
  slice.
376
376
 
377
- The statement-position guard (a residual of the two-view cross-check):
378
- a NESTED template literal defeats the span cross-check above --
379
- symbols.py's own blank() closes the OUTER backtick span at the INNER
380
- literal's own opening backtick (it is not nesting-aware), so
381
- `` const s = `outer ${`inner import { x } from "y"`} end` `` reads
382
- the inner literal's content as live code in BOTH blanked variants:
383
- the clause compares equal, and the false edge from the cross-check
384
- comes back through one more layer of the same string-content problem. Zero
385
- corpus incidence (zero nested template literals in any of the 4
386
- reference corpora), but the mechanism is real. FIXED by a second,
387
- independent guard: a genuine import/require statement must sit at a
377
+ The statement-position guard, a second and independent one. The span
378
+ cross-check above holds only where the blanker ends a string where the
379
+ language does. A template literal standing inside another's `${...}`
380
+ is read as part of the outer string, so
381
+ `` const s = `outer ${`inner import { x } from "y"`} end` `` is one
382
+ blanked span in `full_blanked` and the cross-check discards the clause
383
+ by itself. A literal the blanker CANNOT close is another matter: it is
384
+ read as ending at its first backtick (symbols.blank's `report` lists
385
+ its line), and the rest of its text then reads as live code in BOTH
386
+ blanked variants -- the clause compares equal. So a genuine
387
+ import/require statement must also sit at a
388
388
  STATEMENT position in the fully blanked text -- the text on its own
389
389
  line before the keyword, right-stripped, must be empty (statement is
390
390
  the first thing on the line) or end in one of `;{}()` (immediately
391
- follows a statement/block boundary or an opening paren). Text
392
- embedded inside a template literal's `${...}` interpolation or a
393
- nested literal's own content never satisfies this (it sits after
394
- ordinary prose characters, not a statement terminator) -- see
391
+ follows a statement/block boundary or an opening paren). String text
392
+ that follows a word on its line does not satisfy this; string text
393
+ that begins a line of its own does, which is why this guard stands
394
+ behind the cross-check and not in its place -- see
395
395
  _at_statement_position below, the sole home of this check.
396
396
 
397
397
  Also returns `lines`, bound_name -> the 1-based line of
@@ -1321,7 +1321,8 @@ def resolve_default_export_name(blanked: str):
1321
1321
  # ===========================================================================
1322
1322
 
1323
1323
  def extract_js_file_facts(raw: str, ext: str, min_name_len: int, *,
1324
- comments_blanked: str | None = None) -> JsFileFacts:
1324
+ comments_blanked: str | None = None,
1325
+ full_blanked: str | None = None) -> JsFileFacts:
1325
1326
  """`ext` is always the file's REAL dotted extension (".ts", ".tsx",
1326
1327
  ".js", ...) -- a bare "js" (no
1327
1328
  dot) makes symbols.lang_for_ext return None, and both blank_for_ext /
@@ -1337,10 +1338,13 @@ def extract_js_file_facts(raw: str, ext: str, min_name_len: int, *,
1337
1338
  function would otherwise derive itself. None, the default, computes
1338
1339
  that view here exactly as before, so every direct caller that does
1339
1340
  not know about a cache -- every existing call site, and every test --
1340
- is unaffected."""
1341
+ is unaffected. `full_blanked`, the file's code view, is the same
1342
+ matter: given by a caller holding the cache, so the scan builds that
1343
+ view once per file; None computes it here."""
1341
1344
  comments_blanked = (comments_blanked if comments_blanked is not None
1342
1345
  else sym.blank_comments_only(ext, raw))
1343
- full_blanked = sym.blank_for_ext(ext, raw)
1346
+ full_blanked = (full_blanked if full_blanked is not None
1347
+ else sym.blank_for_ext(ext, raw))
1344
1348
  import_bindings, import_binding_lines = _extract_import_bindings(
1345
1349
  full_blanked, comments_blanked)
1346
1350
  dynamic_imports, dynamic_imports_refused = _extract_dynamic_imports(
@@ -110,6 +110,27 @@ ENGINE_DEFAULT_INCLUDE_EXT = (
110
110
  # functions via a bare alias -- see that module for the algorithms.
111
111
  # ===========================================================================
112
112
 
113
+ # HOW AN ENTRY'S STRINGS HOLD CODE. In some languages a string may hold code
114
+ # -- `${...}` in a JavaScript template literal or a Kotlin string, `#{...}`
115
+ # in Ruby -- and that code may hold further strings. A reader that ends a
116
+ # string at the first quote it meets then ends the OUTER string at an inner
117
+ # one's opening quote, takes the inner string's text for code and the code
118
+ # after it for text. Every entry of the three language-keyed tables below
119
+ # therefore SAYS how its strings hold code, in one of these ways:
120
+ # - a `delimited` or `preserve_delimited` spec that declares a hole: the
121
+ # delimited-span walk in symbols.py reads the string and the code in it;
122
+ # - `python_fstrings=True`: Python's formatted strings, read by their own
123
+ # grammar in symbols.py;
124
+ # - `string_reader="<name>"`: a reader registered in symbols.py under that
125
+ # name;
126
+ # - `string_reader=READER_OWED`: the language's strings DO hold code and
127
+ # nothing reads it yet, so such a string is still ended at the first
128
+ # quote;
129
+ # - `string_reader=None`: the language's strings hold no code.
130
+ # tests/test_string_code_plants.py fails for an entry that says none of
131
+ # these, and pins which entries carry READER_OWED so the mark cannot spread.
132
+ READER_OWED = "owed"
133
+
113
134
  # Keyed by LANG TAG -- one entry per grammar'd language that carries its
114
135
  # lexical shape here, the dict itself being the roster rather than a count
115
136
  # restated above it. "jsp" deliberately has NONE: its own lexical shape lives
@@ -156,10 +177,43 @@ _LANG_BLANK_CONFIG = {
156
177
  # pre-existing verbatim-even-if-unterminated behavior, see blank()'s
157
178
  # own docstring on that parameter. See tests/test_langs_java_w1.py's
158
179
  # comments-only-direction pin.
180
+ # string_reader=None: no string form of Java holds code.
159
181
  "java": dict(line_comments=("//",), block_comments=(("/*", "*/"),),
160
- strings=('"', "'"), triple_quotes=('"""',)),
182
+ strings=('"', "'"), triple_quotes=('"""',), string_reader=None),
183
+ # THE BACKTICK IS NOT IN `strings`, BECAUSE A TEMPLATE LITERAL HOLDS CODE:
184
+ # `${...}` is a hole, and the code in it may hold another template
185
+ # literal -- `${ok ? `/*.js` : ``}` is ONE string. Filed under `strings`
186
+ # it would end at the inner literal's opening backtick and the inner text
187
+ # would be read as code: here a comment opener, blanking the file up to
188
+ # the next real comment; elsewhere a function, an import or a call the
189
+ # file never wrote. So the form is declared as a delimited span with
190
+ # a hole, and the walk reads it: backslash escapes honoured, `${` opening
191
+ # the hole and the `}` at brace depth zero closing it, a plain quoted
192
+ # string inside the hole skipped whole, a template literal inside it read
193
+ # by the same spec, a comment inside it read as a comment.
194
+ #
195
+ # `preserve_delimited`, as Go's raw string below and for the same reason:
196
+ # the comments-only view keeps the literal's text (an import path, a
197
+ # table statement) and the code view reads the key as `delimited`.
198
+ # `quoted_string=True` because, unlike Go's raw string, this form is
199
+ # read as a quoted string by the code view's readers: the symbol and call
200
+ # scans rely on its backticks being blanked with its body, as every
201
+ # other quote character is.
202
+ #
203
+ # TWO LIMITS. A regular-expression literal inside a hole is not known for
204
+ # one, so a backtick, quote or brace in it is read as code's own, and a
205
+ # `//` or `/*` in it makes the hole's two readings (with comments and
206
+ # without) disagree. Code in a hole is blanked with the literal in the
207
+ # code view, so a call written there draws no call row. A literal the walk
208
+ # cannot close -- or whose hole holds a comment with the hole's closer in
209
+ # it -- is read as ending at its first backtick, and its line is listed
210
+ # (see symbols.blank's `report`). TypeScript reads this entry too.
161
211
  "js": dict(line_comments=("//",), block_comments=(("/*", "*/"),),
162
- strings=('"', "'", "`")),
212
+ strings=('"', "'"),
213
+ preserve_delimited=(Delimited(r"`", "%s`", escapes=True,
214
+ hole_open="${", hole_close="}",
215
+ hole_quotes=('"', "'"),
216
+ quoted_string=True),)),
163
217
  # `python_fstrings=True` teaches blank() the PEP 701 (Python 3.12+)
164
218
  # formatted-string grammar -- an f/t-prefixed string may legally nest
165
219
  # a string using the SAME quote inside a {replacement field}
@@ -170,9 +224,13 @@ _LANG_BLANK_CONFIG = {
170
224
  # f-strings at all, so that entry never opts in.
171
225
  "py": dict(line_comments=("#",), strings=('"', "'"),
172
226
  triple_quotes=('"""', "'''"), python_fstrings=True),
173
- "sh": dict(line_comments=("#",), strings=('"', "'")),
227
+ # READER_OWED: a double-quoted shell string holds commands in `$(...)`
228
+ # and in backticks.
229
+ "sh": dict(line_comments=("#",), strings=('"', "'"),
230
+ string_reader=READER_OWED),
231
+ # string_reader=None: an SQL string literal holds no code.
174
232
  "sql": dict(line_comments=("--",), block_comments=(("/*", "*/"),),
175
- strings=("'",)),
233
+ strings=("'",), string_reader=None),
176
234
  # keyed `strings`, never `preserve_strings`: the comments-only seam
177
235
  # (ambitgraph.symbols.blank_comments_only's shared non-jsp branch)
178
236
  # pops THIS table's `strings` entry into `preserve_strings` for
@@ -182,8 +240,9 @@ _LANG_BLANK_CONFIG = {
182
240
  # language's string protection on that one seam (the seam include
183
241
  # extraction reads). Pinned by fixture in
184
242
  # tests/test_langs_value_pins.py.
243
+ # string_reader=None: a C string holds no code.
185
244
  "c": dict(line_comments=("//",), block_comments=(("/*", "*/"),),
186
- strings=('"', "'")),
245
+ strings=('"', "'"), string_reader=None),
187
246
  # C++ shares C's lexical shape and adds ONE form C has no equivalent of:
188
247
  # the raw string literal `R"delim( ... )delim"`. It is declared through
189
248
  # blank()'s generic `delimited` capability -- an opener carrying a
@@ -197,9 +256,11 @@ _LANG_BLANK_CONFIG = {
197
256
  # where the escape-aware string branch would consume the closer and run
198
257
  # to end of file. The delimiter charset and its 16-character cap are the
199
258
  # standard's, not a convenience of this table.
259
+ # string_reader=None: a C++ string, raw or not, holds no code.
200
260
  "cpp": dict(line_comments=("//",), block_comments=(("/*", "*/"),),
201
261
  strings=('"', "'"),
202
- delimited=(Delimited(r'R"([^()\\\s]{0,16})\(', ')%s"'),)),
262
+ delimited=(Delimited(r'R"([^()\\\s]{0,16})\(', ')%s"'),),
263
+ string_reader=None),
203
264
  # "=begin"/"=end" is Ruby's own block-comment form, recognized
204
265
  # positionally anywhere on its own line -- the same approximation
205
266
  # block_comments already makes for every other language here. This
@@ -212,9 +273,11 @@ _LANG_BLANK_CONFIG = {
212
273
  # string branch below ever runs -- so a quoted opener such as
213
274
  # `<<~'HTML'` is consumed atomically as one token instead of leaving
214
275
  # its own quote characters for the string branch to mis-scan.
276
+ # READER_OWED: a double-quoted Ruby string holds code in `#{...}`.
215
277
  "rb": dict(line_comments=("#",),
216
278
  line_anchored_block_comments=(("=begin", "=end"),),
217
- strings=('"', "'"), heredocs=True),
279
+ strings=('"', "'"), heredocs=True,
280
+ string_reader=READER_OWED),
218
281
  # SWIFT. Two `delimited` specs and nothing else new: Swift's raw
219
282
  # strings are the delimiter-echo form C++ landed the primitive for,
220
283
  # so this row PARAMETERIZES an existing mechanism rather than adding one.
@@ -229,11 +292,14 @@ _LANG_BLANK_CONFIG = {
229
292
  # it spells both String and Character with double quotes, and `'a'` is not
230
293
  # valid Swift. Declaring a delimiter a language lacks can only ever OPEN a
231
294
  # span that should not exist; it can never prevent one.
295
+ #
296
+ # READER_OWED: a Swift string holds code in `\(...)`.
232
297
  "swift": dict(line_comments=("//",), block_comments=(("/*", "*/"),),
233
298
  strings=('"',),
234
299
  triple_quotes=('"""',),
235
300
  delimited=(Delimited(r'(#+)"""', '"""%s'), # BLOCK FORM FIRST
236
- Delimited(r'(#+)"', '"%s'))),
301
+ Delimited(r'(#+)"', '"%s')),
302
+ string_reader=READER_OWED),
237
303
  # THE BACKTICK IS NOT A STRING QUOTE, AND FILING IT AS ONE WAS THE DEFECT
238
304
  # THIS ENTRY CLOSED. Go's raw form is escape-FREE: `C:\` is a
239
305
  # complete, legal raw string ending in a backslash. An escape-AWARE scan
@@ -269,10 +335,13 @@ _LANG_BLANK_CONFIG = {
269
335
  # (spelled BY NAME since the named-fields migration): one stray backtick
270
336
  # would otherwise preserve the whole remainder of the file and mint every
271
337
  # SQL-shaped comment in it. Measured reachable, not a precaution.
338
+ #
339
+ # string_reader=None: a Go string, raw or not, holds no code.
272
340
  "go": dict(line_comments=("//",), block_comments=(("/*", "*/"),),
273
341
  strings=('"', "'"),
274
342
  preserve_delimited=(Delimited(r"`", "%s`",
275
- strict_unterminated=True),)),
343
+ strict_unterminated=True),),
344
+ string_reader=None),
276
345
  }
277
346
 
278
347
  # Comment/string delimiter rules for languages
@@ -334,8 +403,10 @@ _GRAMMARLESS_BLANK_CONFIG = {
334
403
  # parsing Rust char-literal syntax, which is exactly the parser this
335
404
  # map's own scope fence refuses to become. Pinned as a known,
336
405
  # line-bounded gap in tests/test_mapllm_blank.py.
406
+ # string_reader=None: a Rust string holds no code (a format string names
407
+ # arguments; it holds no expression).
337
408
  ".rs": dict(line_comments=("//",), block_comments=(("/*", "*/"),),
338
- preserve_strings=('"',)),
409
+ preserve_strings=('"',), string_reader=None),
339
410
  # already admitted by ENGINE_DEFAULT_INCLUDE_EXT today -- the identical
340
411
  # hazard, closed the same way, at the same near-zero cost.
341
412
  # .php/.cs -- both
@@ -344,17 +415,21 @@ _GRAMMARLESS_BLANK_CONFIG = {
344
415
  # near-zero cost. Heredoc/nowdoc (.php) and verbatim `@"..."` strings
345
416
  # (.cs) are not modeled -- the same minimalism this whole map already
346
417
  # applies elsewhere.
418
+ # READER_OWED, both: a double-quoted PHP string holds code in `{$...}`,
419
+ # and a C# interpolated string (`$"..."`) holds code in `{...}`.
347
420
  ".php": dict(line_comments=("//", "#"), block_comments=(("/*", "*/"),),
348
- preserve_strings=('"', "'")),
421
+ preserve_strings=('"', "'"), string_reader=READER_OWED),
349
422
  ".cs": dict(line_comments=("//",), block_comments=(("/*", "*/"),),
350
- preserve_strings=('"', "'")),
423
+ preserve_strings=('"', "'"), string_reader=READER_OWED),
351
424
  # THE CLOSURE FIX: .css and .html are BOTH
352
425
  # grammarless and BOTH in ENGINE_DEFAULT_INCLUDE_EXT -- the identical
353
426
  # hazard as .go/.php/.cs, left open by the earlier round of this
354
427
  # fix. CSS strings are meaningfully quoted (url() arguments, content:
355
428
  # values, attribute selectors like `[data-x="y"]`) so preserving them
356
429
  # is correct, the same reasoning as every code language above.
357
- ".css": dict(block_comments=(("/*", "*/"),), preserve_strings=('"', "'")),
430
+ # string_reader=None: a CSS string holds no code.
431
+ ".css": dict(block_comments=(("/*", "*/"),), preserve_strings=('"', "'"),
432
+ string_reader=None),
358
433
  # HTML gets NO preserve_strings, deliberately, unlike every other
359
434
  # entry in this map: this is THE SAME LESSON ambitgraph/symbols.py's
360
435
  # own "THE BLANKING MODEL for JSP" comment already tells -- ordinary
@@ -369,7 +444,8 @@ _GRAMMARLESS_BLANK_CONFIG = {
369
444
  # them, unblanked, the exact class this fix exists to close). Only
370
445
  # the block-comment delimiter is recognized; every quote character in
371
446
  # HTML markup or prose is ordinary text here.
372
- ".html": dict(block_comments=(("<!--", "-->"),)),
447
+ # string_reader=None: this entry reads no string at all, so none holds code.
448
+ ".html": dict(block_comments=(("<!--", "-->"),), string_reader=None),
373
449
  # KOTLIN. Admitted by ambit_map.langmirror.MAPLLM_EXTRA_INCLUDE_EXT (the
374
450
  # mapllm extra-extensions lane), grammarless: no LangSpec, no
375
451
  # extractor. Without an entry here blank_comments_only FAILS OPEN through
@@ -404,15 +480,28 @@ _GRAMMARLESS_BLANK_CONFIG = {
404
480
  # comments are read. Guarded by tests/test_mapllm_blank.py ::
405
481
  # test_kotlin_nested_block_comments_are_read_as_one_comment, named by
406
482
  # symbol rather than by line because offsets go stale as code moves.
483
+ #
484
+ # string_reader names blank()'s Kotlin reader because A KOTLIN STRING MAY
485
+ # HOLD CODE: `"${if (deep) "/**/*.kt" else "/*.kt"}"` is ONE string, and
486
+ # the quotes inside its template belong to inner strings. The general
487
+ # string branch ends a string at the first unescaped quote, so it takes
488
+ # the inner strings' text for code -- and that text here spells a block
489
+ # comment opener. With nesting on, that false opener raises the depth,
490
+ # the file's next real comment cannot bring it back to zero, and the rest
491
+ # of the file is blanked: every table statement after it is lost. The
492
+ # reader ends the string where the language does. It is named here, not
493
+ # passed as a function, because this module is the lexical TABLE and
494
+ # symbols.py, which holds the readers, imports it. Guarded by
495
+ # tests/test_kotlin_string_templates.py.
407
496
  ".kt": dict(line_comments=("//",), block_comments=(("/*", "*/"),),
408
497
  preserve_strings=('"', "'"), preserve_triple_quotes=('"""',),
409
- nested_block_comments=True),
498
+ nested_block_comments=True, string_reader="kotlin"),
410
499
  # KOTLIN SCRIPT. A VALUE COPY of ".kt" above, deliberately spelled out
411
500
  # rather than aliased: this map is read as a table, and an entry that is a
412
501
  # reference reads as a different KIND of thing than its neighbours. .kts is
413
502
  # the same language and the same lexer -- build.gradle.kts is Kotlin -- so
414
- # every word of the ".kt" comment above, INCLUDING THE NESTING OPT-IN,
415
- # applies here unchanged. Admitted in the same commit as .kt because
503
+ # every word of the ".kt" comment above, INCLUDING THE NESTING OPT-IN
504
+ # AND THE STRING READER, applies here unchanged. Admitted in the same commit as .kt because
416
505
  # admitting one without the other leaves the other's files unmanifested,
417
506
  # and an unadmitted extension is not reported as skipped -- it is simply
418
507
  # absent from every coverage surface, so the miss is silent. Measured on
@@ -420,7 +509,7 @@ _GRAMMARLESS_BLANK_CONFIG = {
420
509
  # .kt and 44 .kts, so dropping .kts would hide 44 of 617 Kotlin files.
421
510
  ".kts": dict(line_comments=("//",), block_comments=(("/*", "*/"),),
422
511
  preserve_strings=('"', "'"), preserve_triple_quotes=('"""',),
423
- nested_block_comments=True),
512
+ nested_block_comments=True, string_reader="kotlin"),
424
513
  }
425
514
 
426
515
  # THE BLANKING MODEL for JSP's own host-language lexical shape -- the
@@ -440,8 +529,9 @@ _JSP_CODE_SPAN = re.compile(r"<%([!@=]?)(.*?)%>", re.S)
440
529
  # to cover. See symbols.py's own comment above _blank_lang_interior for
441
530
  # the full mechanism this table feeds.
442
531
  _LANG_INTERIOR_BLANK_CONFIG = {
532
+ # string_reader=None: no string form of Java holds code.
443
533
  "java": dict(line_comments=("//",), block_comments=(("/*", "*/"),),
444
- interior_blank_strings=('"', "'")),
534
+ interior_blank_strings=('"', "'"), string_reader=None),
445
535
  }
446
536
 
447
537
 
@@ -619,7 +619,8 @@ class LibraryView {
619
619
  return known.concat(rest).map(family => [family, groups.get(family)]);
620
620
  }
621
621
 
622
- /* One family's line of figures, every count naming the set it counted.
622
+ /* One family's line of figures, every count naming the set it counted,
623
+ returned as a list so the caller can draw each figure whole.
623
624
 
624
625
  ⚠ A COUNT WHOSE POPULATION IS UNSTATED IS READ AGAINST THE WRONG ONE.
625
626
  "Documented 6" alone gets checked against a file's own total and reads as
@@ -631,10 +632,26 @@ class LibraryView {
631
632
  callers the engine resolved for its name — a class is constructed — but
632
633
  only where that name belongs to it alone in the file; where a name is
633
634
  shared, the engine's answer cannot be attributed and the row is given
634
- nothing. So "Called from other files N" would be a floor rather than a
635
- figure, and "Not called 19", which is read off as the remainder, would
636
- count the unattributable rows as measured zeros. A family of callables
637
- has no such gap: every row there was looked for by name.
635
+ nothing. A definition nothing constructs is given nothing too, since only
636
+ a caller the engine found is ever attached to one. So "Called from other
637
+ files N" would be a floor rather than a figure, and a row given nothing
638
+ could be either kind, so neither of the other two figures could count it
639
+ truthfully.
640
+
641
+ ⚠ IN A FAMILY OF CALLABLES EACH ROW IS COUNTED BY WHAT ITS OWN ENTRY
642
+ SAYS, never as a remainder, and all three reach figures are about OTHER
643
+ files. "Not called from other files" counts the rows the scan looked for
644
+ callers of in other files and found none, where no other file of the
645
+ same language defines the name: each such row's entry says so, or, on a
646
+ test file, the note above the sections says once that the test runner
647
+ calls them. A row used inside its own file is among them. Every other
648
+ row without a caller goes under "Calls not traced": a kind its language
649
+ does not trace, a name its lane holds back, a name too short to trace, a
650
+ later row of a same-name group (its calls are counted at the group's
651
+ first row), or a name other files of its language define too, whose
652
+ calls by that name alone are not linked to any of them. The three
653
+ figures still sum to the family's total, and the third is drawn only
654
+ when some row went untraced.
638
655
 
639
656
  "Documented N of M" stays either way: every row carries its own words or
640
657
  does not, and nothing about that is attributed. */
@@ -642,12 +659,18 @@ class LibraryView {
642
659
  const total = rows.length;
643
660
  const documented = rows.filter(r => r.doc).length;
644
661
  const fromElsewhere = rows.filter(r => r.callers && r.callers.length).length;
662
+ // the rows looked for in other files with none found, whose name no other
663
+ // file of the same language defines
664
+ const notCalled = rows.filter(r =>
665
+ r.callers && !r.callers.length && !r.ambiguous_definers).length;
645
666
  const callTargets = rows.filter(r => this._callableKinds.has(r.kind)).length;
646
667
  const figures = ["Documented " + documented + " of " + total];
647
668
  // only where every row counted could have had callers found for it
648
669
  if (!fnNote && total && callTargets === total) {
670
+ const notTraced = total - fromElsewhere - notCalled;
649
671
  figures.push("Called from other files " + fromElsewhere);
650
- figures.push("Not called " + (total - fromElsewhere));
672
+ figures.push("Not called from other files " + notCalled);
673
+ if (notTraced) figures.push("Calls not traced " + notTraced);
651
674
  }
652
675
  // the kinds inside a family, when it holds more than one of them
653
676
  const kinds = {};
@@ -656,7 +679,7 @@ class LibraryView {
656
679
  figures.push(Object.keys(kinds).sort()
657
680
  .map(k => k + " " + kinds[k]).join(", "));
658
681
  }
659
- return figures.join(" · ");
682
+ return figures;
660
683
  }
661
684
 
662
685
  /* One foldable section heading.
@@ -814,8 +837,11 @@ class LibraryView {
814
837
  const key = "kind:" + family;
815
838
  h += this._sectionHead(key, this._familyNoun(family) + " · " + rows.length);
816
839
  if (this._folded(key)) return;
817
- h += '<div class="lb-sub">' +
818
- esc(this._familyFigures(rows, n.fn_note)) + "</div>";
840
+ // each figure in its own unbreakable span: the line has a fixed width,
841
+ // so a long one wraps between figures, never between a label and its number
842
+ h += '<div class="lb-sub">' + this._familyFigures(rows, n.fn_note)
843
+ .map(figure => '<span class="lb-fig">' + esc(figure) + "</span>")
844
+ .join(" · ") + "</div>";
819
845
  if (n.fn_note) h += '<div class="lb-sub">' + esc(n.fn_note) + "</div>";
820
846
  // the key the drawings are read with, once, and only while one is open
821
847
  if (Object.keys(this._state.diagrams).length) h += CodeCharts.legend();