A symbol-stage re-chunk leaves callers that sort before a new definition declined

Đang mở
#1,965 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
45/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
backend, databases

Hướng nghiên cứu

Read ingest_pass._maybe_rechunk, _rechunk_batch in reconcile.heal, and the edge-stage inputs in server/code/domain/extract/extractor_stamp.py; trace how batches change the name table and how dependents are normally re-resolved. Check existing tests for rechunking and dependent resolution, then add coverage for both a newly added name and a removed name. Done means callers reflect the final migrated name table after rechunking completes.

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

When an extractor change moves the symbol stage, the re-chunk (ingest_pass._maybe_rechunk) re-derives every live file in sorted path order, in batches through reconcile.heal (_rechunk_batch). STAGE_INPUTS["edge"] = ("symbol",) (server/code/domain/extract/extractor_stamp.py), so the edge stage re-runs with it, and each file's edges resolve against the name table as it stands when that file's batch runs.

If the new symbol extraction gains a name in some file (a definition the old extractor missed), a caller in another file whose path sorts before it is re-derived while the name is still absent, and its call site is declined unresolved. The definer's batch then adds the name, but nothing re-resolves the caller: the re-chunk does not run the dependents step that a commit and a reconcile heal run over what they changed, and the caller's blob did not move, so no later reconcile finds it stale. The site stays declined until a commit touches the calling file.

A stage move that drops a name has the mirror effect: a caller earlier in path order keeps its edge into the definition until the definer's batch tombstones the symbol, and the edge is then left pointing at a retired symbol.

Does it reproduce on the latest release or main?

Not checked

How to reproduce
  1. Index a namespace whose a/caller.cpp calls helper(), defined in b/lib.cpp in a form the current symbol extractor does not emit, so the call site is declined unresolved.
  2. Change the symbol extractor so it emits helper, which moves the symbol stage's stamp.
  3. Let the worker's re-chunk finish (code_index_state key extractor_stamp reaches its target).
  4. a/caller.cpp still has its declined helper site and no edge into helper; re-ingesting a/caller.cpp by hand binds it.
Expected behavior

After a stage migration completes, every caller resolves against the name table the migration produced, as it would after a full backfill with the new extractor.

Environment

main, code index fast tier.

Related issues and pull requests

Related: https://github.com/ClickHouse/loom/issues/1680

How this was found

An AI tool found it, and I have not reproduced it myself

Additional context

Running the per-commit dependents step after each re-chunk batch is the obvious fix and the wrong one: a whole-repository migration changes many names per batch, so every batch would hit code_closure_repair_max_names (500) and fill code_ingest_dependents_pending_max (5000). One dependents sweep after the cursor completes, over the union of what the batches added and removed, or a second edges-only pass over the files that hold declined sites or edges into names the migration changed, fits the shape better.

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

Mở trong Codespaces

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.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ClickHouse/loom

Tất cả issue của ClickHouse/loom

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.