Dart: field access is bound to a same-named method of an unrelated class, fabricating CALLS edges (name-only fallback; cf. #1355, #2605, #2892)
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
- 42/100
Hướng nghiên cứu
Start by reproducing with the minimal lib/field_vs_method.dart file from the issue after a clean index, then run the CALLS query on _send. Check that Holder.attach and Holder.detach produce fabricated edges to Api._send, while only go should remain. Related issues #1355, #2605, #2892 and #2121 describe the same name-only fallback, so read them first. Done when the query returns only go and get_code_snippet reports the same caller set.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
For Dart, reading or null-calling a field whose name happens to match a method of another class produces a CALLS edge to that method. The graph gains calls that do not exist in the code: a private field _send of one class is bound to Api._send, a method of an unrelated class in the same file.
This is the Dart face of the name-only fallback binding already tracked for other languages — #1355 (general), #2605 (Rust, field receiver), #2892 (C#), #2121 (phantom callers) — and the same shape #2977 refused for member calls. Dart is still affected on 0.12.1.
Minimal repro (0.12.1, clean index, 22 Nov 2026)
lib/field_vs_method.dart:
class Api {
Future<void> _send(String path) async {
print(path);
}
Future<void> go() => _send('/real'); // the only real call
}
class Listener {
Listener({this.onTick});
final void Function()? onTick;
void fire() { onTick?.call(); }
}
class Holder {
Holder({this._send});
final Listener? _send; // a FIELD, not a method
void attach() { _send?.fire(); } // reads the field; calls Listener.fire
void detach() { _send?.fire(); }
}
Query:
MATCH (c)-[:CALLS]->(f) WHERE f.name = '_send'
RETURN c.name AS caller, c.file AS caller_file, c.start_line AS caller_line
Actual — 3 rows:
| caller | file | line |
|---|---|---|
go |
lib/field_vs_method.dart | 6 |
attach |
lib/field_vs_method.dart | 24 |
detach |
lib/field_vs_method.dart | 28 |
Expected — 1 row (go). Holder.attach / Holder.detach never call Api._send; they read Holder._send, a Listener? field, and call Listener.fire.
get_code_snippet(qualified_name = "Api._send", include_neighbors = true) agrees with the bad edges: callers: 3, caller_names: attach, detach, go.
Same thing on a real Flutter app
In a ~5 kLoC Flutter project (ApiClient._send in lib/api/api_client.dart), the graph reports 7 callers of ApiClient._send where the code has 4. The three extras are:
lib/ui/orders/status_controller.dart—final SendController? _send;field, used as_send?.addListener(...),_send!.sending,_send?.removeListener(...);lib/ui/settings/settings_screen.dart— the widget's own private methodFuture<void> _send() async { ... }, a different symbol entirely.
Interestingly, on that project the two sides of the server disagree: get_code_snippet reports callers: 4 (correct) while query_graph over CALLS returns 7 rows. On the minimal repro both report the inflated number, so the real-project discrepancy looks like a second, separate inconsistency between the snippet's caller count and the graph edges.
Why it matters
Impact analysis and trace_path on Dart read as if a widget's own _send and a controller's _send field flowed into the HTTP layer. Removing or changing ApiClient._send appears to affect unrelated UI code, and the inverse — a real caller hidden among fabricated ones — is not distinguishable by the consumer.
Environment
- codebase-memory-mcp 0.12.1
- Dart 3.14.0 / Flutter project and the standalone repro above
- Windows Server 2019, clean (
mode: clean) index
- 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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của DeusData/codebase-memory-mcp
-
bug ux/behavior
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
DeusData/codebase-memory-mcp#3191 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation enhancement parsing/quality ux/behavior
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 82/100
DeusData/codebase-memory-mcp#3131 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
hook-augment: the five-row cap keeps the first five search_graph rows, so variables and modules displace function definitions (v0.12.1)Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug editor/integration parsing/quality ux/behavior
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
DeusData/codebase-memory-mcp#3062 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Generated client files (AGENTS.md block, SKILL.md) teach a call syntax no harness can executeĐang mởbug documentation editor/integration parsing/quality
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
DeusData/codebase-memory-mcp#3050 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
editor/integration parsing/quality
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
DeusData/codebase-memory-mcp#2286 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của DeusData/codebase-memory-mcp
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
NVIDIA/open-gpu-kernel-modules#1635 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
iOS: the "Edit controls" button never hides, even with a controller connected, and covers the gameĐang mởgame: 010065A014024000 ios
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
seedds/nxnative#3714 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày