fix: use project-relative paths in manifest.json and GRAPH_REPORT.md#778
fix: use project-relative paths in manifest.json and GRAPH_REPORT.md#778luw2007 wants to merge 1 commit into
Conversation
manifest.json keys and the GRAPH_REPORT.md title previously stored absolute paths (e.g. /Users/foo/project/src/main.py), leaking local filesystem structure and breaking portability across machines. - save_manifest: relativize file paths against project root before writing them as JSON keys - detect_incremental: look up both absolute and relative keys so existing (legacy absolute) manifests still match correctly - cluster-only report: pass directory name instead of full absolute path to the report title
dd8fb1f to
04f0fcc
Compare
safishamsi
left a comment
There was a problem hiding this comment.
Good direction — manifest relativization in detect.py and __main__.py is correct and the backwards-compat reading of legacy absolute keys is well handled. Two things need fixing.
Required changes
1. watch.py:148 not updated
save_manifest(detected["files"]) is called with no root argument. The new fallback resolves root to Path.cwd(), which only works when CWD matches the watch path. Running graphify watch /some/other/path from a different directory will still write absolute manifest keys. Fix: pass root=watch_root and manifest_path=str(out / "manifest.json") explicitly.
2. No tests for the new behaviour
No test asserts that saved manifest keys are relative, and none exercises the legacy-absolute-key backwards-compat path. A small addition to tests/test_detect.py covering both cases would lock in the contract cheaply.
Minor (non-blocking)
watch_path.name or str(watch_path)at__main__.py:1609returns a literal"."forPath(".")— reusing_report_root_labelfromwatch.pywould be cleaner- Issue #722 will remain partially open after this PR (
.graphify_root,.graphify_incremental.json, and the.gitignoreguidance are not addressed) — worth noting in the PR description so #722 isn't closed prematurely
|
@safishamsi @luw2007 can this pr also introduce gitignore template per #722 |
Summary
manifest.jsonkeys now store project-relative paths instead of absolute paths (e.g.src/main.pyinstead of/Users/foo/project/src/main.py)GRAPH_REPORT.mdtitle uses the directory name instead of the full absolute pathdetect_incrementalis backwards-compatible: matches both legacy absolute keys and new relative keysMotivation
Absolute paths in output files leak local filesystem structure and break portability — the same graph output produces different content on different machines, making it impossible to commit
graphify-out/to version control or share across environments.Test plan
tests/test_detect.py— all 33 tests pass (including incremental + symlink tests)tests/test_report.py,tests/test_build.py,tests/test_ingest.py— all pass