You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
detect_incremental() uses a single global manifest for all subdirectories — --update on one subfolder reports files from the last-graphed folder as deleted #3785
Bug: detect_incremental() uses a single global manifest for all subdirectories — --update on one subfolder reports every file from the last-graphed folder as deleted
Version: graphifyy 0.3.28
What happened
Running the skill's --update flow on one subdirectory of a large repo (e.g. workflows/) after a previous full run had graphed a different subdirectory (e.g. experts/) causes deleted_files in the incremental-detect result to list hundreds of paths from that unrelated, previously-graphed folder.
Live case: --update on workflows/ (a workspace with ~15 top-level graphed subfolders, each run via /graphify <subfolder>) returned deleted_files containing 230+ paths under experts/rechts-kanzlei/... — none of which are under workflows/ and none of which were actually deleted. The last folder graphed before this run was experts/.
Root cause
In graphify/detect.py, the manifest path is a module-level constant:
_MANIFEST_PATH="graphify-out/manifest.json"
load_manifest() / save_manifest() both default to this single flat path regardless of which root was passed to detect_incremental(root). Every /graphify <subfolder> --update run in a multi-subfolder workspace reads and writes the same manifest file, so the manifest only ever reflects whichever subfolder was graphed most recently. The comparison in detect_incremental():
flags every manifest entry not under the current run's file set as deleted — including entries that were never under root to begin with.
Impact
If the caller (e.g. the skill's --update flow) prunes graph nodes whose source_file is in deleted_files, this can silently remove nodes belonging to an unrelated subfolder's graph, depending on which graph is currently loaded. In our case the prune step happened to target the just-loaded subfolder graph, which contained none of the flagged paths, so the visible symptom was only a wrong "N files deleted" count in the diff report — but the mechanism is a correctness bug regardless of the specific graph layout, and could delete real nodes in a different call pattern (e.g. running --update against the root graph, or against a subfolder whose graph overlaps the previously-graphed one).
Suggested fix
Scope the manifest path to root by default (e.g. graphify-out/<sanitized-root>/manifest.json, falling back to the existing flat path for the root-level . invocation to avoid a migration step for existing single-folder setups). Additionally, filter deleted_files to only include manifest entries that were ever under root, as defense in depth against a stale or manually merged manifest.
Happy to share a patch if useful — we worked around it locally by scoping _MANIFEST_PATH per-root and adding the under-root filter to deleted_files.
Flat default manifest: _MANIFEST_PATH in graphify/detect.py defaults to graphify-out/manifest.json. When graphing subfolder B (experts/) followed by an incremental scan on subfolder A (workflows/), subfolder B's manifest is loaded and re-anchored to subfolder A (workflows/expert.py), which does not exist and gets reported as deleted.
Double-nesting on workspace manifests: Running an incremental scan on a subfolder against a workspace manifest joins workspace-relative keys (workflows/workflow.py) with the subfolder root, resulting in invalid doubled paths (workflows/workflows/workflow.py).
Missing root boundary filter: detect_incremental() iterates through all loaded manifest rows without verifying whether each path actually falls within root.
Fix
Scope default manifest paths per scan root via manifest_path_for_root(root) (graphify-out/<slug>/manifest.json) when root is a subfolder, while preserving graphify-out/manifest.json for repo-level runs and falling back to the workspace manifest if no subfolder manifest exists yet.
In _to_absolute_from_storage(), walk parent directories if root / key does not exist on disk to resolve ancestor/workspace-relative keys without duplicating paths.
In detect_incremental(), skip entries outside root (if not _in_root(f): continue) so foreign paths are neither reported as deletions nor exclusions.
Activity
harshaygadekar commentedon Oct 5, 2026
Confirmed and reproduced.
Root Cause
_MANIFEST_PATHingraphify/detect.pydefaults tographify-out/manifest.json. When graphing subfolder B (experts/) followed by an incremental scan on subfolder A (workflows/), subfolder B's manifest is loaded and re-anchored to subfolder A (workflows/expert.py), which does not exist and gets reported as deleted.workflows/workflow.py) with the subfolder root, resulting in invalid doubled paths (workflows/workflows/workflow.py).detect_incremental()iterates through all loaded manifest rows without verifying whether each path actually falls withinroot.Fix
manifest_path_for_root(root)(graphify-out/<slug>/manifest.json) whenrootis a subfolder, while preservinggraphify-out/manifest.jsonfor repo-level runs and falling back to the workspace manifest if no subfolder manifest exists yet._to_absolute_from_storage(), walk parent directories ifroot / keydoes not exist on disk to resolve ancestor/workspace-relative keys without duplicating paths.detect_incremental(), skip entries outsideroot(if not _in_root(f): continue) so foreign paths are neither reported as deletions nor exclusions.opened the PR for this issue, open to review!!
fix(detect): scope incremental manifest anchoring to prevent false de…
fix(detect): scope incremental manifest anchoring to prevent false de…
safishamsi commentedon Oct 5, 2026
Resolved by #4118 (thanks @harshaygadekar), shipped in v0.9.77. Closing as fixed.