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

Aperta
#3,090 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
devtools

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
C
Stelle
45.8k
Fork
3.8k
Merge medio
2g 18h
PR unite (30g)
108

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di DeusData/codebase-memory-mcp

Tutte le issue di DeusData/codebase-memory-mcp

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.