Summary
After a scoped build (graphify src/), installing the post-commit hook (graphify hook install) causes the next commit to re-extract all changed code files via git diff, ignoring the scoped src/ boundary, and overwrites .graphify_root from .../src to . (repo root). The graph silently expands beyond the user's intended scope, and there is no warning.
Reproduction (measured on a TS router project)
graphify src/ → graphify-out/.graphify_root = /abs/path/src, 214 nodes / 512 edges / 12 communities.
graphify hook install.
- First commit that includes new
scripts/*.py and *.ts (outside src/).
- Hook auto-rebuilds. Result:
.graphify_root is overwritten to . (1 byte).
- Graph grows to 374 nodes / 667 edges / 30 communities —
scripts/ was absorbed.
Why this is surprising / hard to detect
- The user explicitly scoped to
src/, yet scripts/ ends up in the graph after a single commit. ("Why did scripts/ enter the graph when I only built src/?")
- mtime-based staleness checks cannot catch it:
graph.json mtime is fresh — what changed is the coverage scope, not freshness.
Suggested directions
- The hook should respect an existing
.graphify_root (not overwrite it), restricting the git diff re-extraction to the scoped root.
- Or, if the whole-repo behavior is intended, warn at
graphify hook install time that the hook re-extracts the entire repo on every commit and will override a scoped root.
- Optionally a
graphify hook install --respect-root flag.
Environment
- graphify: PyPI
graphifyy, 0.8.x
- flow: scoped build (
graphify src/) → hook install → first commit
- shell: fish
Summary
After a scoped build (
graphify src/), installing the post-commit hook (graphify hook install) causes the next commit to re-extract all changed code files viagit diff, ignoring the scopedsrc/boundary, and overwrites.graphify_rootfrom.../srcto.(repo root). The graph silently expands beyond the user's intended scope, and there is no warning.Reproduction (measured on a TS router project)
graphify src/→graphify-out/.graphify_root=/abs/path/src, 214 nodes / 512 edges / 12 communities.graphify hook install.scripts/*.pyand*.ts(outsidesrc/)..graphify_rootis overwritten to.(1 byte).scripts/was absorbed.Why this is surprising / hard to detect
src/, yetscripts/ends up in the graph after a single commit. ("Why didscripts/enter the graph when I only builtsrc/?")graph.jsonmtime is fresh — what changed is the coverage scope, not freshness.Suggested directions
.graphify_root(not overwrite it), restricting thegit diffre-extraction to the scoped root.graphify hook installtime that the hook re-extracts the entire repo on every commit and will override a scoped root.graphify hook install --respect-rootflag.Environment
graphifyy, 0.8.xgraphify src/) →hook install→ first commit