Skip to content

fix: use relative paths in manifest, .graphify_root, and cache for cross-platform portability (fixes #777)#1068

Open
adityachaudhary99 wants to merge 2 commits into
safishamsi:v8from
adityachaudhary99:fix/portable-paths
Open

fix: use relative paths in manifest, .graphify_root, and cache for cross-platform portability (fixes #777)#1068
adityachaudhary99 wants to merge 2 commits into
safishamsi:v8from
adityachaudhary99:fix/portable-paths

Conversation

@adityachaudhary99
Copy link
Copy Markdown
Contributor

Problem

Three artifacts contained absolute machine-specific paths, breaking git-shared graphify-out/ across different machines and platforms:

  1. manifest.json keys
  2. .graphify_root content
  3. cache/ast/*.json source_file fields

Fix

  • save_manifest() — relativizes keys against root via Path.relative_to().as_posix() for POSIX separators
  • detect_incremental() — re-anchors relative manifest keys back to absolute using Path() join
  • .graphify_root — writes user-provided watch_path (often .) instead of resolved absolute watch_root
  • save_cached() / load_cached() — relativize/re-anchor source_file fields in nodes and edges
  • _reanchor_source_file() helper in cache.py — handles legacy absolute-path entries
  • main.py passes root= to save_manifest() calls

All backward compatible: absolute paths that escape root are preserved as-is in each layer.

- save_manifest: relativize keys against root when provided
- detect_incremental: re-anchor relative manifest keys for comparison
- watch.py _rebuild_code: write watch_path (user-provided) to .graphify_root
  instead of resolved absolute watch_root
- cache.py save_cached: relativize source_file fields before caching
- cache.py load_cached: re-anchor relative source_file paths on load
- Pass root= to all save_manifest callsites

Fixes three artifacts that contained absolute paths:
1. manifest.json keys
2. .graphify_root content
3. cache/ast/*.json source_file fields
Now all three are portable across git clones (safishamsi#777).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant