fix: schema 27 + adapt #4726 to _method_of + close #4748 false-skip

- Bump _AST_CACHE_SCHEMA 26 -> 27 for the VB.NET (#4725), Python injected-field
  (#4726), and Rust use-crate-scope (#4699) extraction-output changes; each PR
  shipped a stale 25->26 bump.
- #4726: its method-result block passed the list-valued method_index.get(...)
  straight to _emit_call, which silently dropped the edge since #4734 made
  method_index list-valued; route it through _method_of for the exact method.
- #4748: _inputs_unchanged now treats a scanned file with no manifest row as
  changed (unstamped_is_changed=True). A file whose extraction previously failed
  was otherwise skipped forever once fixed, shipping a stale graph; inverted the
  test that pinned the old behavior.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
safishamsiandClaude Opus 4.8 committed 2026-10-25 18:40:19 +00:00
1 parent 3e1a423fe1
commit 830de39f94
4 files changed
+18 -9

No files matched your search

+1 -1
View File
@@ -38,7 +38,7 @@ except Exception:
_EXTRACTOR_VERSION = "unknown"
# Bump when AST cache-key semantics change independently of the package version.
_AST_CACHE_SCHEMA = 26 # Zig no longer crosses a call between a method and a same-named free function (#4755), and a Dart unnamed `extension on T` is detected (#4741), so cached Zig and Dart extractions re-run; prior (25): Python/Go/C++/Rust explicit type aliases (and Rust `union` items) are extracted as type nodes so references resolve instead of minting sourceless stubs (#4578/#4579/#4580/#4581); each C# method overload gets its own node bound by arity (#4584); a package.json dependency's manifest entry links to its ref node (#4569), so cached extractions re-run; prior (24): Objective-C `NS_CLOSED_ENUM` declarations are extracted as enums like `NS_ENUM` (#4705), and a `CREATE TABLE` whose column default the SQL grammar rejects (MySQL `DEFAULT current_timestamp()`) is recovered from its ERROR node (#4613), so cached ObjC and SQL extractions re-run; prior (23): `.yaml`/`.yml` files are structurally extracted (keys as nodes, config-vs-data gated) and reclassified from document to code (#2214), so cached YAML re-extracts; prior (22): SQL labels drop T-SQL brackets and routine bodies emit `reads_from`/`writes_to` (#4635), and a `GO` batch separator ends a statement (#4651), so cached `.sql` extractions re-run; prior (21): a CommonJS `const X = require('./m')` binding no longer mints a module-scope node that shadows the class the required file exports, so `new X()` resolves to the required declaration (#4621); prior (20): Obsidian `[[wikilink]]` targets that start with the scan root's own folder names now resolve to the real page (#4559), so cached markdown extractions re-run; prior (19): Dart `typedef` declarations are extracted as aliases (not variables of type `typedef`); C++ Metal/CUDA GPU qualifiers no longer mint sourceless god nodes (#4550); a `.h` header containing `extern "C"` routes to the C++ extractor; prior (18): Kotlin `typealias` (#4553), C# `delegate` (#4552), and Swift `macro` declarations (#4551) are now extracted so references stop minting sourceless stubs; Rust `use` rooted at a `mod` declared in the same scope carries `_rust_use_name` (#4564); prior (17): Python pytest-fixture markers (`_py_fixture`/`_python_fixture_param`, #4332) and module-level class-id collision salting (#2810); TS `this.field` typed from any method incl. static (#4473); Solidity callables carry `metadata.arity` + inherited-call/`super`/modifier raw calls (#4379); Go type-decl and Rust file-item case-distinct node ids (#4444); prior (16): Rust `use` edges carry the imported name as written (`_rust_use_name`, #4439); (15): Go generic receiver types normalized (`Box[T]` -> `Box`) so methods attach to the type node; prior (14): C# receiver resolution for nameless/`new X()`/`foreach` receivers (defer + receiver-chain markers) and `_`/case-distinct node ids (underscore-salted); prior (13): Kotlin/Scala/C++/Swift generic & template type params no longer mint sourceless stubs; Objective-C NS_ENUM/NS_OPTIONS extraction and `_callable`/`_callable_class` markers; Go and PHP receiver-typed member calls park cross-repo (`go_type_table`/`php_type_table`, receiver fields); prior (12): Java inherited-supertype (`receiver_unbound`) and chained/new/cast receiver typing (`java_receiver_chain`, `_java_ret`); C/C++ quoted cross-directory include provenance (`include_kind`); JS external imports anchored to the package, not the path leaf; prior (11): Python property-accessor decorators / `Self`, Swift `Self`, Go generic type params, Python forward type-hint file node, PowerShell dot-source, C# verbatim-interpolated string recovery; (10): C# partial types carry `type_path`; (9): Python property-read raw calls and `_py_property` nodes; (8): Rust `use`-group per-binding edges; (7): Python opaque-base/super(args) markers + nested-class enclosing ids.
_AST_CACHE_SCHEMA = 27 # VB.NET external namespace/type stubs now carry a `source_file` sentinel (#4725); Python member calls resolve through injected fields and method-result types (#4726); a Rust `use` is scoped to the crate it names (#4699), so cached VB.NET/Python/Rust extractions re-run; prior (26): Zig no longer crosses a call between a method and a same-named free function (#4755), and a Dart unnamed `extension on T` is detected (#4741), so cached Zig and Dart extractions re-run; prior (25): Python/Go/C++/Rust explicit type aliases (and Rust `union` items) are extracted as type nodes so references resolve instead of minting sourceless stubs (#4578/#4579/#4580/#4581); each C# method overload gets its own node bound by arity (#4584); a package.json dependency's manifest entry links to its ref node (#4569), so cached extractions re-run; prior (24): Objective-C `NS_CLOSED_ENUM` declarations are extracted as enums like `NS_ENUM` (#4705), and a `CREATE TABLE` whose column default the SQL grammar rejects (MySQL `DEFAULT current_timestamp()`) is recovered from its ERROR node (#4613), so cached ObjC and SQL extractions re-run; prior (23): `.yaml`/`.yml` files are structurally extracted (keys as nodes, config-vs-data gated) and reclassified from document to code (#2214), so cached YAML re-extracts; prior (22): SQL labels drop T-SQL brackets and routine bodies emit `reads_from`/`writes_to` (#4635), and a `GO` batch separator ends a statement (#4651), so cached `.sql` extractions re-run; prior (21): a CommonJS `const X = require('./m')` binding no longer mints a module-scope node that shadows the class the required file exports, so `new X()` resolves to the required declaration (#4621); prior (20): Obsidian `[[wikilink]]` targets that start with the scan root's own folder names now resolve to the real page (#4559), so cached markdown extractions re-run; prior (19): Dart `typedef` declarations are extracted as aliases (not variables of type `typedef`); C++ Metal/CUDA GPU qualifiers no longer mint sourceless god nodes (#4550); a `.h` header containing `extern "C"` routes to the C++ extractor; prior (18): Kotlin `typealias` (#4553), C# `delegate` (#4552), and Swift `macro` declarations (#4551) are now extracted so references stop minting sourceless stubs; Rust `use` rooted at a `mod` declared in the same scope carries `_rust_use_name` (#4564); prior (17): Python pytest-fixture markers (`_py_fixture`/`_python_fixture_param`, #4332) and module-level class-id collision salting (#2810); TS `this.field` typed from any method incl. static (#4473); Solidity callables carry `metadata.arity` + inherited-call/`super`/modifier raw calls (#4379); Go type-decl and Rust file-item case-distinct node ids (#4444); prior (16): Rust `use` edges carry the imported name as written (`_rust_use_name`, #4439); (15): Go generic receiver types normalized (`Box[T]` -> `Box`) so methods attach to the type node; prior (14): C# receiver resolution for nameless/`new X()`/`foreach` receivers (defer + receiver-chain markers) and `_`/case-distinct node ids (underscore-salted); prior (13): Kotlin/Scala/C++/Swift generic & template type params no longer mint sourceless stubs; Objective-C NS_ENUM/NS_OPTIONS extraction and `_callable`/`_callable_class` markers; Go and PHP receiver-typed member calls park cross-repo (`go_type_table`/`php_type_table`, receiver fields); prior (12): Java inherited-supertype (`receiver_unbound`) and chained/new/cast receiver typing (`java_receiver_chain`, `_java_ret`); C/C++ quoted cross-directory include provenance (`include_kind`); JS external imports anchored to the package, not the path leaf; prior (11): Python property-accessor decorators / `Self`, Swift `Self`, Go generic type params, Python forward type-hint file node, PowerShell dot-source, C# verbatim-interpolated string recovery; (10): C# partial types carry `type_path`; (9): Python property-read raw calls and `_py_property` nodes; (8): Rust `use`-group per-binding edges; (7): Python opaque-base/super(args) markers + nested-class enclosing ids.
# Per-process memo: distributions() scans site-packages metadata, which is
+3 -1
View File
@@ -5306,7 +5306,9 @@ def _resolve_python_member_calls(
continue
cls = next(iter(classes))
if cls in class_ids:
_emit_call(rc["caller_nid"], method_index.get((cls, _key(rc["callee"]))), rc, inferred=True)
# method_index is list-valued since #4734; resolve the exact-spelled
# method via _method_of rather than passing the raw candidate list.
_emit_call(rc["caller_nid"], _method_of(cls, rc["callee"]), rc, inferred=True)
# Every suffix the TS/JS extractors claim, so a pure-ESM (`.mjs`) repo still activates
+6 -1
View File
@@ -1637,8 +1637,13 @@ def _inputs_unchanged(detected: dict, manifest_path: Path, root: Path) -> bool:
]
keyed = {_abs(k): v for k, v in manifest.items()}
# unstamped_is_changed=True: a scanned file with no manifest row or a blanked
# ast_hash (e.g. one that previously FAILED extraction, #2543) counts as
# changed, so fixing it later takes the full rebuild instead of being skipped
# forever. The only cost is that a corpus with a permanently-failing file never
# fast-paths — the safe direction (a false "changed" only costs time).
changed, _unchanged = classify_manifest_files(
buckets, keyed, kind="ast", unstamped_is_changed=False
buckets, keyed, kind="ast", unstamped_is_changed=True
)
if any(changed.values()):
return False
+8 -6
View File
@@ -208,13 +208,15 @@ def test_inputs_unchanged_rejects_an_empty_manifest(tmp_path: Path) -> None:
assert _inputs_unchanged(detected, root / "graphify-out" / "manifest.json", root) is False
def test_inputs_unchanged_tolerates_a_scanned_file_with_no_manifest_row(
def test_inputs_unchanged_treats_a_scanned_file_with_no_manifest_row_as_changed(
built: Path,
) -> None:
# A source whose AST extraction permanently fails is deliberately never
# stamped (#2543), so a row-based comparison alone would report it changed on
# every run and the gate could never fire. The observable state of such a
# file is exactly "in the scan, absent from the manifest".
# A scanned source with no manifest row (e.g. one whose AST extraction
# previously failed, #2543) must NOT fast-path the gate: if it is later fixed
# with no other change in the tree, the gate has to take the full rebuild so
# the graph gains its nodes. Tolerating the missing row would skip forever and
# leave the graph stale. The cost is that a corpus with a permanently-failing
# file never fast-paths, which is the safe direction.
from graphify.detect import detect, load_manifest
from graphify.watch import _inputs_unchanged
@@ -226,7 +228,7 @@ def test_inputs_unchanged_tolerates_a_scanned_file_with_no_manifest_row(
manifest_path.write_text(json.dumps(manifest), encoding="utf-8")
detected = detect(built)
assert _inputs_unchanged(detected, manifest_path, built) is True
assert _inputs_unchanged(detected, manifest_path, built) is False
def test_scan_digest_tracks_the_file_set_not_the_contents(built: Path) -> None: