fix(resolution): clear the #3500 path-resolution caches per extract() run

The memoized path/source-key lru_caches are keyed by (path, cwd) with no mtime
component; without a per-run clear they replay stale results across repeated
extract() calls in a long-lived watch/MCP process. Wire them into the existing
cache-clear block. (follow-up to #3500)
This commit is contained in:
safishamsi committed 2026-09-11 22:47:27 +01:00
1 parent cd8d99b2f4
commit 047dd93187
1 file changed
+8
+8
View File
@@ -80,6 +80,8 @@ from graphify.extractors.resolution import ( # noqa: E402,F401
_WORKSPACE_MANIFEST_NAMES,
_apply_symbol_resolution_facts,
_augment_symbol_resolution_edges,
_cached_realpath,
_cached_source_key,
_collect_js_symbol_resolution_facts,
_collect_python_symbol_resolution_facts,
_contained_in_package,
@@ -6398,6 +6400,12 @@ def extract(
_PACKAGE_IMPORTS_CACHE.clear()
_XAML_CSHARP_CLASS_CACHE.clear()
_MD_LINK_INDEX_CACHE.clear()
# Path-resolution memoization (#3500) is keyed by (path, cwd) with no mtime
# component, so — like the alias caches above — a symlink repoint or a path
# that starts/stops existing between rebuilds in a long-lived `graphify
# watch` / MCP process would otherwise replay a stale result. Clear per run.
_cached_realpath.cache_clear()
_cached_source_key.cache_clear()
# Infer a common root for cache keys (use first diverging segment, not sum of all matches)
try: