Skip to content

.graphifyignore matches a nested path but edges from it still land in graph.json (survives forced rebuild + cache purge) #2773

Open

Description

@oilsinwater

Version: graphifyy 0.7.5
Environment: Linux x86_64, Python 3.14

Summary

.graphifyignore entries do not exclude matched files from the resulting graph. Edges sourced from ignored paths persist through graphify update . --force after a full purge of graphify-out/cache/ and graphify-out/.graphify_ast.json, so this isn't a stale-cache issue — the files are being (re-)parsed on every run despite matching ignore rules.

Repro

.graphifyignore (repo root):

archive/
vertiver-prototype-v2/

Both patterns match, redundantly, a real on-disk path:

archive/local/vertiver-prototype-v2/engine/src/storage.rs
archive/local/vertiver-prototype-v2/engine/tests/integration.rs
archive/local/vertiver-prototype-v2/service/src/main.rs

Steps:

rm -rf graphify-out/cache/ graphify-out/.graphify_ast.json
graphify update . --force
grep -c 'archive/' graphify-out/graph.json

Expected: 0
Actual: 4 — same count and same 4 edges, byte-for-byte, before and after the forced/purged rebuild.

Impact

One of the leaked edges credits an archived test helper with calling a live production symbol:

{
  "relation": "calls",
  "confidence": "INFERRED",
  "confidence_score": 0.8,
  "source_file": "archive/local/vertiver-prototype-v2/engine/tests/integration.rs",
  "source_location": "L63",
  "source": "tests_integration_free_port",
  "target": "src_loro_irohlorotransport_bind"
}

tests_integration_free_port only exists in the archived tree; IrohLoroTransport::bind() is live production code. This edge fed into GRAPH_REPORT.md's "Extractable standalone module" analysis for the live module, i.e. the false edge propagated into a human-facing architectural claim.

Likely related

#2267 shows .graphifyignore being bypassed by design for graphify-out/memory/ via a hardcoded second scan root in detect.py. This report is a different code path (nested nested nested-directory nested-pattern matching under a user-declared ignore, not the built-in memory exemption), but the failure class — files that should be excluded are still walked and their edges still land in graph.json — is the same, so I'm noting it in case the root cause is shared (e.g. ignore-pattern matching applied at one scan phase but not at edge-resolution/AST-cache phase).

Ask

  • Confirm whether .graphifyignore is applied only at the initial file-discovery phase and not re-checked when resolving cross-file edges during graph construction.
  • If so, apply the same ignore check at edge-resolution time, or document that nested-directory ignore patterns require the directory to be moved out of the tree entirely (current workaround).

Activity

  1. AromalBiju1 commented on Aug 16, 2026

    @AromalBiju1
    Contributor

    Dug into this — reproduced it, but the result is a bit different than expected.

    Confirmed on v0.7.5 (matching the version in this report) using your exact repro: grep -c 'archive/' graphify-out/graph.json stays at the same count before and after update . --force with a purged cache. Root cause in that version's _rebuild_code() (watch.py):

    new_ast_ids = {n["id"] for n in result["nodes"]}
    preserved_nodes = [n for n in existing.get("nodes", []) if n["id"] not in new_ast_ids]
    

    This merge only ever adds/replaces nodes for files in the current extraction batch — it never checks whether a preserved node's source file is still part of the current corpus. So a file that becomes newly-ignored (not deleted, just excluded) is simply absent from this run's result, and its old nodes get carried forward forever, indistinguishable from an unchanged file. There's no ignore/corpus-membership check anywhere in that function. Matches the impact you described exactly — nothing enforces exclusion at merge time, only at (re-)extraction time.

    However: I ran the identical repro against current v8 (0.9.44) and could not reproduce it there — the newly-ignored file is correctly pruned, with an explicit log line (pruned N node(s) from M newly-ignored file(s)...). That version has a materially different reconciliation path in watch.py that explicitly checks live ignore rules against existing graph nodes before preserving them, which v0.7.5 doesn't have.

    So this looks like it may already be fixed upstream and just not present in the version installed here. @oilsinwater — can you confirm whether this still reproduces if you upgrade to the latest release? If it does, I'd like to see the repo/version details since my repro on current HEAD doesn't trigger it, which means there's a different code path involved than the one I found. If it's already fixed on latest, this can probably close as resolved-by-upgrade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions