Python constructor calls do not reach the initializer they run
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
- 35/100
Hướng nghiên cứu
Start with the Python call-graph construction and change-impact traversal, then inspect PR #4208, which describes the proposed constructor-entry edge and its scope. Reproduce the supplied fixture with graphify update and graphify affected; compare the graph before and after, including incremental output against a clean rebuild. Done means constructor calls reach the inferred initializer and callers while preserving all existing nodes and edges and respecting the documented static-analysis limitations.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Python constructor calls stop at the class node, hiding the initializer's dependencies from change-impact traversal.
Reproduction on current v8
Verified on v0.9.80, commit 6478eb7, with Python 3.13 on Linux. Build these files with graphify update <fixture> --no-cluster:
# pkg/storage.py
def open_db(path):
return path
class Store:
def __init__(self, path):
self.db = open_db(path)
# pkg/cache.py
from pkg.storage import Store
class CachedStore(Store):
pass
# pkg/service.py
from pkg.cache import CachedStore
def build(path):
return CachedStore(path)
# tests/test_service.py
from pkg.service import build
def test_build():
build("test.db")
graphify affected "open_db()" --depth 4 --graph <fixture>/graphify-out/graph.json finds Store.__init__ but misses build() and test_build(). The call graph has build -> CachedStore and Store.__init__ -> open_db, with no call edge joining them.
Constructor fix
PR #4208 adds an inferred constructor-entry edge when a supported source binding and class chain identify the initializer. It preserves the class edge and every other existing node and edge. The fixture then reaches the initializer, build(), its importing test file, and test_build(). Incremental output after editing the caller matches a clean rebuild.
Fresh comparisons against 6478eb7 add 703 constructor edges across seven pinned repositories: Flask 3, requests 3, httpx 56, rich 506, langchain-core 100, yt-dlp 17 and FastAPI 18. All 703 agree with an independent Python ast derivation. All 586 that SCIP can judge agree on the called class, inheritance chain and initializer. Every pre-existing node and edge remains identical.
This is a restricted static subset. Decorators, metaclasses, custom allocation, multiple inheritance, ambiguous bindings, external bases and known mutation patterns add no edge. Cross-module dynamic mutation remains a documented limitation.
Why it matters for test impact
A separate runtime-trace study measured Flask and yt-dlp tests against pinned source revisions. Historical v8 graphs reached only 4 of 3,482 sampled Flask test/function pairs and 20 of 606 yt-dlp pairs. A broader prototype combining receiver typing, constructor entry and pytest fixture dependencies reached 1,699 and 358 respectively. Those are historical prototype results, not the results of this constructor PR or current v0.9.80.
Constructor entry is one missing link in that chain. Since the study, upstream has added self.attr.method() support in #4176 and annotated/constructor-bound local receiver support in #4198. Those changes are already present in the base used to verify this PR. Remaining opportunities include inherited methods, factory return types and pytest fixture dependency edges through the nearest conftest.py chain.
Related: #2041, #2860, #2417, #2586 and #1499.
- Ngôn ngữ chính
- Python
- Star
- 124k
- Fork
- 11.9k
- Merge trung bình
- 2 giờ 35 phút
- Pull request đã merge (30 ngày)
- 6
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
-
`file_hash` opens the lowercased path on Windows, so files with uppercase names fail on case-sensitive dirs (`\wsl.localhost`)Có thể đã có người làm @Deepjyoti-Sarmah đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Graphify-Labs/graphify#4925 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
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 · 5 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
-
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 14 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 15 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
Tất cả issue của Graphify-Labs/graphify
Issue tương tự
-
Import errors are swallowed: PerthImplicitWatermarker silently becomes NoneCó thể đã có người làm @JonRC đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
resemble-ai/Perth#23 ·
-
correction metadata
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 65/100
acl-org/acl-anthology#10753 · 1 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 62/100
earthtojake/text-to-cad#758 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 70/100
DataTalksClub/faq#545 ·
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 62/100
Maintainer thường phản hồi trong vòng 1 ngày