fix(detect): strip inline comments from .graphifyignore patterns#605
Closed
LEELADEVS wants to merge 1 commit into
Closed
fix(detect): strip inline comments from .graphifyignore patterns#605LEELADEVS wants to merge 1 commit into
LEELADEVS wants to merge 1 commit into
Conversation
The previous implementation only handled full-line comments (lines starting
with #). Inline comments like `chitta/varta/ # daily briefings` were loaded
as a single pattern including the trailing whitespace and comment text,
which fnmatch then failed to match against any real path → the directory
was silently NOT ignored.
Real-world impact (LEELA shiva repo, 2026-04-29):
- .graphifyignore had `chitta/varta/ # daily briefings` (52 files)
- All 52 files appeared as "changed" on every --update run
- Same for `chitta/spanda/ # webhooks cache` (12 files)
- Total ~$1-3 wasted per --update on re-extracting ephemeral cron output
Fix: when reading each pattern line, scan for whitespace + '#' and drop the
remainder. Backslash-hash (\#) keeps a literal '#' in the pattern (rare).
Documentation updated to describe the gitignore-extension semantics.
Tests added (3):
- test_graphifyignore_inline_comments_stripped — main case
- test_graphifyignore_inline_comment_requires_whitespace_before_hash —
'path#with#hash.py' is a literal pattern, not a comment
- test_graphifyignore_escaped_hash_is_literal — \# escape
All 9 .graphifyignore tests pass.
safishamsi
added a commit
that referenced
this pull request
May 1, 2026
Collaborator
|
The requested changes have been implemented in 3fdae8f. |
matzls
pushed a commit
to matzls/graphify
that referenced
this pull request
May 10, 2026
…bs#638 Graphify-Labs#589 Graphify-Labs#586 Graphify-Labs#593: kimi thinking, manifest, inline comments, query boost, cache race, markdownify, content hash Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_load_graphifyignoreonly handled full-line comments. Inline comments likevendor/ # legacy codewere loaded as a single pattern including the trailing whitespace and comment text, whichfnmatchcould not match against any real path → the entry silently did not ignore anything.Real-world impact
In our knowledge corpus (
640 files, gitignore-style$1-3 per run) and noisy diff output..graphifyignorewith inline-documented patterns), 52 + 12 files in two categories were marked as changed on every--updaterun because their patterns had inline comments. This caused unnecessary LLM re-extraction (The fix lets users document patterns inline (a common gitignore convention even though git itself does not support it natively):
Behavior
vendor/ # legacy codevendor/ # legacy code(matches nothing)vendor/(matchesvendor/...)*.log(no inline comment)*.log*.log(unchanged)# full-line commentpath#with#hash.py(no whitespace before#)path#with#hash.pypath#with#hash.py(unchanged — gitignore semantics)file \# name.py(escaped hash)file \# name.pyfile # name.py(literal#preserved)Tests
Three new tests added to
tests/test_detect.py:test_graphifyignore_inline_comments_stripped— main casetest_graphifyignore_inline_comment_requires_whitespace_before_hash—#without whitespace stays literaltest_graphifyignore_escaped_hash_is_literal—\#escapeAll 9
.graphifyignoretests pass.Notes
#requirement matches user intuition while preserving the rare case of#as a literal filename character.