Skip to content

graph.json stores absolute source_file paths, breaking portability across git worktrees and machines #555

Closed

Description

@lucasrcosta

Problem

graph.json stores source_file as absolute paths (e.g. /Users/alice/projects/myapp/src/lib/auth.ts). This makes the committed graph non-portable:

  • Git worktrees: building the graph in one worktree produces paths that don't resolve in sibling worktrees (same repo, different directory)
  • Teammates: cloning the repo gives a graph with paths pointing to the original author's machine
  • CI/CD: any pipeline that queries the graph gets paths from wherever it was last built

The graph is designed to be committed alongside the code. Absolute paths defeat that entirely.

Expected behavior

source_file should be stored relative to the project root (e.g. src/lib/auth.ts). Tools consuming the graph can resolve to absolute by joining with their own CWD, which is the standard convention for committed path references.

Workaround

We're post-processing graph.json in the post-commit and post-checkout hooks to strip the build-time CWD prefix:

cwd_prefix = str(Path('.').resolve()) + '/'
for node in graph_data['nodes']:
    sf = node.get('source_file') or ''
    if sf.startswith(cwd_prefix):
        node['source_file'] = sf[len(cwd_prefix):]

This works but shouldn't be necessary — the extraction step should write relative paths from the start.

Environment

  • graphifyy 0.5.0
  • macOS, git worktree setup (main worktree + multiple linked worktrees via conductor)

Activity

  1. added a commit that references this issue on Apr 27, 2026
    09c72b1
  2. safishamsi commented on Apr 27, 2026

    @safishamsi
    Member

    Fixed: extract() now relativizes source_file fields in all nodes and edges to the computed root before returning. This ensures paths are portable across machines for both full and incremental builds.

  3. added a commit that references this issue on Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions