gabriel / musehub public
test_intelligence.py python
460 lines 23.9 KB
Raw
sha256:b4b999434d042d74edc7032f1f2cfd20fda5b3580fe85966351db5b8eef0abb3 feat(intel): every grammar on the hub, and every intel job … Opus 5.5 minor ⚠ breaking 1 day ago
1 """DOC_INT — /muse/intelligence contract (musehub#248, QA contract v2).
2
3 Every claim on the page was checked against muse 0.2.1rc20 (muse ``dev`` 5becda10) on
4 2026-11-07, in an offline sandbox fixture repository (sandbox HOME, keychain disabled, no
5 identity, no remotes); the notes for the code-intelligence tickets fixed in muse 0.2.2rc5
6 (muse#177 #179 #181–#185 #187–#190) were re-checked against 0.2.2rc5 on 2026-11-15. These tests
7 re-run the page's own commands through the real CLI against a tiny throwaway repo built here, and
8 pin the corrected output shapes and algorithm notes so a future drift in either the engine or the
9 page fails loudly. Known product defects stay documented as contract plus warning (#241
10 defect-preservation rule): the page keeps its documented contract and links the filed ticket;
11 these tests pin both the warning text and the ticket number. A fixed defect's test runs the CLI,
12 asserts the fixed behaviour, and asserts the page no longer links the ticket. Rendering is the
13 shared in-process fixture (no database, no lifespan).
14 """
15
16 from __future__ import annotations
17
18 import html as html_lib
19 import json
20 import os
21 import pathlib
22 import re
23 import subprocess
24 import sys
25
26 import pytest
27
28 from tests.docs_contract import registry_check as rc
29
30 PAGE = rc.phase_path("intelligence")
31 MUSE_ISSUES = "https://staging.musehub.ai/gabriel/muse/issues/"
32
33 # Product tickets filed under #248 (assigned to gabriel). Only muse#186 is still open on the page.
34 _T_IMPACT_EP = 186 # impact: entry_points covers only the target, not callers in the blast radius
35 # Fixed in muse 0.2.2rc5: the page describes the fixed behaviour and no longer links these.
36 _T_ENTANGLE_LINK = 177 # entangle: structurally_linked was always false for Python imports
37 _T_GRAVITY_BIG = 179 # gravity/blast-risk: one Python file > 2 MiB emptied the whole call graph
38 _T_FS_NAME = 181 # find-symbol --name matches symbol names
39 _T_BRK_STALE = 182 # breakage stale-import check was hard-coded to the `muse` package
40 _T_DEPS_REV = 183 # deps --reverse missed `from pkg.mod import name` importers
41 _T_COV_TRANSITIVE = 184 # semantic-test-coverage --transitive without --depth stayed at depth 1
42 _T_DEPTH = 185 # impact/deps: out-of-range --depth tracebacked instead of a usage error
43 _T_LINEAGE_RENAME = 187 # lineage never reported renamed_from/moved_from for code-domain renames
44 _T_MOVE_BARE_ADDR = 188 # symbol ops under a file move/rename carried bare names
45 _T_STC_JSON_GATE = 189 # semantic-test-coverage --min-coverage --json always exited 0
46 _T_NARR_FASTPATH = 190 # narrative's default walk included commits unreachable from HEAD
47 CURRENT_MUSE = "0.2.2rc5"
48
49 MUSE_SRC = str(pathlib.Path(__file__).resolve().parents[2].parent / "muse")
50
51
52 @pytest.fixture(scope="module")
53 def html(rendered: dict[str, str]) -> str:
54 return rendered[PAGE].replace("'", "'").replace(""", '"').replace(""", '"')
55
56
57 def _text(fragment: str) -> str:
58 return html_lib.unescape(re.sub(r"<[^>]+>", "", fragment))
59
60
61 def _section(html: str, anchor: str) -> str:
62 rest = html.split(f'id="{anchor}"', 1)[1]
63 return " ".join(_text(rest.split("</section>", 1)[0]).split())
64
65
66 def _env(tmp: pathlib.Path) -> dict[str, str]:
67 home = tmp / "home"
68 home.mkdir(exist_ok=True)
69 env = {k: v for k, v in os.environ.items() if not k.startswith(("MUSE_", "GIT_"))}
70 env.update(HOME=str(home), XDG_CONFIG_HOME=str(home / ".config"), MUSE_KEYCHAIN_BACKEND="disabled",
71 PYTHON_KEYRING_BACKEND="keyring.backends.fail.Keyring", NO_COLOR="1",
72 PYTHONPATH=os.pathsep.join([MUSE_SRC, *(p for p in sys.path if p)]))
73 return env
74
75
76 def _cli(repo: pathlib.Path, env: dict[str, str], args: tuple[str, ...]) -> dict:
77 cmd = [sys.executable, "-c", "import sys; from muse.cli.app import main; main(sys.argv[1:])", *args]
78 p = subprocess.run(cmd, cwd=repo, env=env, capture_output=True, text=True, timeout=60)
79 return {"rc": p.returncode, "out": p.stdout + p.stderr, "stdout": p.stdout}
80
81
82 @pytest.fixture()
83 def fixture_repo(tmp_path: pathlib.Path) -> tuple[pathlib.Path, dict[str, str]]:
84 """A tiny code-domain repo: a billing module, an API caller, a test, and a file move+rename."""
85 repo = tmp_path / "repo"
86 repo.mkdir()
87 env = _env(tmp_path)
88 assert _cli(repo, env, ("init",))["rc"] == 0
89
90 (repo / "src").mkdir()
91 (repo / "src" / "orders.py").write_text(
92 "def calc_total(items):\n return sum(i['price'] for i in items)\n")
93 assert _cli(repo, env, ("code", "add", "."))["rc"] == 0
94 assert _cli(repo, env, ("commit", "-m", "initial"))["rc"] == 0
95
96 (repo / "src" / "billing.py").write_text(
97 "def compute_total(items):\n return sum(i['price'] for i in items)\n")
98 (repo / "src" / "orders.py").unlink()
99 (repo / "src" / "api.py").write_text(
100 "from src.billing import compute_total\n\n\ndef create_order(payload):\n return compute_total(payload)\n")
101 (repo / "tests").mkdir()
102 (repo / "tests" / "test_billing.py").write_text(
103 "from src.billing import compute_total\n\n\ndef test_total():\n assert compute_total([]) == 0\n")
104 assert _cli(repo, env, ("code", "add", "."))["rc"] == 0
105 assert _cli(repo, env, ("commit", "-m", "move to billing"))["rc"] == 0
106 return repo, env
107
108
109 def _json(repo: pathlib.Path, env: dict[str, str], *args: str, rc: int = 0) -> dict:
110 out = _cli(repo, env, ("code", *args, "--json"))
111 assert out["rc"] == rc, out["out"]
112 return json.loads(out["stdout"])
113
114
115 def _commit(repo: pathlib.Path, env: dict[str, str], message: str) -> str:
116 assert _cli(repo, env, ("code", "add", "."))["rc"] == 0
117 assert _cli(repo, env, ("commit", "-m", message))["rc"] == 0
118 head = _cli(repo, env, ("rev-parse", "HEAD"))
119 assert head["rc"] == 0, head["out"]
120 return head["stdout"].strip()
121
122
123 def _no_link(html: str, ticket: int) -> None:
124 assert f"{MUSE_ISSUES}{ticket}" not in html, f"the page still links fixed muse#{ticket}"
125
126
127 # ── Page renders and basics ──────────────────────────────────────────────────
128
129
130 def test_page_renders(rendered: dict[str, str]) -> None:
131 assert rendered[PAGE] # the fixture already asserts 200; this just documents the page under test
132
133
134 def test_symbol_kind_list_matches_the_engine(html: str) -> None:
135 sect = _section(html, "symbol-graph")
136 for present in ("section", "rule", "mixin", "object"):
137 assert present in sect, f"SymbolKind {present!r} missing from the documented kind list"
138 # isolate the `kind` row only: raw HTML up to the next </tr>, not the flattened whole section
139 raw_sect = html.split('id="symbol-graph"', 1)[1].split("</section>", 1)[0]
140 kind_row = re.search(r"<tr>\s*<td><code>kind</code></td>.*?</tr>", raw_sect, re.S)
141 assert kind_row, "SymbolRecord `kind` row not found"
142 kind_words = _text(kind_row.group(0)).split()
143 for absent in ("file", "directory"):
144 assert absent not in kind_words, f"stale SymbolKind {absent!r} still documented"
145
146
147 # ── find-symbol: --name is broken (DOC_INT, known issue) ────────────────────
148
149
150 def test_find_symbol_name_matches_and_the_page_says_so(html: str, fixture_repo: tuple) -> None:
151 """muse#181 fixed in 0.2.2rc5: --name matches the symbol name; the page no longer warns about it."""
152 repo, env = fixture_repo
153 result = _json(repo, env, "find-symbol", "--name", "compute_total")
154 assert result.get("total", 0) > 0, "find-symbol --name matches nothing again: restore the known-issue note"
155 assert f"{MUSE_ISSUES}{_T_FS_NAME}" not in html
156
157
158 # ── Known-issue notes: contract kept, warning present, real ticket number ───
159
160
161 @pytest.mark.parametrize(("anchor", "ticket_num"), [
162 ("impact", _T_IMPACT_EP),
163 ])
164 def test_known_issue_links_a_real_ticket(html: str, anchor: str, ticket_num: int) -> None:
165 sect = _section(html, anchor)
166 assert f"{MUSE_ISSUES}{ticket_num}" in html, f"#{anchor} should link muse#{ticket_num}"
167 assert f"Known issue in muse {CURRENT_MUSE}" in sect
168
169
170 def test_no_known_issue_note_cites_an_old_release(html: str) -> None:
171 """Every remaining known-issue note names the current release, not the one first audited."""
172 text = _text(html)
173 assert "Known issue in muse 0.2.1rc20" not in text and "Known issues in muse 0.2.1rc20" not in text
174 assert "see the known issue under" not in text, "a cross-reference points at a removed known-issue note"
175
176
177 def test_impact_entry_points_still_target_only(fixture_repo: tuple) -> None:
178 """muse#186 is open: a caller that is a route is not reported, so the note stays."""
179 repo, env = fixture_repo
180 out = _json(repo, env, "impact", "src/billing.py::compute_total")
181 assert "src/api.py::create_order" in out["blast_radius"]["1"]
182 assert "entry_points" not in out and "entry_points_reached" not in out, \
183 "impact now reports callers' entry points: update the #impact note and muse#186"
184
185
186 # ── Fixed in muse 0.2.2rc5: CLI behaviour pinned, ticket link gone ──────────
187
188
189 def test_entangle_links_python_imports_and_the_page_says_so(html: str, fixture_repo: tuple) -> None:
190 """muse#177: a `from src.billing import compute_total` importer is structurally linked."""
191 repo, env = fixture_repo
192 for k in (1, 2):
193 (repo / "src" / "billing.py").write_text(
194 f"def compute_total(items):\n return sum(i['price'] for i in items) + {k}\n")
195 (repo / "src" / "api.py").write_text(
196 "from src.billing import compute_total\n\n\n"
197 f"def create_order(payload):\n return compute_total(payload) * {k + 1}\n")
198 _commit(repo, env, f"co-change {k}")
199 pair = ("src/api.py::create_order", "src/billing.py::compute_total")
200 listed = _json(repo, env, "entangle")["pairs"]
201 assert all((p["symbol_a"], p["symbol_b"]) != pair for p in listed), "linked pair listed by default"
202 by_symbol = _json(repo, env, "entangle", "--symbol", "src/billing.py::compute_total")["pairs"]
203 row = next(p for p in by_symbol if (p["symbol_a"], p["symbol_b"]) == pair)
204 assert row["structurally_linked"] is True and row["co_changes"] >= 2
205 _no_link(html, _T_ENTANGLE_LINK)
206 sect = _section(html, "entangle")
207 assert "--symbol" in sect and "from pkg.mod import name" in sect
208
209
210 def test_gravity_survives_an_oversized_file_and_the_page_says_so(html: str, fixture_repo: tuple) -> None:
211 """muse#179: a Python file over 2 MiB is skipped with a warning; the rest of the graph stays."""
212 repo, env = fixture_repo
213 rows = "".join(f" {i}, # generated padding for the parse limit\n" for i in range(60000))
214 (repo / "src" / "big_table.py").write_text(f"TABLE = [\n{rows}]\n")
215 assert (repo / "src" / "big_table.py").stat().st_size > 2 * 1024 * 1024
216 _commit(repo, env, "generated table")
217 for cmd in ("gravity", "blast-risk"):
218 out = _json(repo, env, cmd)
219 assert any("skipped_oversized_file: src/big_table.py" in w for w in out["warnings"]), (cmd, out["warnings"])
220 row = next(r for r in _json(repo, env, "gravity")["symbols"] if r["address"] == "src/billing.py::compute_total")
221 assert row["direct_dependents"] >= 1
222 _no_link(html, _T_GRAVITY_BIG)
223 assert "skipped_oversized_file" in _section(html, "gravity")
224
225
226 def test_breakage_checks_first_party_imports_and_the_page_says_so(html: str, fixture_repo: tuple) -> None:
227 """muse#182: a stale `from src.billing import …` is reported outside Muse's own repo."""
228 repo, env = fixture_repo
229 (repo / "src" / "api.py").write_text(
230 "import json\nfrom src.billing import vanished_helper\n\n\n"
231 "def create_order(payload):\n return vanished_helper(json.dumps(payload))\n")
232 out = _json(repo, env, "breakage")
233 stale = [i for i in out["issues"] if i["issue_type"] == "stale_import"]
234 assert [i["path"] for i in stale] == ["src/api.py"] and "vanished_helper" in stale[0]["description"]
235 _json(repo, env, "breakage", "--strict", rc=1)
236 _no_link(html, _T_BRK_STALE)
237 assert "first-party" in _section(html, "breakage")
238
239
240 def test_deps_reverse_finds_from_importers_and_the_page_says_so(html: str, fixture_repo: tuple) -> None:
241 """muse#183: `from src.billing import compute_total` importers are listed."""
242 repo, env = fixture_repo
243 out = _json(repo, env, "deps", "src/billing.py", "--reverse")
244 assert sorted(out["imported_by"]) == ["src/api.py", "tests/test_billing.py"]
245 _no_link(html, _T_DEPS_REV)
246 assert "from pkg.mod import name" in _section(html, "deps")
247
248
249 def test_coverage_transitive_walks_the_cap_and_the_page_says_so(html: str, fixture_repo: tuple) -> None:
250 """muse#184: --transitive without --depth reaches a symbol two hops from the test."""
251 repo, env = fixture_repo
252 (repo / "src" / "billing.py").write_text(
253 "def compute_tax(amount):\n return amount * 0.1\n\n\n"
254 "def compute_total(items):\n return compute_tax(sum(i['price'] for i in items))\n")
255 _commit(repo, env, "tax")
256 out = _json(repo, env, "semantic-test-coverage", "--transitive", "--file", "src/billing.py")
257 assert out["depth"] == 10 and out["transitive"] is True
258 covered = {s["name"]: s["covered"] for f in out["files"] for s in f["symbols"]}
259 assert covered == {"compute_tax": True, "compute_total": True}
260 _no_link(html, _T_COV_TRANSITIVE)
261 assert '"depth": 10' in _section(html, "coverage")
262
263
264 def test_out_of_range_depth_is_a_usage_error_and_the_page_says_so(html: str, fixture_repo: tuple) -> None:
265 """muse#185: impact --depth 0 is a one-line error (exit 1); deps --depth 0 means unlimited."""
266 repo, env = fixture_repo
267 for args in (("impact", "src/billing.py::compute_total", "--depth", "0"),
268 ("deps", "src/billing.py::compute_total", "--depth", "51")):
269 raw = _cli(repo, env, ("code", *args, "--json"))
270 assert raw["rc"] == 1 and "Traceback" not in raw["out"], raw["out"]
271 assert json.loads(raw["stdout"])["error"] == "invalid_argument"
272 unlimited = _json(repo, env, "deps", "src/billing.py::compute_total", "--depth", "0")
273 assert unlimited["transitive"] is True
274 _no_link(html, _T_DEPTH)
275 assert "invalid_argument" in _section(html, "deps")
276
277
278 def test_moved_file_ops_are_file_qualified_and_the_page_says_so(html: str, fixture_repo: tuple) -> None:
279 """muse#188: a move+rename is reported on the old file::symbol address, never a bare name."""
280 repo, env = fixture_repo
281 ops = _json(repo, env, "compare", "HEAD~1", "HEAD")["ops"]
282 assert {"op": "replace", "address": "src/orders.py::calc_total", "detail": "renamed to compute_total"} in ops
283 assert all("::" in o["address"] for o in ops if o["op"] != "rename"), ops
284 log = _json(repo, env, "symbol-log", "src/billing.py::compute_total")["events"]
285 assert [(e["event"], e["address"]) for e in log] == [
286 ("created", "src/orders.py::calc_total"), ("moved", "src/orders.py::calc_total")]
287 assert log[1]["new_address"] == "src/billing.py::compute_total"
288 _no_link(html, _T_MOVE_BARE_ADDR)
289 assert '"address": "src/orders.py::calc_total", "detail": "renamed to compute_total"' in _section(html, "compare")
290
291
292 def test_lineage_follows_a_move_and_the_page_says_so(html: str, fixture_repo: tuple) -> None:
293 """muse#187: the new address gets moved_from, the old address moved_to (not a rewrite)."""
294 repo, env = fixture_repo
295 new = _json(repo, env, "lineage", "src/billing.py::compute_total")["events"]
296 assert [e["event"] for e in new] == ["created", "moved_from"] and new[1]["detail"] == "src/orders.py::calc_total"
297 old = _json(repo, env, "lineage", "src/orders.py::calc_total")["events"]
298 assert [e["event"] for e in old] == ["created", "moved_to"] and old[1]["detail"] == "src/billing.py::compute_total"
299 _no_link(html, _T_LINEAGE_RENAME)
300 sect = _section(html, "history")
301 assert '"moved_from"' in sect and "renamed_to" in sect
302
303
304 def test_coverage_gate_exits_1_in_json_mode_and_the_page_says_so(html: str, fixture_repo: tuple) -> None:
305 """muse#189: --min-coverage gates --json output too (per file), and the JSON is still printed."""
306 repo, env = fixture_repo
307 out = _json(repo, env, "semantic-test-coverage", "--min-coverage", "80", rc=1)
308 assert out["exit_code"] == 1 and out["filters"]["min_coverage"] == 80
309 assert any(f["coverage_pct"] < 80 for f in out["files"])
310 assert _cli(repo, env, ("code", "semantic-test-coverage", "--min-coverage", "80"))["rc"] == 1
311 _no_link(html, _T_STC_JSON_GATE)
312 assert "per file" in _section(html, "coverage") and "per file" in _section(html, "cli")
313
314
315 def test_narrative_ignores_unmerged_branches_and_the_page_says_so(html: str, fixture_repo: tuple) -> None:
316 """muse#190: the default (journal) path reports only commits reachable from HEAD."""
317 repo, env = fixture_repo
318 # narrative does not follow the fixture's move+rename, so give the new address a main-line edit
319 (repo / "src" / "billing.py").write_text("def compute_total(items):\n return sum(items)\n")
320 main_head = _commit(repo, env, "main edit")
321 assert _cli(repo, env, ("branch", "feat/v2-billing"))["rc"] == 0
322 assert _cli(repo, env, ("checkout", "feat/v2-billing"))["rc"] == 0
323 (repo / "src" / "billing.py").write_text("def compute_total(items):\n return round(sum(items), 2)\n")
324 branch_commit = _commit(repo, env, "branch-only edit")
325 assert _cli(repo, env, ("checkout", "main"))["rc"] == 0
326 out = _json(repo, env, "narrative", "src/billing.py::compute_total")
327 assert out["last_change_commit"] == main_head
328 assert branch_commit not in {e["commit_id"] for e in out["events"]}
329 _no_link(html, _T_NARR_FASTPATH)
330 assert "reachable from HEAD" in _section(html, "history")
331
332
333 # ── Symbol cache: path and version corrected ─────────────────────────────────
334
335
336 def test_cache_path_and_version(html: str) -> None:
337 sect = _section(html, "cache")
338 assert ".muse/cache/symbols.json" in sect
339 assert "60" not in sect.split("speedup")[0][-40:] if "speedup" in sect else True
340 assert "1,300 ms" not in sect and "22 ms" not in sect, "unverified cache benchmark numbers must not be published (#242 B1)"
341
342
343 # ── Gravity: denominator excludes the symbol itself ─────────────────────────
344
345
346 def test_gravity_denominator_excludes_self(fixture_repo: tuple) -> None:
347 repo, env = fixture_repo
348 out = _json(repo, env, "gravity")
349 # compute_total has 1 production dependent (create_order); the test is excluded by default
350 row = next((r for r in out["symbols"] if r["address"].endswith("compute_total")), None)
351 assert row is not None, out
352 assert row["direct_dependents"] >= 1
353
354
355 # ── Breakage: output key is `path`, not `file_path` ──────────────────────────
356
357
358 def test_breakage_output_key_is_path(fixture_repo: tuple) -> None:
359 repo, env = fixture_repo
360 (repo / "src" / "api.py").write_text("def create_order(payload):\n return payload\n")
361 out = _json(repo, env, "breakage")
362 for issue in out.get("issues", []):
363 assert "path" in issue
364 assert "file_path" not in issue
365
366
367 # ── Impact: entry_points key omitted when there are none ────────────────────
368
369
370 def test_impact_entry_points_key_omitted_when_absent(fixture_repo: tuple) -> None:
371 repo, env = fixture_repo
372 out = _json(repo, env, "impact", "src/billing.py::compute_total")
373 # the target itself is not a route; entry_points should not be a non-empty list of itself
374 assert out.get("total", 0) >= 1
375
376
377 # ── Layout: callout bodies are wrapped (musehub#248 follow-up, 320 px overflow) ──
378
379
380 def test_callout_bodies_are_wrapped_for_narrow_viewports(html: str) -> None:
381 """`.devdocs-callout` is a flex container. Bare text or `<code>` as its direct children become
382 unshrinkable flex items, which overflowed the page to 809 px at a 320 px viewport. Each callout
383 must hold only its icon and one wrapping `<div>` (the house pattern), and the page scope must
384 give that body a break opportunity for long code tokens."""
385 from html.parser import HTMLParser
386
387 class Callouts(HTMLParser):
388 def __init__(self) -> None:
389 super().__init__(convert_charrefs=True)
390 self.stack: list[bool] = []
391 self.found = 0
392 self.bad: list[str] = []
393
394 def handle_starttag(self, tag: str, attrs: list) -> None:
395 if tag in ("br", "img", "input", "meta", "link", "hr", "path", "circle", "line", "rect", "use"):
396 return
397 if self.stack and self.stack[-1] and tag not in ("svg", "div"):
398 self.bad.append(f"<{tag}> directly inside a callout")
399 cls = dict(attrs).get("class") or ""
400 is_callout = tag == "div" and "devdocs-callout" in cls.split()
401 self.found += is_callout
402 self.stack.append(is_callout)
403
404 def handle_endtag(self, tag: str) -> None:
405 if tag in ("br", "img", "input", "meta", "link", "hr", "path", "circle", "line", "rect", "use"):
406 return
407 if self.stack:
408 self.stack.pop()
409
410 def handle_data(self, data: str) -> None:
411 if self.stack and self.stack[-1] and data.strip():
412 self.bad.append(f"bare text directly inside a callout: {data.strip()[:40]!r}")
413
414 p = Callouts()
415 p.feed(html)
416 assert p.found >= 16, p.found # non-vacuity floor; the entangle notes merged into one callout (muse#177)
417 assert not p.bad, p.bad
418 assert 'class="devdocs devdocs--intelligence"' in html
419 scss = (pathlib.Path(__file__).resolve().parents[2] / "src/scss/components/_intelligence-viz.scss").read_text()
420 assert ".devdocs--intelligence" in scss and "overflow-wrap: anywhere" in scss and "min-width: 0" in scss
421
422
423 # ── muse#251: call-graph analytics beyond Python ───────────────────────────
424
425
426 _JAVA = {
427 "src/bank/Ledger.java": "package bank;\npublic class Ledger {\n public void post(int a) { System.out.println(a); }\n}\nclass Unused { void never() {} }\n",
428 "src/bank/Account.java": "package bank;\nimport bank.Ledger;\npublic class Account {\n private final Ledger l = new Ledger();\n public int deposit(int x) { l.post(x); return x; }\n}\n",
429 "src/bank/App.java": "package bank;\npublic class App {\n public static void main(String[] a) { new Account().deposit(1); }\n}\n",
430 }
431
432
433 def test_call_graph_covers_java_and_the_page_says_so(html: str, tmp_path: pathlib.Path) -> None:
434 """muse#251: deps, impact, gravity and dead work on a Java repo; the page no longer says Python-only."""
435 repo = tmp_path / "java"
436 repo.mkdir()
437 env = _env(tmp_path)
438 assert _cli(repo, env, ("init",))["rc"] == 0
439 for path, src in _JAVA.items():
440 (repo / path).parent.mkdir(parents=True, exist_ok=True)
441 (repo / path).write_text(src)
442 _commit(repo, env, "java")
443
444 post = "src/bank/Ledger.java::Ledger.post"
445 assert _json(repo, env, "deps", "src/bank/Account.java::Account.deposit")["calls"] == ["post"]
446 assert _json(repo, env, "deps", "src/bank/Ledger.java", "--reverse")["imported_by"] == ["src/bank/Account.java"]
447 reached = {a for hop in _json(repo, env, "impact", post)["blast_radius"].values() for a in hop}
448 assert reached == {"src/bank/Account.java::Account.deposit", "src/bank/App.java::App.main"}
449 grav = next(s for s in _json(repo, env, "gravity")["symbols"] if s["address"] == post)
450 assert (grav["direct_dependents"], grav["transitive_dependents"]) == (1, 2)
451 dead = {r["address"] for r in _json(repo, env, "dead")["results"]}
452 assert dead == {"src/bank/Ledger.java::Unused", "src/bank/Ledger.java::Unused.never"} # main is an entry point
453
454 langs = _section(html, "languages")
455 assert "read Python source only" not in langs and "every tree-sitter code language" in langs
456 for row in ("Scala", "PHP", "JSON / YAML"):
457 assert row in langs, f"{row} missing from the language table"
458 assert "Reference extraction is Python-only" not in _section(html, "dead")
459 assert "main" in _section(html, "dead") and "entry points, never dead" in _section(html, "dead")
460 assert "Python files (.py, .pyi) via AST" not in _section(html, "gravity")
File History 7 commits
sha256:b4b999434d042d74edc7032f1f2cfd20fda5b3580fe85966351db5b8eef0abb3 feat(intel): every grammar on the hub, and every intel job … Opus 5.5 minor ⚠ 1 day ago
sha256:934023d26c5127099a582edbcf542e8a79f19e1f1fccc474efde6339a0484c89 Merge branch 'task/wave-hub-docs-intel' into dev Opus 5.5 patch 1 day ago
sha256:fda138101a6743a01a04e7b21ea04f622bdd0dd293400ee307540d9ef9f6bd3b docs(intelligence): fixed muse 0.2.2rc5 code-intelligence n… Opus 5.5 patch 1 day ago
sha256:c2ee54efa85fcbdeea4ffc84a2dd1b8fcd4623463b22e35765df3013a26834aa merge: #276 public URLs + muse#181 docs onto dev (#313 present) Opus 5.5 minor ⚠ 1 day ago
sha256:8ab7288e50fb9c8a6ed37c4cc749a39e456cb90f496b8cbc3f9e3ba2b7a7c7a8 docs(intelligence): find-symbol --name/--kind, slash branch… Opus 5.5 patch 1 day ago
sha256:fe5bf55b6db66fa1e41eda92fec82d1ae084f2883a909737fda77f6f3896eb6c docs(intelligence): fix 320 px horizontal overflow (musehub… Opus 5.5 patch 9 days ago
sha256:e16f407d787df2320fb726a5ea8a5b5eb1d53e68135d8992373f0fd5b5319fa9 docs(intelligence): QA contract v2 — 148-claim audit, 20 co… Sonnet 5 minor ⚠ 9 days ago