Rust: `const _` gets its file's node ID, so the file node is relabelled `_` and gains a self-loop
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
- #4108 của @xiehuanyi — đã đóng, không merge
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
Hướng nghiên cứu
Bắt đầu trong extractors/rust.py tại nhánh static_item / const_item, sau đó đọc _make_id, make_id, normalize_id và _file_node_id để theo dõi va chạm. Tái tạo với src/codec.rs được cung cấp và các điểm vào extract() và build_from_json(). Hoàn thành nghĩa là tệp giữ danh tính nút và nhãn riêng của nó, các hằng số ẩn danh không tạo ra va chạm nút tệp, và không có vòng lặp tự thân nào được tạo ra.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version: graphifyy 0.9.69
An anonymous Rust constant (const _: () = assert!(...);, the usual compile-time assertion) gets the same node ID as the file that declares it. When the graph is built, the constant's label and location replace the file node's, and the file's contains edge to the constant becomes a self-loop.
Repro, src/codec.rs:
use core::fmt;
pub const WIDTH: usize = 8;
const _: () = assert!(WIDTH == 1 << 3);
pub fn encode() {}
from pathlib import Path
from graphify.extract import extract
from graphify.build import build_from_json
r = extract([Path("src/codec.rs")], cache_root=Path("."))
G = build_from_json(r, root=".", directed=False)
extract() emits two nodes with the ID src_codec:
N src_codec 'codec.rs' L1
N src_codec '_' L5
E src_codec contains src_codec L5
After build_from_json, G.nodes["src_codec"] has label _ and source_location L5, and (src_codec, src_codec) is a self-loop.
Cause: extractors/rust.py (the static_item / const_item branch) builds the ID with _make_id(stem, item_name). make_id strips _ from each part, so the name _ becomes empty, the join gives src_codec_, and normalize_id strips the trailing underscore. The result is the bare stem, which is also what _file_node_id returns for the file.
Effect on a real project: the file node is shown as _. Every import and contains edge of the file is attached to it, so a module with a few imports ranks as a god node and a cross-community bridge in GRAPH_REPORT.md, and the graph health check reports a self-loop.
Possible fix: skip const _ / static _ in the Rust extractor, since an anonymous constant can't be referenced. Alternatively, have make_id refuse a part that strips to empty, so no symbol can collapse onto its file's ID.
- Ngôn ngữ chính
- Python
- Star
- 124k
- Fork
- 11.9k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
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 Graphify-Labs/graphify
-
hooks: last-resort `python3` probe launches the Microsoft Store redirector on Windows (visible console flash, exit 9009)Có thể đã có người làm @Deepjyoti-Sarmah đã nhận 7 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Graphify-Labs/graphify#4563 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
GRAPHIFY_DISABLE_THINKING is ignored by the claude backend, so thinking eats max_tokens and extraction truncatesCó thể đã có người làm @bercedev đã nhận 7 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
Graphify-Labs/graphify#4546 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
--update runbook: graph.json backup instruction comes after the diff that needs it, so the graph diff never runsCó thể đã có người làm @sunildivakar96-cpu đã nhận 8 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Graphify-Labs/graphify#4539 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] Pi skill uses unsupported general-purpose subagent instead of delegateCó thể làm lại được @bercedev đã nhận 10 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Graphify-Labs/graphify#4494 · 7 bình luận ·
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 86/100
Graphify-Labs/graphify#3763 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Graphify-Labs/graphify
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
sylvainmetayer/homelab#851 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Add `ty-pre-commit` hookĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/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 85/100
kubeflow/docs-agent#279 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
Qiskit/qiskit-ibm-runtime#3523 ·
Maintainer thường phản hồi trong vòng 1 ngày