mirror of
https://github.com/safishamsi/graphify.git
synced 2026-10-20 10:51:24 +00:00
Add regression test for the stale sidecar html export path
Corrupts the analysis sidecar community node id set (the exact
staleness signature the issue describes) and confirms export html
still succeeds, still renders graph.html, and prints the new warning
instead of silently exporting against the fossil.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017qfdzgbA5KedGEjD1AayNh
(cherry picked from commit 4518bae439)
This commit is contained in:
1 parent
06ff9d07dc
commit
18cae252cb
1 file changed
+23
@@ -659,6 +659,29 @@ def test_export_html_no_community_data_at_all_still_succeeds(tmp_path):
|
||||
assert r.returncode == 0, r.stderr
|
||||
|
||||
|
||||
# ── #2386: sidecar exists but is STALE, not just absent ──────────────────────
|
||||
# update/watch advance graph.json's per-node community attribute but never
|
||||
# regenerate .graphify_analysis.json, so it can describe an earlier
|
||||
# clustering pass while still being present. That looked identical to a
|
||||
# fresh sidecar from the outside and kept winning over the correct data
|
||||
# sitting in graph.json.
|
||||
|
||||
def test_export_html_prefers_fresh_data_when_sidecar_is_stale(tmp_path):
|
||||
out = _make_graph(tmp_path)
|
||||
analysis_path = out / ".graphify_analysis.json"
|
||||
analysis = json.loads(analysis_path.read_text(encoding="utf-8"))
|
||||
# Simulate staleness the way the issue describes: the sidecar's node id
|
||||
# set no longer matches graph.json's (a node the sidecar never saw, or
|
||||
# one it references that graph.json no longer has).
|
||||
analysis["communities"] = {"0": ["a_ghost_node_id_not_in_the_graph"]}
|
||||
analysis_path.write_text(json.dumps(analysis))
|
||||
|
||||
r = _run(["export", "html"], tmp_path)
|
||||
assert r.returncode == 0, r.stderr
|
||||
assert "is stale" in r.stderr
|
||||
assert (out / "graph.html").exists()
|
||||
|
||||
|
||||
def test_graph_json_node_ids_are_portable_across_checkout_paths(tmp_path):
|
||||
"""#1789: the committed graph.json's node ids must be relative to the scan
|
||||
root — not embed the absolute path — so the same repo yields identical ids
|
||||
|
||||
Reference in new issue
Block a user