fix(detect): honor .graphifyignore for the memory tree (fixes #2267) - #2272
fix(detect): honor .graphifyignore for the memory tree (fixes #2267)#2272Munawarx wants to merge 1 commit into
Conversation
…y-Labs#2267) The memory tree (graphify-out/memory/, where saved Q&A results are filed back into the graph) was exempt from the ignore check, so a user could never exclude their own Q&A output from the corpus. detect.py guarded the _is_ignored call with 'not in_memory', silently bypassing user patterns. Remove the guard so ignore patterns apply to the memory tree like every other path. Default behavior (memory included unless explicitly ignored) is preserved. Adds a regression test (test_graphifyignore_excludes_memory_tree) matching the existing tests/test_detect.py style. Fixes Graphify-Labs#2267
safishamsi
left a comment
There was a problem hiding this comment.
Thanks @Munawarx — the gap is real (user ignore patterns never reach graphify-out/memory/). But the one-line change over-reaches: ignore_patterns includes .gitignore and $GIT_DIR/info/exclude, not just .graphifyignore. Since graphify-out/ is generated output and is commonly gitignored, dropping the guard silently disables the memory round-trip by default for those repos — I verified _is_ignored(<root>/graphify-out/memory/query_1.md, ...) returns True with graphify-out/ in .gitignore, which contradicts the 'default unchanged' claim. Please scope this to .graphifyignore-sourced patterns only (track pattern provenance and apply just those to the memory tree), and add a regression test that a gitignored graphify-out/ still keeps memory included. Happy to re-review.
Problem
.graphifyignorepatterns are silently bypassed forgraphify-out/memory/, so users cannot exclude their own saved Q&A output from the corpus. The tree gets re-ingested on every run and node counts grow for reasons unrelated to the source tree.Root cause
In
graphify/detect.pythe ignore check is guarded:The
not in_memorycondition means user ignore patterns never apply to the memory tree. This is issue #2267, Option 1 (the maintainer-friendly fix the reporter requested).Solution
Remove the
not in_memoryguard so_is_ignoredapplies to the memory tree like every other path. Default behavior is unchanged: memory is still ingested unless explicitly ignored.As a side benefit, the hidden/noise filter (which also keyed off
in_memory) now correctly applies to the memory tree, so stray dotfiles dropped there are no longer unconditionally picked up.Testing
test_graphifyignore_excludes_memory_treeintests/test_detect.py(matches existing style, usestmp_path)..graphifyignore, memory is still ingested (default loop intact).graphify-out/, nestedproj/graphify-out/memory/, and negation patterns behave correctly.Expected impact
Users can finally scope the graph to the source tree only. Removes silent config-ignored behavior.
Fixes #2267