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

Aberta
#3,090 1 comentário 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
48/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
typescript
Domínio
devtools

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
C
Estrelas
45.8k
Forks
3.8k
Merge médio
2d 18h
PRs com merge (30d)
108

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de DeusData/codebase-memory-mcp

Todas as issues de DeusData/codebase-memory-mcp

Issues semelhantes

Mais issues de C

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.