code.impact and code.test_gate answer exact for a seed file the compiler tier has not seen since it changed
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ó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 70/100
Hướng nghiên cứu
Read the code.impact and code.test_gate handlers and compare their staleness checks with code.callers and code.callees, especially the referenced coverage.py, graph.py, impact.py, and gate.py paths. Start with the reproduction and the existing test helpers in tests/unit/test_code_epistemic_envelope.py and tests/unit/test_code_test_gate.py. Add a test for each handler using a compiler covered seed path returned by scip_stale_paths; done means both report the stale file cause and the expected lower confidence.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
TL;DR: code.callers and code.callees mark an answer stale when the seed's own file was rewritten by the fast tier after the compiler tier last ran, but code.impact and code.test_gate never compare their seed paths with the fast tier's rows. For such a seed code.impact returns exact with no cause, from compiler-tier edges that describe the file's older text. The fix is to call the same seed-path check from both handlers.
Company
Independent
Component
Code index
Describe the situation
The compiler tier's edges describe the text of a file as of its last run. The fast tier rewrites a file's row when the bytes change, so a code_files row newer than the compiler tier's watermark is content the compiler tier has not seen. scip_stale_paths names such a path (server/code/store/index/symbols.py:554-591 on #1704's head 226a92c4a638f6f0a985950d33bdeafd6e5163b1), and the envelope turns it into the cause scip_stale_files and lower_bound.
On #1704's head:
code.callersandcode.calleespass the seed paths to that check:_scip_stale(repo, org, ns, edges_out, seed_paths)(server/code/app/symbol/coverage.py:80-96, called from_floor_readsatserver/code/app/symbol/graph.py:393). A seed whose file the fast tier rewrote is stale even when no served edge comes from that file.code.impactandcode.test_gateread only the namespace's stale marks (_coverage_and_marks,impact.py:282andgate.py:89) and setscip_stale=bool(marked)(impact.py:328,gate.py:107). Neither callsscip_stale_paths, so a seed file edited since the compiler run never yields the cause.
On upstream/main at 82dc31216fd252db028fa57eca570fe87258e64a, the same two handlers read no staleness at all (impact.py:282 and gate.py:89 call _scip_coverage only), and code.callers and code.callees compare the served edges' paths but not the seed's (coverage.py:79-87, graph.py:390). So the gap is older than #1704; #1704 adds the seed paths to callers and callees and the marks to the other two, and leaves impact and test gate without the seed-path check.
The case: a function DB::A::insert in src/A.cpp, compiler-covered; the fast tier then rewrites src/A.cpp. code.callers and code.callees return lower_bound with scip_stale_files. code.impact, by name or by files=["src/A.cpp"], returns exact with no cause. code.test_gate for a diff in the same kind of file returns measured with no scip_stale_files cause. The impact radius and the test links come from edges the compiler tier wrote for the file's older text: a call the edit added, or a caller added in the same file, is not in them.
I checked this with the unit-test fakes, not a live ClickHouse.
Does it reproduce on the latest release or main?
Yes
How to reproduce
From a checkout of #1704's head (git fetch origin pull/1704/head), with the server's virtualenv. Save as tests/unit/test_seed_stale.py and run pytest tests/unit/test_seed_stale.py -s:
from unittest.mock import patch
from server.code.app.symbol import graph, impact
from tests.unit.test_code_epistemic_envelope import _impact, _Repo, intel # noqa: F401
async def test_seed_file_edited_since_compiler_run(intel):
from server.code.api.models_symbol import CodeCallersInput
repo = _Repo()
repo.stale_paths = {"src/A.cpp"} # the fast tier rewrote the seed's file after the compiler run
args = CodeCallersInput(org="o", namespace="n", name="DB::A::insert", include_ambiguous=False)
with patch.object(graph, "CodeRepo", return_value=repo):
callers = await graph.handle_code_callers(args)
callees = await graph.handle_code_callees(args)
by_name = await _impact(impact, repo, name="DB::A::insert")
by_files = await _impact(impact, repo, files=["src/A.cpp"])
print("callers", callers.epistemic, callers.causes)
print("callees", callees.epistemic, callees.causes)
print("impact ", by_name.epistemic, by_name.causes)
print("impact files", by_files.epistemic, by_files.causes)
callers lower_bound ['scip_stale_files']
callees lower_bound ['scip_stale_files']
impact exact []
impact files exact []
For code.test_gate, take _py_repo, _one_line and _gate from tests/unit/test_code_test_gate.py, give the repo the coverage rows of test_a_cut_coverage_read_is_a_cause_and_a_test_only_change_has_none, add async def scip_stale_paths(org, ns, paths): return {"pkg/w.py"} and run _gate(intel, repo, diff=_one_line("pkg/w.py", 46)): epistemic is measured and causes is [].
Expected behavior
code.impactandcode.test_gaterun the same seed-path check as callers and callees:_scip_staleover their seed paths (known_paths), keeping the paths the compiler tier covers asgraph.py:410does, and pass the result toscip_stale=. A seed file edited since the compiler run then readslower_boundwithscip_stale_files.- A test per handler: a compiler-covered seed whose path
scip_stale_pathsreturns, assertinglower_boundandscip_stale_filesforcode.impactby name, by files and by diff, and the cause forcode.test_gate.
Environment
#1704 head 226a92c4a638f6f0a985950d33bdeafd6e5163b1 and Loom main at 82dc31216fd252db028fa57eca570fe87258e64a.
Python 3.12; the repository's unit-test fakes, no ClickHouse.
Related issues and pull requests
Related: https://github.com/ClickHouse/loom/pull/1704
Additional context
How this was found
Found with AI assistance, and checked against the unit-test stand-ins on #1704's head.
Redaction
- I removed tokens, keys, passwords and personal or customer data from everything above.
- Ngôn ngữ chính
- Python
- Star
- 263
- Fork
- 47
- Merge trung bình
- 14 giờ 21 phút
- Pull request đã merge (30 ngày)
- 873
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
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 ClickHouse/loom
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 76/100
ClickHouse/loom#2014 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Options of loom period-digest, reextract, reconcile-status and demote-activity-narration print no help textCó thể đã có người làm @VanshajPoonia đã nhận hôm nay. Đang mởbug good first issue help wanted up-for-grabs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
ClickHouse/loom#1988 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
A compiler-tier checkout fetch from a shallow mirror never records its headCó thể đã có người làm @KaloyanNaumov đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
ClickHouse/loom#2016 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Delta workers fetch the compiler-tier checkout under a hard-coded 600 s limitCó thể đã có người làm @KaloyanNaumov đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 35/100
ClickHouse/loom#2012 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
loom participant retire cannot retire an orphaned participant after container replacement or host rebootCó thể đã có người làm @l0K1ngg đã nhận hôm nay. Đang mởbug help wanted up-for-grabs
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
ClickHouse/loom#2007 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của ClickHouse/loom
Issue tương tự
-
Ubuntu for Debian DevelopersĐang mởDMB documentation good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ubuntu/ubuntu-project-docs#921 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
⏳ Pending feedback 🐛 Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
jumpserver/jumpserver#18282 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
accepted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
future-agi/future-agi#5274 ·
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 84/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
GenericMappingTools/pygmt#5014 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày