A cached PR overlay is served after the index it was classified against moved
Maintainer thường phản hồi trong vòng 1 ngà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
- 25/100
Hướng nghiên cứu
Start with load_pr_overlay and load_posted_overlay in server/code/app/index/pr_overlay.py, then read the unit-test fakes in tests/unit/test_pr_post_image.py. Trace how the cache keys represent the indexed commit, branch tip, path scope, diff cut and posted overlay SHAs; add cases that change each input between reads. Done means those changes cause cache misses and the tests confirm the refreshed classifications and diff.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Company
Independent
Component
Code index
Describe what's wrong
A reindex within 60 s of a PR read leaves the PR overlay's classification at the old index.
load_pr_overlay (server/code/app/index/pr_overlay.py) keeps its result for code_pr_overlay_cache_ttl_s (60 s) under (mirror, namespace, PR number) and accepts a hit when the PR head sha matches. The overlay classifies each function added, modified or unchanged, and binds each call site, against the name table at the namespace's indexed commit, and the key does not hold that commit. A PR read once, then reindexed to a commit that defines a function the PR adds, still reports that function as added for the rest of the TTL, with its call sites bound against the old names. code.callers, code.callees, code.impact and code.review_brief (through its impact read) all answer from it.
The diff is the PR head against merge-base(head, refs/heads/<branch>), and the key does not hold the branch tip either. When the branch gains commits the PR head already contains (a base merged by merge commit or fast-forward, or by a rebase that reuses shas), the merge-base moves and the diff shrinks, and a hit still serves the old diff.
Three more inputs of the overlay are missing from the key: the target branch, the path scope (path_prefixes) and the diff cut (diff_max_bytes). No caller varies them for one namespace today, since overlay_for_namespace passes the namespace's own git_branch, its path_prefixes and the default cut, so they are a gap in the key's completeness: they bite a direct caller, a repository-entry edit inside the TTL, or any namespace that holds several branches.
load_posted_overlay has the same shape for a post-image sent with the request: the key holds the PR number and the content digest only, so a re-send of the same files after an index move is served the old classification, and a re-send with another pr_head_sha or pr_base_sha keeps the first one's overlay_head_sha label.
The other caches in the module are keyed correctly. _FILE_FACTS is keyed on path and content digest, _FILE_EDGES on path, content digest and the digest of the name-table rows the file's names bind to, and _NAMES on namespace, indexed commit and name. _RUNNING holds an in-flight parse, not a result.
Does it reproduce on the latest release or main?
Yes
How to reproduce
On main at 3058a5816, with the unit-test fakes of tests/unit/test_pr_post_image.py (no server, no ClickHouse):
- A namespace whose indexed commit does not define
loadDataParts; read a PR that adds it withload_pr_overlay. Move the namespace'sgit_headstate to a commit that defines it and read again. The second call still reports itadded. - The same call twice with the target branch's tip moved between them, and its merge-base with the PR head. The second call returns the overlay of the old merge-base.
- One mirror, one PR head.
load_pr_overlay(..., branch="master")and thenload_pr_overlay(..., branch="release")for the same namespace and PR. The second call returns the first call's overlay (itsbase_sha, its diff, itsmodifiedset). Swapping the order swaps the wrong answer. - The same call with
path_prefixes=("src/",)and then("lib/",). The second returns the first's symbols.
Expected behavior
An overlay is served from the cache only for the inputs it was built from: the PR head, the target branch's tip, the namespace's indexed commit, the path scope and the diff cut. Any of them changing is a miss, as a pushed PR head already is.
Environment
main at 3058a5816, Python 3.12, unit tests only.
Related issues and pull requests
Related: https://github.com/ClickHouse/loom/issues/1680
How this was found
An AI tool helped find it, and I reproduced it myself
Additional context
The cache holds a namespace in its key since an earlier fix, so two namespaces on one mirror (one per branch) do not share an overlay today. A design that indexes several branches in one namespace (#1680) makes the target branch an input of every overlay read, which is why the key should hold every input first.
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