Repository navigation
fix(vbnet): count ByVal Optional parameters as optional (#5320) - #5327
Deepjyoti-Sarmah wants to merge 2 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.11 and 3.13, and that the change keeps extraction deterministic. |
There was a problem hiding this comment.
Graphify code review 
Review completed · 3517ddb86e21
Tip
Merge confidence: 5/5 · Looks safe to merge · 🟠 High impact
No issues reported
VB.NET callable arity now treats parameters with default values as omittable, regardless of modifier order.
Full summary
VB.NET callable arity now treats parameters with default values as omittable, regardless of modifier order. The cache schema is bumped so cached extractions are refreshed.
Code graph and static checks · 3712 functions depend on this change
Impact & health
Impact — 3712 functions depend on the 129 functions this change touches.
Health — this change adds coupling hotspots:
- worse:
extract()— 1284 callers, 78 callees
Formal checks — 3712 functions this change can affect weren't formally checked in this review. Formal checks are informational only.
Gate & verification
✅ PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 2163 function(s) in the blast radius were not formally verified this run
Test selection
58 of 593 test file(s) selected (10%) via static blast radius.
ℹ️ 1 changed file rests on a single covering test (
graphify/extractors/vbnet.py). The selection is only as good as that one test — raiseminCoveringTeststo run the full suite instead when coverage is this thin.
tests/test_binary_media_words.py— impacttests/test_cache.py— impacttests/test_cache_long_paths.py— impacttests/test_cache_stale_import_target.py— impacttests/test_cache_windows_case_4925.py— impacttests/test_charmap_encoding.py— impacttests/test_chunking.py— impacttests/test_code_only_scope_4923.py— impacttests/test_cpp_template_members.py— impacttests/test_csharp_partial_classes.py— impacttests/test_definition_file_portability.py— impacttests/test_detect.py— impacttests/test_extract.py— impacttests/test_extract_cache_location.py— impacttests/test_extract_cli.py— impacttests/test_grammar_cache_key.py— impacttests/test_hook_content_freshness.py— impacttests/test_ignore_file_encoding.py— impacttests/test_incremental_mtime_collision.py— impacttests/test_java_member_calls.py— impacttests/test_java_nested_type_identity.py— impacttests/test_js_member_collisions.py— impacttests/test_language_override_lifecycle.py— impacttests/test_language_overrides.py— impacttests/test_linked_worktree_reconcile.py— impacttests/test_llm_ambiguous_fragments.py— impacttests/test_llm_backends.py— impacttests/test_manifest_ingest.py— impacttests/test_msbuild_dir_evidence.py— impacttests/test_objc_field_table_remap.py— impacttests/test_out_dir_evidence.py— impacttests/test_partial_cache.py— impacttests/test_pipeline.py— impacttests/test_python_inherited_method_calls.py— impacttests/test_python_injected_factory_calls.py— impacttests/test_python_property_reads.py— impacttests/test_python_pytest_fixture_receivers.py— impacttests/test_rust_self_member_calls.py— impacttests/test_rust_use_trees.py— impacttests/test_semantic_cache_basename_recovery.py— impacttests/test_semantic_cache_out_root.py— impacttests/test_skill_persisted_scan_options.py— impacttests/test_skill_semantic_all_cached.py— impacttests/test_skillgen.py— impacttests/test_slice_checkpoint_completeness.py— impacttests/test_stale_prune.py— impacttests/test_stat_index_husk.py— impacttests/test_stat_index_multi_root.py— impacttests/test_stat_index_portability.py— impacttests/test_terraform_modules.py— impact- … and 8 more
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.
Every flagged function
extract()ingraphify/extract.py:11742· 1284 callers, 78 callees: fans out to 78 callees (efferent coupling); 1284 callers depend on it (afferent coupling)
|
Landed in 0.9.113 (now on PyPI) as 086d19f. Thanks for the fix, @Deepjyoti-Sarmah. |
What does this PR do?
Refs #5320 (point 2,
ByVal Optional). A VB.NET parameter writtenByVal Optional x As Integer = 0is counted as required, so a call that leaves the argument out gets nocallsedge.The extractor decides whether a parameter is optional by whether its text starts with
optional. VB allows the modifiers in either order, andByVal Optional xstarts withByVal:In VB a parameter has a default value exactly when it is
Optional. I checked this with the .NET 8 SDK compiler:tree-sitter-vb-dotnet 0.3.0 puts an ERROR node inside
ByVal Optional x, but it still keeps thedefault_valuefield on the parameter, so the check no longer depends on modifier order or on how the grammar recovers.The rest of #5320
DataLayer.LoadCustomers()andHelperFunction()cases both get an edge.'and{}, the ERROR node stays inside the one statement and every method and call in the file survives. I asked on the issue for a file that loses its methods.ByVal Optionaleither. The methods survive; only calls that leave out the optional argument were dropped, which is what this PR fixes.--forceserved old AST results is expected for a local patch.--forceskips the semantic cache, and the AST cache is keyed on the package version, so a released version does not hit this.Type of change
Verification & Invariants
Invariant: a VB.NET method's
accepted_aritiesruns from its required parameter count to its total, where a parameter is required exactly when it has no default value.Merge Danger
Door: two-way. One expression in
graphify/extractors/vbnet.pyplus the cache schema bump. Reverting the fix commit restores 0.9.112.Blast Radius: small. VB.NET only. Methods whose optional parameters were written
ByVal OptionalorByRef Optionalgain the lower arities, so calls that leave those arguments out now resolve. Any other parameter gets the same arity as before._AST_CACHE_SCHEMAgoes from 48 to 49 so cached VB results from before the fix are re-extracted. #4573 also bumps the schema, so whichever of the two lands second needs a one-line rebase.Limitations
ParamArrayparameters still count as one required argument. That is a separate gap.Optionalas the name inByVal Optional x) keeps that wrong name. Only the arity is used for call binding, and that is now correct.How was this tested?
The issue's second snippet, with a call each way:
New tests in
tests/test_vbnet_extractor.py:340268a7(test commit only)ByVal Optional,ByRef Optional, the mixedF)Full suite, run on this branch and on 0.9.112
340268a7in the same venv:The 76 failures are the same tests on both trees. Most are CLI tests that shell out to
python -m graphify, which in my venv resolves to an editable install of a different checkout (error: unknown command 'section'). The other 6 passes on this branch are the new tests.Graphify-specific checklist
uv run python -m tools.skillgen --bless) when changing their source fragments. (N/A: no skill change.)