Skip to content

fix(detect): forward follow_symlinks from detect_incremental to detect#736

Merged
safishamsi merged 1 commit into
Graphify-Labs:v7from
alphanury:fix/detect-incremental-follow-symlinks
May 6, 2026
Merged

fix(detect): forward follow_symlinks from detect_incremental to detect#736
safishamsi merged 1 commit into
Graphify-Labs:v7from
alphanury:fix/detect-incremental-follow-symlinks

Conversation

@alphanury

Copy link
Copy Markdown
Contributor

Problem

detect_incremental(root) always called detect(root) without forwarding the follow_symlinks kwarg added in #33. As a result, corpora that include symlinked sub-trees pointing to directories outside the scan root were visible to a full detect() run with follow_symlinks=True but invisible to any subsequent --update run.

Concrete failure case

A user has a knowledge corpus laid out like:

```
~/.hermes/graphify-jarvis/
├── state_of_truth -> ~/.hermes/state_of_truth (symlink)
├── memories -> ~/.claude/.../memory (symlink)
└── graphify-out/
```

Initial /graphify <path> build (with the appropriate follow_symlinks=True plumbed in) correctly indexed ~95 files via the symlinks. Subsequent /graphify <path> --update runs only saw 3 files (the contents of graphify-out/ itself) because detect_incremental re-called detect(root) without the flag, silently dropping the symlinked sub-trees. New SoT reports and memories were never picked up by incremental scans.

Fix

Add a keyword-only follow_symlinks parameter to detect_incremental() and forward it to detect(). Default stays False for backwards compatibility — only callers that already opt in to symlink following on detect() pick up the new behaviour for incremental runs too.

Test

Added test_detect_incremental_propagates_follow_symlinks covering the regression: a corpus with a symlinked directory is invisible with follow_symlinks=False, fully indexed with follow_symlinks=True, and correctly reports zero new files on a second incremental scan after the manifest is saved.

```
$ pytest tests/test_detect.py -v
============================== 30 passed in 0.07s ==============================
```

Caller note

The CLI / skill currently doesn't expose --follow-symlinks as a flag, but watch.py already plumbs it through to the full-detect() rebuild path. This PR keeps the same opt-in shape: callers that already pass follow_symlinks=True to detect() will now see consistent behaviour on --update. Wiring a --follow-symlinks CLI flag through to both detect_incremental and the existing detect() callsites would be a small follow-up if you want.

`detect_incremental(root)` always called `detect(root)` without forwarding
the `follow_symlinks` kwarg. As a result, corpora that include symlinked
sub-trees pointing to directories outside the scan root (e.g. a
`state_of_truth/` symlink pointing at `~/.hermes/state_of_truth/`) were
visible to a full `detect()` run with `follow_symlinks=True` but invisible
to any subsequent `--update` run. The incremental scan would then either
report no changes (silently dropping legitimate new files) or repeatedly
re-extract a phantom subset, depending on what was reachable without
crossing symlinks.

Add a keyword-only `follow_symlinks` parameter to `detect_incremental()`
and forward it. Default stays `False` for backwards compatibility — only
callers that already opt in to symlink following on `detect()` pick up
the new behaviour for incremental runs too.

Test: a corpus with a symlinked directory is invisible with
`follow_symlinks=False`, fully indexed with `follow_symlinks=True`, and
correctly reports zero new files on a second incremental scan after the
manifest is saved.
@safishamsi
safishamsi merged commit 660b605 into Graphify-Labs:v7 May 6, 2026
hypnwtykvmpr pushed a commit to hypnwtykvmpr/vampyre that referenced this pull request May 7, 2026
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.

2 participants