Repository navigation
Description
Company
Independent
Component
Code index
Describe the situation
#1782 runs one scip-typescript process per member and, on a delta, only the members that own a changed path. A delta inside one package works as intended: one process, 6 s on a small fixture, and under a minute at 0.95 GB on the repository from #1678 where the whole project set ran before. Four parts of the selection and the member loop cost more than the change needs, or turn one bad member into a failed pass:
-
A changed TypeScript path that no member owns reruns every member and converts nothing.
select_projects_for_deltareturns the full set for it (scripts/scip_harness/scip_ts_projects.py:267-273), but the merge keeps only documents inside a member's directory, so no member index can hold that path (case 2 of TypeScript member indexing drops cross-package edges and files compiled from outside a member #1958). Root*.config.ts,scripts/*.tsandtools/**trigger it. Fixture: a commit changingtools/build.tsruns 4 indexer processes for 18.0 s and writes 0 files. On the repository from The TypeScript tier cannot index a large monorepo through its root tsconfig, and every delta repeats the full cost #1678, 77 of the last 400 first-parent commits (19%) take this path (test/scripts63 paths,scripts/lib23,scripts/e2e9,test/vitest6), each a rerun of all 226 members; a full pass over the list (222 members at an earlier commit) took 7,629 s, past the worker's defaultcode_scip_ts_delta_timeout_secondsof 3,600 s. -
A change in a nested member also selects every member above it. The filter (
scip_ts_projects.py:262-266) selects each member that contains the path by prefix, while the merge keeps only the most specific owner (_preferred_owner). With memberssrcandsrc/infra, a change tosrc/infra/net.tsindexes both, and the merge then dropssrc's documents for that path. A root-level explicit member (scope., such as typescript-eslint'stsconfig.repo-config-files.json) is selected by every delta. On the repository from The TypeScript tier cannot index a large monorepo through its root tsconfig, and every delta repeats the full cost #1678, 131 of the 275 subset windows (48%) selectsrconly through a path in asrc/*member;srcalone took 826 s in a full pass, so these deltas spend about 14 minutes on a member whose output is discarded. -
One process per member re-indexes each member's reference closure. scip-typescript 0.4.0 indexes every project a target references, recursively, in the same process (
dist/src/main.js:148-154), and the merge then discards the copies. On typescript-eslint, a full pass takes 4.5 times as long for the same rows, with a smaller largest process:typescript-eslint a1faa174processes wall peak RSS, largest process files / symbols / edges before Index TypeScript monorepos by member project, not the umbrella root #1782, root pass, --full1 91 s 1.51 GiB 1,368 / 6,735 / 4,220 (10 documents emitted twice) main,--full36 408 s 0.97 GiB 1,358 / 6,628 / 4,220 (same per-file content) before Index TypeScript monorepos by member project, not the umbrella root #1782, one edit in packages/utils/src1 89 s 1.29 GiB 1 / 5 / 0 main, the same edit3 50 s 0.73 GiB 1 / 5 / 0, same rows The delta on
mainranutils/tsconfig.build.json,utils/tsconfig.spec.jsonand the root-leveltsconfig.repo-config-files.json(case 2), and each process re-indexed its reference closure. -
One member whose indexer exits non-zero fails the pass for all members (
run_typescript_delta.sh:164-170underset -e), the watermark stays, and the next pass repeats it. On typescript-eslint at90497319, the first member fails withTS5023 Unknown compiler option 'stableTypeOrdering'(scip-typescript 0.4.0's bundled TypeScript does not know the option) and the pass exits 1 after 0.8 s. The root pass before Index TypeScript monorepos by member project, not the umbrella root #1782 failed as a whole too, so this is not new; with dozens or hundreds of separate runs it is the likeliest failure, and a member split could contain it.
Does it reproduce on the latest release or main?
Yes
How to reproduce
Selection, from a checkout of main:
printf 'tools/build.ts\n' > unowned.txt
python3 scripts/scip_harness/scip_ts_projects.py filter --changed-file-list unowned.txt -- packages/a packages/b
# prints packages/a and packages/b
printf 'src/infra/net.ts\n' > nested.txt
python3 scripts/scip_harness/scip_ts_projects.py filter --changed-file-list nested.txt -- src src/infra
# prints src and src/infra
printf 'packages/a/src/x.ts\n' > one.txt
python3 scripts/scip_harness/scip_ts_projects.py filter --changed-file-list one.txt -- packages/a packages/b tsconfig.repo-config-files.json
# prints packages/a and tsconfig.repo-config-files.jsonCost and failure, from the Loom checkout, on typescript-eslint/typescript-eslint after pnpm install --frozen-lockfile --ignore-scripts, with a wrapper as SCIP_TYPESCRIPT that logs each invocation:
git -C /path/to/typescript-eslint checkout a1faa174
DELTA_OUT=full.json scripts/scip_harness/run_typescript_delta.sh /path/to/typescript-eslint --full HEAD # 36 invocations
git -C /path/to/typescript-eslint checkout 90497319
DELTA_OUT=head.json scripts/scip_harness/run_typescript_delta.sh /path/to/typescript-eslint --full HEAD # exit 1, TS5023The same commands against scripts/scip_harness/ at 1bc5be8b1^1 give the "before #1782" rows.
Expected performance
- An unowned TypeScript path selects no member, or once ownership follows each member's resolved files (TypeScript member indexing drops cross-package edges and files compiled from outside a member #1958), the members whose program includes it.
- The filter selects
_preferred_ownerover the full member set for each changed path, as the merge does, so asrc/infrachange runssrc/infraalone and a root-level member runs only for paths no other member owns. - A member is indexed without re-indexing its references (its references stripped in a generated tsconfig, or members ordered so each closure is indexed once), keeping the full pass near the single root process's time.
- A failing member leaves the other members' rows: the merge takes the parts that succeeded, the failed member's files keep their rows marked stale, and the log names the member and its error. This needs a decision on the watermark for a partial pass.
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; no ClickHouse involved.
Repositories: a 4-package pnpm fixture; typescript-eslint/typescript-eslint a1faa174 (references umbrella, nested umbrellas, 36 members) and 90497319; the repository from #1678 with a project list of 226 members expanded from 15 directory patterns, history classified with main's select_projects_for_delta over one-commit windows.
The host was shared with other jobs: wall times are within about ±20%. The 7,629 s and 826 s figures come from #1782's head e8fbb33 before the merge, with a 24 GiB heap and with the merge and converter changes from https://github.com/ClickHouse/loom/issues/1959 and #1704 in place, because the whole-index merge fails on that repository.
Related issues and pull requests
Related: #1782
Related: #1678
Related: #1958
Additional context
How this was found: an AI tool found it, and I have not reproduced it myself.
Smaller selection gaps:
- A lockfile name at any depth counts as a shared change, because the name test runs before the
/test (scip_ts_projects.py:226-231), sopackages/a/test/fixtures/x/package-lock.jsonreindexes every member. has-configreads the whole window (run_typescript_delta.sh:211): an unownedpackage.jsonbeside an owned TypeScript edit drops--changed-filesfor the selected member, so its whole output is converted.- An empty selection falls through to
index_workspace's branch for no member list, which runs scip-typescript on the checkout root (run_typescript_delta.sh:150-160, 200-205).select_projects_for_deltadoes not return an empty list today when a TypeScript path changed, so it is not reachable, but that fallback is the whole-root pass.
Tests that would cover this; the harness tests use a stub indexer, so cases 3 and 4 above need the real one:
- Members
srcandsrc/infra, a change tosrc/infra/x.ts: assert onlysrc/infrais indexed. - A root-level explicit member beside package members, a package-only change: assert the root-level member is not selected.
- An unowned TypeScript path alone (
tools/build.ts): assert no indexer run, or a documented reason for one. - A member whose indexer exits non-zero among healthy members: assert the documented outcome.
- A nested lockfile under a member's test fixtures: assert that member alone, or none, is selected.
Redaction
- I removed tokens, keys, passwords and personal or customer data from everything above.
Activity
KaloyanNaumov commentedon Dec 2, 2026
@zlareb1 product decision needed here, on item 3. One scip-typescript process per member re-indexes each member's reference closure, which takes 4.5 times the root pass's wall time on typescript-eslint for the same rows. Items 1 and 4 have PRs (#1976, merged, and #1973). Item 2 waits on the kind prepass in #1958's additional context. Item 3 is a choice of shape:
The memory limit that per-member runs solved (#1678) constrains both 1 and 2.
KaloyanNaumov commentedon Dec 2, 2026
On item 3 we will take shape 1 unless you prefer another. The closure-runs plan in #2008 already decides which process indexes which project; a follow-up PR lets it pack up to N member runs into one scip-typescript process, behind a setting that defaults to 1, so nothing changes unless an operator raises it. A grouped run that fails reruns each member alone, so #1973's per-member failure isolation holds. We are measuring it on a 222-member workspace now and will put the wall time and peak memory per process in that PR.
zlareb1 commentedon Dec 6, 2026
@KaloyanNaumov shape 1 is the right call, but I'd rather not hide it behind a setting that defaults to 1. Nobody will turn it up, and a count doesn't really bound memory when
srcon the #1678 repo takes 826 s by itself. Make the group size a constant you pick from the 222-member numbers, and letcode_scip_ts_node_heap_mbbe the limit: if a grouped run fails, heap abort included, rerun its members one at a time. Worst case, that's today's cost plus one wasted attempt.I'd also only pack runs that can't emit the same file: each run's
files/includestays inside its own directory, and no directory in the group contains another. That's what went wrong with the one-process run in #2008, which kept the wrong copy ofeslint-rules.d.ts. The rows should match one process per project, file for file.The number I care about is the 222-member full pass finishing under the 3,600 s timeout. Any root lockfile,
package.jsonortsconfig*.jsonchange runs every member, and #2008 doesn't help that repo because nothing there references anything. Right now that pass takes about 7,600 s, the harness gets killed, and the watermark is stuck behind that commit. If packing doesn't get it under the timeout, post the numbers here before we try anything else.On the rest:
Items 1 and 2 aren't blocked anymore. Both kept the full set because of the kind prepass, and #2003 now resolves those edges from the stored kinds. I ran your repros on
main. An unowned file alone selects nothing now, but an unowned file next to an owned edit still selects every member, andsrc/infra/net.tsstill pulls insrc. I'd drop that fallback inselect_projects_for_deltaand select only the most specific owner for each path, the way the merge does. One PR for both is fine. Include your tests 1–3, a mixed-window test, and a real-indexer run showing the edges match the full set.Item 4: advance the watermark. One broken member shouldn't block everyone else, and the rule in #1973 is right. The one thing I'd add is putting the failed member and its error into what
code.index_statusshows, not just a log line, since a member like the TS5023 one fails on every pass.Smaller gaps: the nested lockfile and
has-configones are still there onmainand could go in the same PR as 1 and 2. The empty-selection one is fixed. I also noticed that a tsconfig below the root that no member owns (sayconfigs/tsconfig.base.json) doesn't select anything, so members that extend it keep stale rows. That probably belongs with the ownership question on #1958.