Rust: `const _` gets its file's node ID, so the file node is relabelled `_` and gains a self-loop
维护者通常 1 天内回复
还没有人认领这个 Issue。
- #4108 来自 @xiehuanyi —— 已关闭,未合并
评估
调研方向
从 extractors/rust.py 的 static_item / const_item 分支开始,然后阅读 _make_id、make_id、normalize_id 和 _file_node_id 来追踪冲突。使用提供的 src/codec.rs 以及 extract() 和 build_from_json() 入口点进行复现。完成意味着文件保持自己的节点身份和标签,匿名常量不会造成文件节点冲突,并且不会产生自循环。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Python
- 星标
- 124k
- 派生
- 11.9k
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Graphify-Labs/graphify 的其他 Issue
-
Cache the claude backend system prompt via Anthropic prompt caching可能已有人在做 @Jvxoq 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
Graphify-Labs/graphify#4835 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
Graphify-Labs/graphify#4831 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 75/100
Graphify-Labs/graphify#4829 · 1 条评论 ·
维护者通常 1 天内回复
-
hooks: last-resort `python3` probe launches the Microsoft Store redirector on Windows (visible console flash, exit 9009)可能已有人在做 @Deepjyoti-Sarmah 于 9 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
Graphify-Labs/graphify#4563 · 2 条评论 ·
维护者通常 1 天内回复
-
GRAPHIFY_DISABLE_THINKING is ignored by the claude backend, so thinking eats max_tokens and extraction truncates可能已有人在做 @bercedev 于 10 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 69/100
Graphify-Labs/graphify#4546 · 1 条评论 ·
维护者通常 1 天内回复
查看 Graphify-Labs/graphify 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
microsoft/agent-lightning#661 ·
维护者通常 2 天内回复
-
area/profiles comp/cli P3 type/feature
难度 2/5 1-3 小时 新手友好度 74/100
NousResearch/hermes-agent#146372 ·
维护者通常 1 天内回复
-
[BUG] OpenAI-compatible embedding model alias breaks embedder construction可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
[oblt-aw][autodoc] Document obs-aw-automerge contract and fix automerge doc inconsistencies可能已有人在做 @github-actions 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
GeoSeries scale and skew tests fail with pytest 9.2.0可能已有人在做 @jiayuasu 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复