TypeScript member indexing drops cross-package edges and files compiled from outside a member
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
- 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, typescript
- Lĩnh vực
- developer-experience, tooling
Hướng nghiên cứu
Start with scripts/scip_harness/run_typescript_delta.sh:52-55, scripts/scip_harness/scip_merge_indexes.py:107-118, and scripts/scip_harness/scip_ts_projects.py:211-218; trace how workspace path rewriting and member file ownership affect the merge. Then inspect the real-indexer cases described in the issue, especially the pnpm fixture and shared file delta. Done means the lost cross-package edges and compiled shared file rows are preserved in full and incremental deltas, with regression coverage.
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
Since #1782 by @ZYZ666-RGB, the TypeScript tier indexes an umbrella root one member project at a time. On a references repository without workspaces it names member symbols that the root pass left unnamed (RyanCavanaugh/project-references-demo: 0 symbols before, 10 after), and a one-member delta runs one indexer process. On a pnpm workspace with an umbrella root, two parts of it change what the index holds, measured with the real scip-typescript on a 4-package fixture:
| run | indexer processes | files / symbols / edges in the delta |
|---|---|---|
harness before #1782, --full |
1 | 5 / 7 / 7 |
harness before #1782, --full, SCIP_TS_PATHS=0 |
1 | 5 / 7 / 2 |
main, --full |
4 | 4 / 6 / 2 |
- Cross-package edges are lost when discovery finds an umbrella.
run_typescript_delta.sh:52-55setsWORKSPACES=""andSCIP_TS_PATHS=0for a discovered umbrella. In an unbuilt pnpm or yarn workspace,scip_ts_paths.py'sdist/rewrite is what resolvesimport … from "@x/a"to source; scip-typescript 0.4.0 does not redirect a project reference to source either. The fixture'scallsedgesb → ago from 3 to 0 andd → afrom 1 to 0. The comment on those lines explains the setting for an operator'sSCIP_TS_PROJECTSlist; a discovered umbrella over an unbuilt workspace still needs the rewrite. - Files a member compiles from outside its directory are dropped. The merge keeps a document only for the member whose directory contains its path (
scip_merge_indexes.py:107-118,project_ownsatscip_ts_projects.py:211-218), not for the member whose tsconfig compiled it. Withpackages/c/tsconfig.jsonincluding../../shared/**/*.ts, the harness before #1782 emitsshared/util.ts;maindoes not, on a full pass or on a delta that changes that file, and the edgegamma → sharedUtilpoints at a symbol with no rows. The same rule applies to an operator'sscip_ts_projectslist, so lists that worked before lose these files too. On the next full backfill the worker'sgone_documents(server/code/workers/scip_ts_delta.py:158-163) retires the rows the earlier pass wrote. Reverting #1782 does not bring them back until a full rerun.
Case 2 also feeds a cost problem: a change to such a file selects every member and converts nothing (tracked with the other cost findings in https://github.com/ClickHouse/loom/issues/1961).
Does it reproduce on the latest release or main?
Yes
How to reproduce
The fixture, a pnpm workspace with nothing built:
- Root:
package.json,pnpm-workspace.yamlwithpackages: ["packages/*"],tsconfig.base.jsonwithcomposite,declaration,strictandmodule/moduleResolutionnodenext, andtsconfig.json{"files": [], "references": [{"path": "./packages/a"}, {"path": "./packages/b"}, {"path": "./packages/c"}, {"path": "./packages/d"}]}. - Each
packages/<p>/package.jsonhas"exports": {".": {"types": "./dist/index.d.ts", "default": "./dist/index.js"}}; b, c and d depend on"@x/a": "workspace:*". Eachtsconfig.jsonextends the base withinclude: ["src"], and b, c and d add"references": [{"path": "../a"}]. packages/a/src/index.tsexportsalpha()and a classAlphawithrun(); b callsalphaandnew Alpha().run(); d callsalpha.packages/c/tsconfig.jsonalso has"rootDir": "../.."and"include": ["src", "../../shared/**/*.ts"];packages/c/src/index.tscallsalphaandsharedUtilfrom../../../shared/util.js;shared/util.tsat the root exportssharedUtil.
pnpm install --ignore-scripts
DELTA_OUT=main.json scripts/scip_harness/run_typescript_delta.sh /path/to/fixture --full HEAD
# the harness before #1782, from a second Loom checkout at 1bc5be8b1^1:
DELTA_OUT=pre.json scripts/scip_harness/run_typescript_delta.sh /path/to/fixture --full HEAD
Count the documents, symbols and edges in each delta: pre.json has shared/util.ts and the calls edges from b and d into a; main.json has neither. A commit that changes only shared/util.ts, run as a delta on main, runs the indexer 4 times and writes 0 files; the harness before #1782 writes 1.
Expected behavior
- A discovered umbrella over a workspace keeps the workspace's
SCIP_TS_PATHS(the rewrite already runs once before the member loop when the flag is on), so a full pass has the edges it had before #1782. - A file a member's tsconfig compiles keeps its rows. Either ownership follows the files each member's program resolves, or a document that no member owns by directory is kept from the first part that emitted it. Until then, a revert of #1782 needs a full rerun to restore the retired rows.
Environment
Loom main at 3058a5816 (contains #1782); "before #1782" is scripts/scip_harness/ at 1bc5be8b1^1.
@sourcegraph/scip-typescript 0.4.0, node 22.23.4, pnpm 12.15.0, Python 3.12.
run_typescript_delta.sh in DELTA_OUT mode, the worker's mode; counts are read from the delta JSON, so no ClickHouse was involved.
Related issues and pull requests
Caused by: https://github.com/ClickHouse/loom/pull/1782
Related: https://github.com/ClickHouse/loom/issues/1678
Related: https://github.com/ClickHouse/loom/issues/1961
How this was found
An AI tool found it, and I have not reproduced it myself
Additional context
Smaller gaps in what the index holds, from the same audit:
- A one-member delta loses
callsedges into arrow-function constants of members it did not index: the converter's kind prepass (scip_to_delta.py:389,_ts_prepass) reads definition kinds from the merged index only. On a synthetic repository the full pass emitsa → fanda → g, the delta onlya → g. - A member taken out of the root's
referenceskeeps its rows. The config rebuild converts only the remaining members and emits no deletion (fixture:packages/ddropped, 3 members reindexed,deleted_files: 0), and the worker runs a full pass only without a watermark. - The merge concatenates
external_symbolsfrom every part without removing duplicates. docs/architecture/code-index-architecture.md:354says the converter bounds the output to the TypeScript window, which does not hold on a config rebuild; the harness README's TypeScript section and thescip_ts_delta.pydocstring ("every pass re-indexes the workspace") describe the tier before #1782.
The harness tests run a stub indexer that writes empty indexes, so these cases need the real one. Tests that would catch them:
- A pnpm workspace with an umbrella root and
@x/bimporting@x/athrough an unbuiltdist/export: assert acallsedgeb → ain the delta. - A member whose tsconfig includes
../../shared/**/*.ts: assertshared/util.tsis in the full delta and in the delta for a change to it. - A member removed from
references: assert its rows are retired, or document that they are not. - Two parts with the same
external_symbols: assert one copy of each in the merge. - One end-to-end run with the real scip-typescript on a small references repository, asserting per-member file, symbol and edge counts, so the ownership rule is checked against the
relative_pathvalues the indexer writes.
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ự
-
essreduce
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area-a2a bug port python
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
strands-agents/harness-sdk#6697 · 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 76/100
TigreGotico/orthography2ipa#2950 ·
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 78/100
TigreGotico/text2spoken#929 ·
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 78/100