Repository navigation
fix(vbnet): resolve calls through typed fields, Me.field and With blocks (#4588) - #4623
Deepjyoti-Sarmah wants to merge 9 commits into
Conversation
|
Thanks for the pull request, @Deepjyoti-Sarmah. A maintainer will review it soon. Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions. A couple of things that speed up review: make sure the test suite passes on Python 3.10 and 3.13, and that the change keeps extraction deterministic. |
There was a problem hiding this comment.
Graphify reviewed this change.
No issues found by static checks — no coupling regressions or blocking issues in the code graph. That is not the same as safe to merge: see what was not checked.
Not checked: tests were not run; formal verification proved 0 of 3 changed function(s) (1 sampled, not proven, 2 not verified).
Formal verification. PR-changed functions: 1/3 verified (0 proven, 1 may-equivalent, 0 distinguished) · 2 not verified (1 vacuous, 1 unsupported).
Not verified on this run: build\_from\_json (vacuous: never exercised), \_rebuild\_code (unsupported).
Graphify review — findings
Adds cross-file resolution of VB.NET calls: a receiver's declared type, the caller's namespace and imports, and a module's members now bind a call to a single target, including C# ones, through the new resolve_vbnet_calls in place of resolve_vbnet_partial_calls on the .vb resolver hook. In build_from_json, an INFERRED calls edge the VB resolver bound to one C# target (_vbnet_resolved) is no longer dropped by the cross-language filter, while a C# bare name matched to a VB Module member is still dropped. Bumps _AST_CACHE_SCHEMA to 22 so cached VB extractions re-run, since they now carry receiver, type, owner, namespace and import data.
Review partial — this diff was larger than one review pass covers, so later files were not reviewed; some findings may be missing.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 5011 functions depend on the 735 functions this change touches.
Health — this change adds coupling hotspots:
- worse:
extract()— 989 callers, 59 callees - worse:
_rebuild_code()— 190 callers, 60 callees - worse:
build_from_json()— 269 callers, 22 callees - worse:
save_cached()— 50 callers, 9 callees - worse:
process_type()— 1 callers, 7 callees
Verification — 5011 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 4516 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
436 of 436 test file(s) selected (100%) via static blast radius.
Escalated to a full run for safety — the selection is not trustworthy on its own (see below). CI should run the whole suite.
tests/pi.test.ts— full-run-safetytests/test_affected_cli.py— full-run-safetytests/test_affected_defines.py— full-run-safetytests/test_affected_member_seed.py— full-run-safetytests/test_affected_overrides.py— impact, full-run-safetytests/test_agents_platform.py— full-run-safetytests/test_alias_folding.py— impact, full-run-safetytests/test_analyze.py— impact, full-run-safetytests/test_anthropic_custom_endpoint.py— full-run-safetytests/test_antigravity_install.py— full-run-safetytests/test_apm_fallback_version.py— full-run-safetytests/test_architecture_doc.py— full-run-safetytests/test_astro_extraction.py— impact, full-run-safetytests/test_astro_import_ids.py— impact, full-run-safetytests/test_atomic_canvas_export.py— impact, full-run-safetytests/test_atomic_version_stamp.py— full-run-safetytests/test_atomic_writes.py— impact, full-run-safetytests/test_backend_env_isolation.py— full-run-safetytests/test_backend_extras.py— full-run-safetytests/test_backend_opt_in.py— impact, full-run-safetytests/test_benchmark.py— impact, full-run-safetytests/test_benchmark_raw_graph.py— impact, full-run-safetytests/test_benchmark_real_query.py— impact, full-run-safetytests/test_blade_extractor.py— impact, full-run-safetytests/test_build.py— impact, full-run-safetytests/test_build_located_semantic_identity.py— impact, full-run-safetytests/test_build_merge_dedup_scope.py— impact, full-run-safetytests/test_build_merge_hyperedges_and_prune.py— impact, full-run-safetytests/test_build_merge_shrink_guard.py— impact, full-run-safetytests/test_builtin_global_type_refs.py— impact, full-run-safetytests/test_c_include_resolution.py— impact, full-run-safetytests/test_cache.py— impact, full-run-safetytests/test_cache_stale_import_target.py— impact, full-run-safetytests/test_callflow_html.py— full-run-safetytests/test_cargo_introspect.py— full-run-safetytests/test_cargo_missing_manifest.py— full-run-safetytests/test_carried_hyperedge_remap.py— impact, full-run-safetytests/test_case_sensitive_resolution.py— impact, full-run-safetytests/test_charmap_encoding.py— impact, full-run-safetytests/test_chunking.py— impact, full-run-safetytests/test_cjs_module_extension.py— impact, full-run-safetytests/test_claude_cli_backend.py— impact, full-run-safetytests/test_claude_md.py— full-run-safetytests/test_cli_broken_pipe.py— full-run-safetytests/test_cli_export.py— impact, full-run-safetytests/test_cli_help.py— full-run-safetytests/test_cloud_cta.py— full-run-safetytests/test_cluster.py— impact, full-run-safetytests/test_cluster_ambiguous_scale.py— full-run-safetytests/test_cluster_exclude_hubs.py— full-run-safety- … and 386 more
changed code file(s) with no mapped test (
graphify/extractors/vbnet.py) — a coverage gap or a missing link — running the full suite rather than only the selected tests
Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.
Docs that may be stale (advisory)
ARCHITECTURE.md§ Module responsibilities (lines 13-35): references changed symbolsnodesARCHITECTURE.md§ Calling extract() from your own code (lines 36-49): references changed symbolsresolveARCHITECTURE.md§ Extraction output schema (lines 50-66): references changed symbolsnodesARCHITECTURE.md§ Adding a new language extractor (lines 81-88): references changed symbolsnodesCHANGELOG.md§ 0.9.93 (2026-10-20) (lines 5-31): references changed symbolsnodesCHANGELOG.md§ 0.9.90 (2026-10-13) (lines 71-89): references changed symbolsnodesCHANGELOG.md§ 0.9.88 (2026-10-12) (lines 104-128): references changed symbolsnodesCHANGELOG.md§ 0.9.87 (2026-10-12) (lines 129-151): references changed symbolsresolveCHANGELOG.md§ 0.9.85 (2026-10-10) (lines 174-196): references changed symbolsresolveCHANGELOG.md§ 0.9.84 (2026-10-10) (lines 197-210): references changed symbols__init__
…and 10 more.
Formal verification
Could not verify: Could not verify build\_from\_json.
The verifier did not have enough to check build\_from\_json, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: no capturable inputs from the test suite; property tier: not verifiable: all 11 sampled inputs raised on both versions — the function never executed, so 'no divergence' would be vacuous
No difference found (not proven): No behavior difference found in extract\_vbnet (not a proof).
The verifier ran both versions of extract\_vbnet on many inputs and saw identical behavior every time. Strong evidence the change is safe, but evidence, not a proof.
Guarantee: Empirical: differential testing (both versions run on many generated inputs). A divergence on an untested input remains possible, so this is 'no counterexample found', not 'proven equivalent'.
Note: An input the sampler did not try could still differ.
Could not verify: Could not verify \_rebuild\_code.
The verifier did not have enough to check \_rebuild\_code, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: no capturable inputs from the test suite; property tier: nondeterministic output (both versions disagreed with themselves on the witness) — not a behaviour change; a function whose output is not a function of its inputs (random / time / uuid / os.urandom, or state carried across calls) cannot be soundly distinguished by execution, so this tier abstains for the whole function
· 1 grounded finding(s) anchored inline below; 4 more finding(s) on lines outside this diff (see the check run).
| details.update(declared_type=declared, namespace=namespace, imports=list(file_imports)) | ||
| return details | ||
|
|
||
| def process_type(block: Node, parent_id: str, namespace: str) -> None: |
There was a problem hiding this comment.
process_type()
fans out to 7 callees (efferent coupling).
Grounded coupling-delta finding (deterministic), not an LLM guess.
|
I tested // NsRules.cs
namespace Acme.Rules
{
public static class NsRules
{
public static string Banner(int x) { return ""; }
public static string Banner(int x, string format) { return format; }
}
}' Caller.vb
Imports Acme.Rules
Public Class Caller
Public Sub L_OverloadOneArg()
NsRules.Banner(1)
End Sub
End ClassGRAPHIFY_BACKEND=none graphify extract l-repro --code-onlyExpected:
|
bc386bf to
d1bf77f
Compare
d1bf77f to
da08d73
Compare
There was a problem hiding this comment.
Graphify review 
2 bugs · 7 possible issues to check · High impact
VB.NET extraction now resolves more calls through typed locals, fields, and With blocks.
A lambda’s local can redirect calls outside the lambda ·
vbnet.py:927
Lambda parameters can resolve calls through a shadowed field ·
vbnet.py:880
7 possible issues we couldn't confirm
- The
vbnet_partial_callsresolver now runsresolve_vbnet_calls, so the partial-call pass is no longer registered ·graphify/extract.py:10231 - C# bare-name calls into VB Module members are now dropped as cross-language phantoms, though the comment says they should still match ·
graphify/build.py:2242 - The stale-cache test can pass without checking that the cache schema was bumped ·
tests/test_vbnet_extractor.py:908 - +4 more in Graphify
They don't change the score.
What this review covered
- Some lookups asked for files or lines that do not exist; the review was told and carried on.
- One review pass used all of its turns for reading code, so it reported from what it had already read.
- 6 of 6 changed files inspected. This is scope, not a correctness guarantee.
Code graph · 6708 functions depend on this change
- 6 functions became more coupled. Largest:
extract()(1350 callers),build_from_json()(339 callers),save_cached()(63 callers). - 459 of 620 test files are affected by this change.
- Gate, test list and every flagged function: in the Graphify check.
Reviewed d371f36 · 2 earlier findings not re-checked
…and C# statics (Graphify-Labs#4570) VB.NET calls produced a `calls` edge only when caller and callee were in the same file. A call to a Module Sub declared elsewhere, a qualified call such as `Helpers.LogIt(...)`, a call through a local declared with `As New T()`, and a call to a C# static method were all dropped by the extractor, and the shared name pass skips member calls, so nothing picked them up. The extractor now keeps every call it cannot resolve in its own file as a raw call, with the receiver, the receiver's kind (none, Me, MyBase, a local, or a name), the declared type of a local, parameter or loop variable, the caller's namespace and Imports, and the nested types of the caller's type. A new resolver, resolve_vbnet_calls, binds them with VB's own scoping rules, taken from compiling each case with the .NET 8 SDK: - the caller's type and its base classes hide a Module's member of the same name, whatever its arity; - a field, a property or an event of that name also hides the Module's Sub (a delegate field is invoked instead); - a Module is in scope only through its own, an enclosing, or an imported namespace, and two in-scope Modules that declare the name give no edge; - a field, a property or a nested type named like the receiver hides the type; - a type name must be unique in scope; - a C# target needs to be the only method of that name on its type, because C# method nodes carry no arity. Only a unique match makes an edge. Qualified and unqualified Module calls and base-class calls are EXTRACTED; calls through a typed local and casefolded C# names are INFERRED (0.85). When the caller's base chain leaves the corpus (a Form, a Page), the edge is INFERRED with context `external_base_may_hide`, since that base may declare the name. The resolver replaces resolve_vbnet_partial_calls, which stays as an alias and keeps its registry name, and its `partial_type_call` edges are unchanged. v8 bound two kinds of call to a same-named method of the caller's own type, which the compiler does not: `.Save()` inside a With block (it calls the With object's method) and a call of a local delegate (the local hides the method). Both wrong edges are gone. watch.py now forwards the metadata keys `owner`, `full_name`, `accepted_arities` and `namespace` to the resolvers as context for an incremental rebuild. Two side effects follow. The partial-class resolver, which needs `owner` and `accepted_arities`, now works across changed and unchanged files. And the C# resolvers see the namespace of unchanged types: a `using Beta` caller of a `Svc` declared in both Alpha and Beta bound to Alpha.Svc on an incremental rebuild and to Beta.Svc on a full one, and now binds to Beta.Svc on both. The AST cache schema goes from 17 to 18 because VB raw calls change. Limits: project-level Imports and RootNamespace from the .vbproj are not read; in a multi-project corpus whose projects do not reference each other, a Module from an unreferenced project can be bound; Shared versus instance is not modeled; a call through a field and a call inside a With block are not resolved to the receiver's type.
…y-Labs#4570) build.py's cross-language phantom filter drops an INFERRED call whose endpoints are in different families, and .vb has none there, so every INFERRED VB -> C# edge the VB resolver made was dropped: a call from a class whose base leaves the corpus (a Form) and a call through a typed local. The resolver's edges now carry _vbnet_resolved, and the filter keeps them. A C# bare name matched to a VB Module member by the shared name pass is still dropped: C# cannot reach it without the Module name.
…cks (Graphify-Labs#4588) Fields and properties carry their declared type (As T / As New T()), owner, namespace and imports. The resolver looks a receiver up as a field of the caller's type, then its VB bases nearest first, and binds to the declared type's member as INFERRED. With blocks track the innermost target. watch.py forwards the new metadata; AST cache schema 21 -> 22.
da08d73 to
d371f36
Compare
| for body, caller_id, owner_key, type_name, namespace, nested_types in bodies: | ||
| locals_table = method_locals(body) |
There was a problem hiding this comment.
A lambda’s local can redirect calls outside the lambda
A local declared inside a lambda can make a later call in the enclosing method resolve to the wrong type, or disappear from the graph.
Exclude lambda-local declarations from method_locals.
Evidence · checked against the code
Expected: The outside call is resolved using the enclosing field’s type, or remains unresolved if that type cannot be determined.
Actually: The lambda declaration enters the method-wide locals table, so the outside call may use the lambda-local type or be left unresolved.
- Independent source review: Checked the resolver’s field lookup path: it can use an enclosing field’s declared type when the call is classified as a field/name receiver, but a matching name in the locals table is classified as a local first. That field path does not mitigate the reported case. The inspected VB tests cover other call-resolution behavior but not lambda-local shadowing.
- Some lookups asked for files or lines that do not exist; the review was told and carried on.
- The added tests exercise calls inside lambdas in
Withblocks, but do not test a lambda-local name colliding with a field used outside the lambda.
Prompt to fix with AI
In graphify/extractors/vbnet.py, method_locals (lines 926-927):
Problem: A lambda’s local can redirect calls outside the lambda
Expected: The outside call is resolved using the enclosing field’s type, or remains unresolved if that type cannot be determined.
Actually: The lambda declaration enters the method-wide locals table, so the outside call may use the lambda-local type or be left unresolved.
Fix it at the cause, and add a test that fails without the fix.
Graphify · Checked against the code · View in Graphify
| parameters = body.child_by_field_name("parameters") | ||
| for parameter in (parameters.named_children if parameters is not None else []): |
There was a problem hiding this comment.
Lambda parameters can resolve calls through a shadowed field
A call inside a lambda can be linked to the enclosing class’s field type even when a lambda parameter with the same name shadows that field.
Add lambda parameters to the local-name table while resolving their bodies.
Evidence · checked against the code
Expected: The call should resolve using the lambda parameter's type, or remain unresolved if that type cannot be resolved.
Actually: The lambda parameter is omitted from the method-local name table, so the resolver can use the shadowed field or property's declared type and link to the wrong method.
- Independent source review: Checked the receiver classification and resolver path: the parameter is absent from locals_table, and the name-receiver path uses find_field(owner, first) before resolving against the field's declared type. The enclosing-field lookup does not account for lambda-parameter shadowing. The inspected VB.NET tests do not cover this case.
- Some lookups asked for files or lines that do not exist; the review was told and carried on.
Prompt to fix with AI
In graphify/extractors/vbnet.py, method_locals (lines 879-880):
Problem: Lambda parameters can resolve calls through a shadowed field
Expected: The call should resolve using the lambda parameter's type, or remain unresolved if that type cannot be resolved.
Actually: The lambda parameter is omitted from the method-local name table, so the resolver can use the shadowed field or property's declared type and link to the wrong method.
Fix it at the cause, and add a test that fails without the fix.
Graphify · Checked against the code · View in Graphify
What does this PR do?
Fixes #4588. Stacked on #4573, so only the last two commits are new: 467f15b (tests) and 25d072b (fix).
The VB resolver dropped calls made through a field, through
Me.field, and insideWithblocks:Fields had no declared type, so a field receiver hid the call and nothing replaced it.
As TandAs New T()give a field a type.Private x = New T()isObjectto the compiler, because Option Infer doesn't apply to fields.Me.f,MyClass.fandOwnType.fresolve likef._vbnet_resolvedmarker from fix(vbnet): resolve cross-file calls to Module members, typed locals and C# statics (#4570) #4573.watch.pyforwardsdeclared_typeandimports._AST_CACHE_SCHEMA21 → 22.Type of change
Verification & Invariants
Invariant: a VB
callsedge points only at the method the compiler would bind. When the receiver's type isn't known for sure, there's no edge, never a guess.I checked each case against the VB compiler (dotnet SDK 8.0, 30 cases). A local, a parameter or a
Shadowsfield hides a field. A field hides a type of the same name. NestedWithuses the innermost target. Lambdas see theWithtarget. An untyped field isObject(BC30209 under Strict On).Persisted state: field and property nodes gain
metadata.owner,declared_type,namespaceandimports. The schema bump re-extracts cached VB files. The change is two-way: reverting it and bumping the schema again restores the old graph.Known gap: a call whose receiver is a field declared in another partial file or a base class can still bind to a type with the same name in the calling file (same-file shortcut). #4573 behaves the same way, and it takes a field named exactly like a type.
How was this tested?
Graphify-specific checklist
uv run python -m tools.skillgen --bless) when changing their source fragments. (N/A, no skill sources touched)