TypeScript: calls through interface members (incl. prototype-installed mixins) produce no CALLS edge to the implementation

Offen
#3,090 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
48/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
typescript
Bereich
devtools

Rechercherichtung

Start by tracing the TypeScript LSP hybrid call resolution path for the lsp_ts_method strategy and how it handles interface member targets that are not graph nodes. Then inspect the graph relationships and module-level calls described in the issue to see how implementations and prototype-installed mixins can be found. Done means interface calls produce edges to implementation candidates, or at minimum retain a CALL_REFERENCE when unresolved; the issue names no test file, so locate the relevant resolver tests.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug enhancement parsing/quality

Bug/feature: TypeScript calls through interface members are not attributed to implementations

Version: codebase-memory-mcp v0.12.1 (linux-amd64-portable), TypeScript project, LSP hybrid resolution
(strategy: lsp_ts_method on edges). Related: #2893 (C#: calls through interfaces / virtual members not
attributed to implementers), #2789 (TypeScript call resolution fixes).

What happens

A method call on a parameter typed with an interface produces no CALLS edge at all. The LSP resolves the
call to the interface member signature, which is not a node, so the edge is dropped silently. trace_path
outbound of the caller therefore misses the real implementation.

Minimal example

// contract.ts
export interface RegistryOperations {
  replaceCredential(providerId: string, raw: unknown): Promise<Snapshot>
}

// operations.ts
export const credentialOperations = {
  replaceCredential(this: Registry, providerId: string, raw: unknown): Promise<Snapshot> { /* ... */ },
}

// registry.ts
import { credentialOperations } from './operations'
export class Registry { /* state */ }
export interface Registry extends RegistryOperations {}
installOperations(Registry.prototype, credentialOperations)   // Object.assign-style mixin

// handler.ts
export async function replaceModelCredential(registry: Registry | undefined, providerId: string, req: Request) {
  const input = await req.json()
  return registry!.replaceCredential(providerId, input)    // <- no CALLS edge
}

Observed:

  • trace_path(function_name="…replaceModelCredential", direction="outbound") lists req.json style callees but
    not replaceCredential.
  • MATCH (f)-[r]->(g) WHERE f.name='replaceModelCredential' RETURN type(r), g.name → only USAGE Registry
    (the type), no call edge; no CALL_REFERENCE either.
  • The implementation exists as a Function node (operations.replaceCredential), the class has an
    IMPLEMENTS edge to RegistryOperations, and the module-level call installOperations(Registry.prototype, …)
    is captured as a Module → CALLS edge with its arguments.

Expected

When the LSP target is an interface member, resolve to the implementations: classes with IMPLEMENTS (or
declaration-merged classes of the same name) that define the method; if none, members installed on the
prototype by module-level Object.assign(X.prototype, obj) / mixin helpers (object-literal members of obj).
Several implementations → several edges with a lower confidence (or a candidates count), as the resolver
already does for other ambiguous strategies. At minimum, an unresolved call should leave a CALL_REFERENCE with
the member name so that consumers can resolve it themselves.

Vorherrschende Sprache
C
Sterne
45.8k
Forks
3.8k
Ø Merge
2 T. 18 Std.
Gemergte PRs (30 T.)
108

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus DeusData/codebase-memory-mcp

Alle Issues in DeusData/codebase-memory-mcp

Ähnliche Issues

Weitere Issues zu C

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.