Repository navigation
Resolve Kotlin object/class qualified member calls across files - #3598
ayushcodes10 wants to merge 6 commits into
Conversation
Toward issue 1698: a call like MessageHelper.isRoomClosed() has exactly two navigation segments, so the existing fully qualified prefix capture (which only fires at three or more segments) never sees it, and the code deliberately never stamps member_receiver for this shape either, since that would defer the in file bare name lookup that already resolves the same file case correctly. This adds the new variable with no behavior change yet; capturing into it and threading it through to raw_calls lands in the next commits. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Still toward issue 1698, still no behavior change: the variable is computed but nothing reads it yet. A capitalized two segment receiver (MessageHelper in MessageHelper.isRoomClosed()) names an object singleton or a class or companion member, statically unambiguous in source. Captured separately from member_receiver so the existing in file bare name lookup and its capitalized receiver deferral guard are untouched; threading this into raw_calls for a dedicated cross file resolver lands next. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Still toward issue 1698. Still no observable behavior change on its own: nothing reads the new kotlin_object_receiver field yet, so existing edges are unaffected. The resolver that consumes it lands in the next commit. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Fixes issue 1698. Mirrors _resolve_kotlin_qualified_calls just above it and the same type_by_name plus methods_by_type shape _resolve_swift_member_calls uses for its own type qualified case: index every Kotlin sourced class or object by its bare name, resolve the receiver against that index, then look up the callee among that type's methods. Both steps bail on anything but exactly one candidate, the same god node guard every cross file resolver in this module already uses. Verified end to end: the issue's own cross file repro now produces an EXTRACTED calls edge, the same file control case is unaffected, and two objects sharing the same name in different packages correctly produce zero edges instead of an ambiguous guess. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Covers three cases: the new cross file resolution (Config.load() called from another file resolves to object Config), a same file control to prove the existing in file resolution is unaffected, and an ambiguous receiver defined in two packages that must yield no edge under the exactly one candidate guard. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Co-Authored-By: Claude Sonnet 5 <[email protected]>
There was a problem hiding this comment.
Graphify reviewed this change.
Worth a look — the grounded gate found no coupling regressions or blocking issues, but 1 advisory finding(s) below merit a look before merge.
Formal verification. No changes could be formally verified in this run.
Graphify review — findings
Resolves Kotlin Receiver.method() calls (object singletons and class/companion members) across files via the new _resolve_kotlin_member_calls pass, which matches the capitalized receiver to its declaring Kotlin type and the callee to a single method on that type, emitting an EXTRACTED calls edge. A receiver name matching 2+ declared types, or a method matching 2+ methods on the resolved type, produces no edge rather than a guess, and the pass only fires when the engine's in-file bare-name lookup already failed. Adds kotlin_object_receiver capture in _extract_generic (two-segment nav with a capitalized head) to tag those calls in raw_calls for the new resolver to claim.
Worth a look
- Method label strip('()') mismatch when method has parameters in label —
graphify/extract.py:4770· Escalate · medium- agreed by 2 of 2 members but NOT verified (no proof, no reproducing execution) — consensus is not a verdict; needs human review
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 2472 functions depend on the 703 functions this change touches.
Health — this change adds coupling hotspots:
- new:
extract()— 637 callers, 45 callees - new:
_rebuild_code()— 123 callers, 53 callees - new:
_extract_generic()— 18 callers, 29 callees - new:
extract_js()— 85 callers, 4 callees - new:
extract_xaml()— 19 callers, 17 callees - new:
dispatch_command()— 2 callers, 125 callees - new:
extract_objc()— 27 callers, 9 callees - new:
_get_extractor()— 26 callers, 6 callees - …and 40 more — each is listed as a finding
Verification — 2472 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: 2297 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
283 of 283 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/test_affected_cli.py— full-run-safetytests/test_affected_member_seed.py— full-run-safetytests/test_agents_platform.py— full-run-safetytests/test_analyze.py— 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— full-run-safetytests/test_atomic_version_stamp.py— full-run-safetytests/test_atomic_writes.py— full-run-safetytests/test_backend_env_isolation.py— full-run-safetytests/test_backend_extras.py— full-run-safetytests/test_benchmark.py— full-run-safetytests/test_benchmark_raw_graph.py— full-run-safetytests/test_build.py— impact, full-run-safetytests/test_build_merge_dedup_scope.py— full-run-safetytests/test_build_merge_hyperedges_and_prune.py— full-run-safetytests/test_build_merge_shrink_guard.py— full-run-safetytests/test_builtin_global_type_refs.py— impact, full-run-safetytests/test_cache.py— full-run-safetytests/test_callflow_html.py— full-run-safetytests/test_cargo_introspect.py— full-run-safetytests/test_carried_hyperedge_remap.py— full-run-safetytests/test_case_sensitive_resolution.py— impact, full-run-safetytests/test_charmap_encoding.py— full-run-safetytests/test_chunking.py— full-run-safetytests/test_cjs_module_extension.py— impact, full-run-safetytests/test_claude_cli_backend.py— full-run-safetytests/test_claude_md.py— full-run-safetytests/test_cli_broken_pipe.py— full-run-safetytests/test_cli_export.py— full-run-safetytests/test_cli_help.py— full-run-safetytests/test_cluster.py— full-run-safetytests/test_codebuddy.py— full-run-safetytests/test_community_hub_labels.py— full-run-safetytests/test_community_labels_skill.py— full-run-safetytests/test_confidence.py— full-run-safetytests/test_corrupt_graph_json.py— full-run-safetytests/test_cpp_nested_and_cli.py— impact, full-run-safetytests/test_cpp_objc_cross_file_calls.py— impact, full-run-safetytests/test_cpp_preprocess.py— full-run-safetytests/test_cross_extension_reexport_self_cycle.py— impact, full-run-safetytests/test_cross_language_call_resolution.py— impact, full-run-safetytests/test_cross_repo_external_call_guards.py— impact, full-run-safetytests/test_cross_repo_member_calls.py— impact, full-run-safetytests/test_cross_repo_shared_types.py— full-run-safetytests/test_csharp_call_site_generic_args.py— impact, full-run-safety- … and 233 more
non-code file(s) changed (
CHANGELOG.md) → running the full suite for safety (a code graph can't see config/fixture/data deps)
changed code file(s) with no mapped test (
CHANGELOG.md) — 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.
Formal verification
Could not verify: Could not verify \_extract\_generic.
The verifier did not have enough to check \_extract\_generic, 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: parameter `path` is annotated `Path` — outside the synthesizable primitive/collection set
· 48 more finding(s) on lines outside this diff (see the check run).
|
Re: "Method label strip('()') mismatch when method has parameters in label" ( Checked this directly: every callable node label in the codebase, across all languages including Kotlin, is built from a hardcoded So |
…follow-up) #3598 resolves Kotlin object/class-qualified member calls across files. Adds two regression tests the PR omitted: - a `companion object` member call (`Service.create()`), pinning the #2565 enclosing-class attribution the resolver relies on; - an incremental-rebuild test routed through the real watch._rebuild_code, so it actually exercises the context builder's allow-list carrying _callable_class + method edges (a hand-fed resolution_context_nodes list would bypass exactly the path that silently regressed in sibling PRs). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Shipped in v0.9.64 (on PyPI). Cherry-picked with authorship preserved so it shows under your GitHub contributions. Thanks @ayushcodes10! (Added companion-object + real-incremental regression tests on merge.) |
Summary
Fixes #1698.
A Kotlin call on an object or class qualified receiver (
Config.load()) only resolved when the receiver's declaration lived in the same file. The gap sits at the intersection of three existing pieces of behavior:extract.pyunconditionally skips every member call, by design (a bare method name colliding across the whole corpus would inflate god nodes, per Cross-file INFERREDcallsresolution lacks import evidence + ambiguous-candidate handling — short common names blow up god_nodes ranking #543/Cross-filecallsresolution drops EXTRACTED edges when the callee name has multiple definitions (even with unambiguous import evidence) #1219). Member calls can only ever resolve cross file through a dedicated per language resolver.object.method()navigation shape, specifically so it would not get deferred toward cross file resolution when no such resolver existed yet (deferring it with nothing to catch the deferred call would have broken the working same file case).Changes
raw_calls._resolve_kotlin_member_calls, mirroring the existing_resolve_kotlin_qualified_callsand thetype_by_name/methods_by_typeshape_resolve_swift_member_callsalready uses: index Kotlin sourced classes and objects by bare name, resolve the receiver against that index, then look up the callee among that type's methods. Both steps bail on anything but exactly one candidate, the same god node guard every cross file resolver in this module already applies..kt/.ktsfiles.Test plan
tests/test_kotlin_grammar.py:EXTRACTEDcallsedgepython3 -m tools.skillgen --check: OK.🤖 Generated with Claude Code