test(query): assert the CLI query call site wires graph_path (#2789)

The header logic is unit-tested, but only a real subprocess run proves the CLI
query command actually passes the resolved graph path through — the wiring that
was the point of #2789. Cover both the under-CWD relative form and an explicit
--graph outside the CWD shown in full. Plus 0.9.47 changelog entry.
This commit is contained in:
safishamsi
2026-08-18 22:38:47 +01:00
parent b8a8b4c4c9
commit 56c1060158
2 changed files with 32 additions and 0 deletions
+1
View File
@@ -6,6 +6,7 @@ Full release notes with details on each version: [GitHub Releases](https://githu
- Feature: JavaScript/TypeScript factory functions that assign callable members to a local object literal (`const api = {}; api.foo = fn`) now keep those members in the graph — the API object is modeled beneath its factory and the assigned functions attach as methods, including arrow-function assignments and their intra-factory call edges. The owner is minted only for identifiers proven to be object-literal bindings in the enclosing function, so arbitrary receivers do not reintroduce the phantom-owner flood, and the factory's `contains` edge is emitted once no matter how many methods hang off the object (#2745, thanks @rajanpanth).
- Fix: `graph.json` field order is now stable across a read-rebuild round-trip, so re-running `graphify update` on an unchanged graph produces a byte-identical file instead of reshuffling node and link keys (#2582, thanks @C0KERNEL).
- Fix: `graphify query` now names the graph it opened and its node count at the head of the answer (relative to the CWD when the graph is underneath it, absolute otherwise), so a query run from a parent project no longer silently answers from the wrong corpus with no indication which graph was used (#2789, thanks @abhay-codes07).
- Fix: the `claude` backend no longer crashes with `AttributeError: 'ThinkingBlock'` when an extended-thinking response leads with a thinking block; the first text block is read instead (#2697, thanks @mdshzb04).
- Fix: `graphify update` / `save_manifest` no longer rewrites `manifest.json` timestamps on a no-op run, so `graphify-out/` stops showing as dirty (and stops producing a trailing graph commit) when nothing changed; a genuine change still updates and persists (#2838, thanks @hopstreax).
- Fix: a C# 12 primary constructor's parameters are now walked, so `class Svc(IRepo repo)` emits the `references` edge to `IRepo` and calls through `repo` resolve — previously the class silently dropped its dependency; built-in and type-parameter types are not fabricated (#2829, thanks @brobl2008).
+31
View File
@@ -775,3 +775,34 @@ def test_cluster_only_preserves_built_at_commit_from_non_repo_cwd(tmp_path):
assert r.returncode == 0, r.stderr
final = json.loads(graph_json.read_text(encoding="utf-8"))
assert final.get("built_at_commit") == commit_x
# ── graphify query names its graph (#2789) ───────────────────────────────────
def test_query_command_header_names_the_graph(tmp_path):
"""End-to-end: the CLI `query` command must actually wire the resolved graph
path into the header. The header logic is unit-tested in
test_query_names_its_graph.py, but only a real subprocess run proves the CLI
call site passes graph_path through (the wiring that was the point of #2789)."""
_make_graph(tmp_path)
r = _run(["query", "Transformer"], tmp_path)
assert r.returncode == 0, r.stderr
first_line = r.stdout.splitlines()[0]
assert first_line.startswith("Graph: graphify-out/graph.json ("), first_line
assert "nodes)" in first_line
assert "Traversal:" in first_line
def test_query_command_names_a_graph_outside_the_cwd(tmp_path):
"""The #2789 scenario: querying an explicit graph that sits outside the CWD
must show it in full so the operator can tell the answer came from elsewhere."""
elsewhere = tmp_path / "elsewhere"
elsewhere.mkdir()
out = _make_graph(elsewhere)
here = tmp_path / "here"
here.mkdir()
r = _run(["query", "Transformer", "--graph", str(out / "graph.json")], here)
assert r.returncode == 0, r.stderr
first_line = r.stdout.splitlines()[0]
assert first_line.startswith("Graph: "), first_line
assert "elsewhere" in first_line, first_line