Hi @userhimanshuverma ,
While reviewing the auto-update architecture across parser.py and watcher.py, I noticed a critical edge case. In parser.py, we use exclude_dirs to skip directories like venv/ and node_modules/. However, GraphFileHandler in watcher.py only checks if not event.src_path.endswith('.py') and misses the directory exclusion logic completely.
Steps to Reproduce & Impact
- Run the Graph Watcher in the background.
- A user or an AI agent runs
pip install pandas (or any large package) in their local .venv.
watchdog detects thousands of new .py files being created in the virtual environment.
- For every single file,
on_created fires, calling update_graph() and executing save_graph() synchronously.
- Rewriting the entire JSON graph to disk thousands of times causes a severe I/O bottleneck, freezing the MCP server.
Proposed Solution
Share the exclude_dirs logic between PythonParser and GraphFileHandler so the watcher explicitly ignores events from venv, .git, etc.
I’d be happy to raise a PR to implement this exclusion filtering if you think it's a priority. Let me know!
Hi @userhimanshuverma ,
While reviewing the auto-update architecture across
parser.pyandwatcher.py, I noticed a critical edge case. Inparser.py, we useexclude_dirsto skip directories likevenv/andnode_modules/. However,GraphFileHandlerinwatcher.pyonly checksif not event.src_path.endswith('.py')and misses the directory exclusion logic completely.Steps to Reproduce & Impact
pip install pandas(or any large package) in their local.venv.watchdogdetects thousands of new.pyfiles being created in the virtual environment.on_createdfires, callingupdate_graph()and executingsave_graph()synchronously.Proposed Solution
Share the
exclude_dirslogic betweenPythonParserandGraphFileHandlerso the watcher explicitly ignores events fromvenv,.git, etc.I’d be happy to raise a PR to implement this exclusion filtering if you think it's a priority. Let me know!