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

Đang mở
#3,090 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
devtools

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
C
Star
45.8k
Fork
3.8k
Merge trung bình
2 ngày 18 giờ
Pull request đã merge (30 ngày)
108

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của DeusData/codebase-memory-mcp

Tất cả issue của DeusData/codebase-memory-mcp

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.