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

Aperta
#1,961 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python, typescript
Ambito
tooling

Direzione di ricerca

Start with scripts/scip_harness/scip_ts_projects.py and scripts/scip_harness/run_typescript_delta.sh, then review the related changes in #1782 and the selection behavior in #1958. The issue identifies five selection cases and a partial failure policy that needs a watermark decision. Done means the selection, reference indexing, and member failure cases have documented outcomes, with the proposed harness coverage passing.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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 https://github.com/ClickHouse/loom/issues/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 #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 #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 #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 #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 #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 (https://github.com/ClickHouse/loom/issues/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: https://github.com/ClickHouse/loom/pull/1782
Related: https://github.com/ClickHouse/loom/issues/1678
Related: https://github.com/ClickHouse/loom/issues/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.
Lingua principale
Python
Stelle
263
Fork
47
Merge medio
14h 21m
PR unite (30g)
873

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ClickHouse/loom

Tutte le issue di ClickHouse/loom

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.