A repository registered with --data-dir pointing into a temp directory loses its graph when the OS sweeps that directory, and the failure is silent and self-perpetuating.
get_data_dir trusts the registry entry with no existence check. With create=True it does data_dir.mkdir(parents=True, exist_ok=True) on the registered path, so:
- The temp directory is swept.
- The next read-only tool resolves to the missing path and reports
missing_graph / "No graph found ... run build first" — while a perfectly good <repo>/.code-review-graph/graph.db sits there unused.
- The next write command recreates the registered directory empty and builds a second graph into it.
_get_store in tools/_common.py calls get_db_path(root) without read_only=True, so even an ordinary query participates in step 3.
Suggested fix: when create=True, the registered directory does not exist, and <repo>/.code-review-graph/graph.db does, log a warning naming both paths and fall through to normal resolution instead of creating the registered path. Relocating a graph-less repository to a fresh directory — the documented use of --data-dir — keeps working because the guard only fires when a local graph already exists.
Related and cheap: code-review-graph repos prints only the repository path, so a relocated data_dir is invisible. Printing it, with a [MISSING] marker when the directory is gone, turns a silent failure into a visible one.
A repository registered with
--data-dirpointing into a temp directory loses its graph when the OS sweeps that directory, and the failure is silent and self-perpetuating.get_data_dirtrusts the registry entry with no existence check. Withcreate=Trueit doesdata_dir.mkdir(parents=True, exist_ok=True)on the registered path, so:missing_graph/ "No graph found ... run build first" — while a perfectly good<repo>/.code-review-graph/graph.dbsits there unused._get_storeintools/_common.pycallsget_db_path(root)withoutread_only=True, so even an ordinary query participates in step 3.Suggested fix: when
create=True, the registered directory does not exist, and<repo>/.code-review-graph/graph.dbdoes, log a warning naming both paths and fall through to normal resolution instead of creating the registered path. Relocating a graph-less repository to a fresh directory — the documented use of--data-dir— keeps working because the guard only fires when a local graph already exists.Related and cheap:
code-review-graph reposprints only the repository path, so a relocateddata_diris invisible. Printing it, with a[MISSING]marker when the directory is gone, turns a silent failure into a visible one.