Skip to content

Member-call resolvers consume each other's raw calls: untagged languages leak (TS receiver mints a Python edge) #10

Closed

Description

@filipechagas

Parent

Spec: #1 (upstream: Graphify-Labs#1682). Found in independent code review of feat/php-member-calls-1682; sibling of #8.

Problem

#6 added a language-tag skip to the Swift, Python and TypeScript member-call resolvers:

# graphify/extract.py:2321 (swift), :2487 (python), :2576 (typescript)
if rc.get("lang"):
    continue

The comment above each site reads "Swift raw_calls carry no lang, so anything tagged is another language's data and must not mint a Swift edge here (Graphify-Labs#1682)."

The guard only excludes tagged languages (java, php, objc). The three guarded resolvers are themselves untagged, so they still consume each other's raw calls — a TypeScript raw call flows straight into the Python resolver's capitalized-receiver class arm. The guard cannot close this by construction.

This is a different shape from what #6's closing comment recorded. #6 honestly recorded that its own premised leak path (PHP receivers reaching the other resolvers) was unreachable, and that the reachable leak lived in the PHP/ObjC unscoped type index, fixed as #8. The untagged-to-untagged leak documented here is recorded nowhere.

Repro (verified through the extract() seam)

runner.ts:

class Runner {
  go() { return Lead.search({}); }
}

svc.py:

class Lead:
    def search(self, filters):
        return []

No TypeScript Lead exists anywhere in the corpus. Result — a cross-language edge at the strongest confidence label:

runner.ts:.go() -> svc.py:.search()   [EXTRACTED]

Attributed by removing registry entries from graphify.resolver_registry._REGISTRY, the method #8 used:

baseline                     : ['runner.ts:.go() -> svc.py:.search()']
w/o python_member_calls      : []
w/o typescript_member_calls  : ['runner.ts:.go() -> svc.py:.search()']
w/o swift_member_calls       : ['runner.ts:.go() -> svc.py:.search()']
w/o php_member_calls         : ['runner.ts:.go() -> svc.py:.search()']
w/o objc_member_calls        : ['runner.ts:.go() -> svc.py:.search()']
w/o java_member_calls        : ['runner.ts:.go() -> svc.py:.search()']
w/o csharp_member_calls      : ['runner.ts:.go() -> svc.py:.search()']

The edge is minted by python_member_calls consuming a TypeScript raw call. Dropping the TypeScript resolver changes nothing, confirming the raw call is TS-authored and the Python resolver is the miner.

Pre-existing, not a regression — this predates the Graphify-Labs#1682 work. It is filed because it sits squarely inside the surface #6 set out to harden, and because the in-code comments now assert a protection that does not hold.

What to build

Replace the negative tag check with a positive suffix filter — the prior art the spec already names, at graphify/resolvers/ruby_resolution.py:47-48:

sf.endswith((".rb", ".rake"))

A resolver should consume only raw calls whose source file it owns, rather than excluding a hardcoded list of other languages. Note the .h dual-routing caveat documented at extract.py:3264-3266 if the fix is generalized.

Related: the same unscoped-index shape elsewhere

#8's closing comment records the definition-index half of this family as knowingly deferred:

Known same-shape exposure in Java/C#/C++/Swift/TS resolvers left untouched — pre-existing, candidate follow-up.

Independently confirmed during review: Java and C# still build an unscoped type_def_nids (extract.py:2979), so a Java Lead lead; lead.search() binds to a Python class Lead at INFERRED. Worth fixing in the same pass, since #8 already established the pattern and the sole remaining unfixed copies are the ones a future resolver would clone.

Acceptance criteria

  • Mixed-corpus extract() test: a TS capitalized receiver with a matching class only in a .py file yields no edge
  • Equivalent coverage for the Swift and Python resolvers against each other's corpora
  • Java and C# receiver type indexes language-scoped, matching Language-scope the receiver type index in the PHP and ObjC member-call resolvers #8's PHP/ObjC fix
  • .h dual-routing behaviour unchanged; C++ and ObjC suites pass
  • Swift, Python, TypeScript, Ruby, Java, C# member-call suites pass unchanged
  • Full suite green (baseline on feat/php-member-calls-1682: 3988 passed / 36 skipped)

Blocked by

None.

Activity

  1. added
    bug
    ready-for-agent
    on Aug 5, 2026
  2. filipechagas commented on Aug 5, 2026

    @filipechagas
    CollaboratorAuthor

    Fixed in fbda3ec on fix/member-call-lang-scoping-10 (merged with v8 at e147764; not pushed). Orchestrator gate: full suite 4049 passed / 36 skipped on the merged tree — 4041 from v8 head 2a9f9fe plus the 8 tests added here. Pre-merge it was 4032/36 against the 4024 baseline at 102ae79. ruff check clean.

    Raw-call ownership. The if rc.get("lang"): continue skips at the three sites named in this issue are replaced with a positive source-file suffix filter (_raw_call_is_owned), the ruby_resolution form the spec pointed at. The misleading comments at all three sites are rewritten to describe what the guard actually did. The tagged languages keep matching on lang, because C++ and ObjC share .h and a suffix cannot separate their raw calls — the .h caveat this issue flagged applies to raw-call claiming only, not to the definition indexes. Suffix tuples are now shared by resolver registration and filtering so the two cannot drift, extending the pattern #8 introduced.

    Java and C# type indexes are language-scoped, matching #8's PHP/ObjC fix. Both are the plain suffix test; C# needed no other change because CsharpNameResolver already resolves the simple name decisively before the corpus-wide fallback index is consulted.

    Tests: 8 new mixed-corpus cases through the extract() seam, 7 of them red before the fix. Recorded red run: 7 failed, 7 passed. Green after: 14 passed.

    One thing worth recording, because it shapes how these tests had to be written. The naive form — "a Swift receiver must mint no edge into a Python class" — cannot pass while the Swift/Python/TS definition indexes stay unscoped, since the Swift resolver's own index would still mint it. Each test is therefore built so exactly one resolver can be the miner: the resolver that legitimately owns the raw call refuses it on its own terms (the Python class has no missing method; Swift refuses Bundle as a builtin global), so any surviving edge is unambiguously a foreign resolver reaching across. Two corpora also carry a typed-receiver file whose only job is to keep a resolver awake — see below.

    Two findings later tickets need.

    1. The attribution table in this issue reads as though the TypeScript resolver refuses the leaked raw call on its merits. It does not: the Swift and TypeScript resolvers return early whenever no file in the corpus produced a swift_type_table / ts_type_table (extract.py:2311 and :2576 post-fix). In the repro corpus the TS resolver was simply dormant. A test corpus without a live typed-receiver file passes for the wrong reason.
    2. The Python member-call resolver has no _LANGUAGE_BUILTIN_GLOBALS guard, unlike Swift (extract.py:2374) and TypeScript (:2626). Since this fix it only sees .py raw calls, so the cross-language exposure is closed, but a Python class Date / class Bundle can still be bound from a Python Date.x() call — the false-edge class TS/JS new/type references to builtin globals (e.g. Date) collapse onto same-named user symbols → false god node Graphify-Labs/graphify#1726/Swift/Foundation/SwiftUI builtins missing from _LANGUAGE_BUILTIN_GLOBALS and _BUILTIN_NOISE_LABELS (false god-nodes, phantom bridges) Graphify-Labs/graphify#2147 fixed for the other two. Recorded in Swift, Python, TypeScript and C++ member-call resolvers still build unscoped receiver-type indexes #24; deserves its own ticket.

    Scope note. The acceptance criteria named Java and C# only, so the remaining unscoped definition indexes are untouched: Swift (extract.py:2325), Python class_def_nids (:2436), TypeScript (:2584), C++ (:2697). All four leak both ways and are filed as #24 with per-resolver repros and controls verified through the seam — including the half #8 called the damaging one, where a foreign namesake deletes a legitimate same-language edge. Note that #24's C++ index must include .h, since a C++ class is routinely declared in a header.

    Changelog entry added under 0.9.34, naming both effects and the deletion/addition scope in the style of the #8 bullet. The merge with v8 emptied the "Known open items" bullet — v8's side had dropped the #9 and #15 clauses, this branch dropped the #10 clause — so the bullet is deleted rather than resolved.

    Left open for the orchestrator to verify and close; nothing pushed.

  3. added a commit that references this issue on Aug 5, 2026
  4. filipechagas commented on Aug 5, 2026

    @filipechagas
    CollaboratorAuthor

    Closed by PR #28 (merge commit ee3a411). Orchestrator gate evidence: independent full-suite runs reproduced 4032/36 at branch head (pre-merge baseline 4024/36 + 8 new tests) and 4049/36 on the merged tree (post-#9/#15 baseline 4041/36 + 8). Red state recorded: 7 failures against unfixed code including the exact TS-to-Python repro from this issue. The auto-merge with v8 was verified byte-for-byte against both parents by the implementer. Follow-up for the remaining unscoped indexes (Swift/Python/TS/C++): #24. v8 baseline is now 4049/36.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions