[Bug]: changed-files rebuild (hook/watch) evicts placeholder nodes for files that were never scanned
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
- #4161 của @rohit-jsfreaky — đã đó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
- 85/100
Hướng nghiên cứu
Lỗi nằm ở logic quét tập ngữ liệu của hàm _reconcile_existing_graph; bắt đầu từ đó để sửa đổi kiểm tra loại bỏ cho các đường dẫn nguồn bị thiếu. Sử dụng manifest.json của lần quét trước (chỉ được ghi lại sau khi quá trình đối chiếu kết thúc) làm bằng chứng xóa: chỉ loại bỏ đường dẫn bị thiếu nếu nó có mặt trong manifest cuối cùng, nếu không giữ lại các nút giữ chỗ cho các tệp chưa từng được quét. Chạy script repro.py được cung cấp để xác nhận các nút giữ chỗ và các cạnh của chúng được giữ lại trong các lần tái tạo tệp đã thay đổi, khớp với đầu ra của tái tạo toàn bộ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Pre-flight checks
- I have checked the Troubleshooting section in the README
What happened?
An extractor can mint a node for a file that is not in the checkout: the target of an unresolved dynamic import (import('./queue.js')), or a project a .sln / .slnx / <ProjectReference> names. The node carries the missing path as its source_file, but it is the referring file's output (label ./queue.js, edges only from the referrer).
On a changed-files rebuild (_rebuild_code(changed_paths=...), used by the post-commit hook and graphify watch), the corpus sweep in _reconcile_existing_graph reads that missing path as a deleted source and evicts the node. The unchanged referrer's preserved edges to it then dangle and are dropped. A full rebuild of the same tree keeps both, so after every hook or watch rebuild the graph silently differs from a full rebuild, and it flips back on the next graphify update.
This goes against CONTRIBUTING ("Cross-file edges: must be preserved during incremental updates") and against the intent of #1795 ("require deletion evidence before evicting a missing source"): a path that was never scanned has no deletion evidence.
On graphify's own repo (975 files, v8 5c7b847), editing one unrelated file and running the changed-files rebuild loses 8 nodes and 15 edges compared with a full rebuild of the same tree: the placeholders for tests/fixtures/dynamic_import.ts's missing ./queue.js, ./mayaEngine.js, ./staticHelper, and the .csproj projects sample.sln, sample.slnx and sample.csproj reference.
Related to #3570 (same symptom class); the commenters there found that cause fixed by 32b209a, and this is a different mechanism that still reproduces on 0.9.77.
Steps to reproduce
cat > repro.py <<'EOF'
import json, tempfile
from pathlib import Path
from graphify.watch import _rebuild_code
def placeholder(c):
g = json.loads((c / "graphify-out/graph.json").read_text(encoding="utf-8"))
nodes = [n["id"] for n in g["nodes"] if n.get("source_file", "").endswith("queue.js")]
edges = [(e["source"], e["relation"]) for e in g["links"] if e["target"] in nodes]
return nodes, edges
if __name__ == "__main__":
c = Path(tempfile.mkdtemp()) / "corpus"; c.mkdir()
(c / "app.ts").write_text("export async function load() {\n return import('./queue.js');\n}\n")
(c / "other.ts").write_text("export function other() {\n return 1;\n}\n")
_rebuild_code(c, no_cluster=True, acquire_lock=False, force=True)
print("full rebuild: ", placeholder(c))
(c / "other.ts").write_text("export function other() {\n return 2;\n}\n")
_rebuild_code(c, changed_paths=[Path("other.ts")], no_cluster=True, acquire_lock=False, force=True)
print("changed-files (other.ts): ", placeholder(c))
_rebuild_code(c, no_cluster=True, acquire_lock=False, force=True)
print("full rebuild, same tree: ", placeholder(c))
EOF
PYTHONHASHSEED=0 python repro.py
Error output or graph output
full rebuild: (['queue'], [('app_load', 'imports_from'), ('app', 'dynamic_import')])
changed-files (other.ts): ([], [])
full rebuild, same tree: (['queue'], [('app_load', 'imports_from'), ('app', 'dynamic_import')])
On graphify's own repo, after a one-file edit: changed-files rebuild 18,617 nodes / 37,920 edges vs full rebuild of the same tree 18,625 / 37,935.
Graphify version
0.9.77 (5c7b847)
Operating System
Windows
Python Version
3.12
Installation Method
built from source (git clone)
Additional Environment Details
AST-only, no provider environment variables, PYTHONHASHSEED=0. A clean checkout of v8 at 5c7b847 reproduces it. Found while comparing changed-files and full rebuilds of graphify's own repo.
Additional context
Fix ready: use the previous scan (manifest.json, rewritten only after reconcile) as the deletion evidence. A missing path that was in the last scan is evicted as before; one that was never scanned is kept while a referrer that is not re-extracted this run still points at it. No manifest: old behaviour. PR right after this.
- Ngôn ngữ chính
- Python
- Star
- 124k
- Fork
- 11.9k
- Merge trung bình
- 1 giờ 26 phút
- Pull request đã merge (30 ngày)
- 2
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
-
watch liveness check resolves relative source identities against process CWD instead of watch rootĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Graphify-Labs/graphify#4896 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Cache the claude backend system prompt via Anthropic prompt cachingCó thể đã có người làm @Jvxoq đã nhận 2 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#4835 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
extract --out <dir>: semantic cache never saved, docs missing from manifest (relative source_file resolved against --out)Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Graphify-Labs/graphify#4831 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add guidance to SKILL.md on when building a graph is (and isn't) worth itCó thể đã có người làm @Johanl001 đã nhận hôm nay. Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 75/100
Graphify-Labs/graphify#4829 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
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 12 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
Tất cả issue của Graphify-Labs/graphify
Issue tương tự
-
[Bug]: Responses API 500s on assistant message with empty content listCó thể đã có người làm @shadowmodder đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
vllm-project/vllm#64940 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
limits
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Keybind quest outdatedĐang mởStatus: Triage Type: Quest
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
GTNewHorizons/GT-New-Horizons-Modpack#27490 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
LLM.save() discards the model's active prompt styleCó thể đã có người làm @remote-controlled-man đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Lightning-AI/litgpt#2378 ·
Maintainer thường phản hồi trong vòng 23 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày