Skip to content

TypeScript member passes index more members than a change needs, and one failing member fails all #1961

Backlog

Description

@KaloyanNaumov

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:

  1. A changed TypeScript path that no member owns reruns every member and converts nothing. select_projects_for_delta returns 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/*.ts and tools/** trigger it. Fixture: a commit changing tools/build.ts runs 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/scripts 63 paths, scripts/lib 23, scripts/e2e 9, test/vitest 6), 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 default code_scip_ts_delta_timeout_seconds of 3,600 s.

  2. 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 members src and src/infra, a change to src/infra/net.ts indexes both, and the merge then drops src's documents for that path. A root-level explicit member (scope ., such as typescript-eslint's tsconfig.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%) select src only through a path in a src/* member; src alone took 826 s in a full pass, so these deltas spend about 14 minutes on a member whose output is discarded.

  3. 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 a1faa174 processes wall peak RSS, largest process files / symbols / edges
    before Index TypeScript monorepos by member project, not the umbrella root #1782, root pass, --full 1 91 s 1.51 GiB 1,368 / 6,735 / 4,220 (10 documents emitted twice)
    main, --full 36 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/src 1 89 s 1.29 GiB 1 / 5 / 0
    main, the same edit 3 50 s 0.73 GiB 1 / 5 / 0, same rows

    The delta on main ran utils/tsconfig.build.json, utils/tsconfig.spec.json and the root-level tsconfig.repo-config-files.json (case 2), and each process re-indexed its reference closure.

  4. One member whose indexer exits non-zero fails the pass for all members (run_typescript_delta.sh:164-170 under set -e), the watermark stays, and the next pass repeats it. On typescript-eslint at 90497319, the first member fails with TS5023 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.json

Cost 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, TS5023

The same commands against scripts/scip_harness/ at 1bc5be8b1^1 give the "before #1782" rows.

Expected performance

  1. 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.
  2. The filter selects _preferred_owner over the full member set for each changed path, as the merge does, so a src/infra change runs src/infra alone and a root-level member runs only for paths no other member owns.
  3. 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.
  4. 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:

  1. 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), so packages/a/test/fixtures/x/package-lock.json reindexes every member.
  2. has-config reads the whole window (run_typescript_delta.sh:211): an unowned package.json beside an owned TypeScript edit drops --changed-files for the selected member, so its whole output is converted.
  3. 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_delta does 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:

  1. Members src and src/infra, a change to src/infra/x.ts: assert only src/infra is indexed.
  2. A root-level explicit member beside package members, a package-only change: assert the root-level member is not selected.
  3. An unowned TypeScript path alone (tools/build.ts): assert no indexer run, or a documented reason for one.
  4. A member whose indexer exits non-zero among healthy members: assert the documented outcome.
  5. 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

  1. KaloyanNaumov commented on Dec 2, 2026

    @KaloyanNaumov
    ContributorAuthor

    @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:

    1. Index members that share a reference closure in one indexer run, and split the output by owner.
    2. Go back to one root process for a full pass when the members cover the workspace, and keep per-member runs for deltas.
    3. Keep one process per member and accept the cost of full passes.

    The memory limit that per-member runs solved (#1678) constrains both 1 and 2.

  2. KaloyanNaumov commented on Dec 2, 2026

    @KaloyanNaumov
    ContributorAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions