Repository navigation
TypeScript member runs index each referenced project once - #2008
Conversation
scip-typescript indexes every project a target references, recursively, in the target's own process, so one process per member indexed a shared reference once for each member that reaches it, and the merge discarded the copies. On typescript-eslint the 36 members made 289 project runs for 37 projects. The harness now asks scip_ts_projects.py for a plan: each project of the selected members' reference closures runs once, a project with references through a generated config that extends it without them (`references` is the one field `extends` does not inherit). The merge gets each run's index once for every member whose process would have indexed it, in that order, so it keeps the same documents. A member without references runs as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
On a typescript-eslint delta that edits packages/utils, the selected root-level member tsconfig.repo-config-files.json reaches every package's build config through its references, and each ran in its own process: 18 processes, slower than the three member processes before. The merge keeps a document for a member only when the member's scope is the document's most specific owner, so a project whose files all lie in its own directory, under another member's scope, gives that member nothing. The plan leaves such a pair out, and a project with no pair left does not run. A `files` or `include` entry outside the project's directory, or an `extends` the helper cannot find, keeps the pair. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
…ipt pass Inside a member's process a referenced project with no input was harmless: the member's own documents kept the document count above zero. Run alone, scip-typescript 0.4.0 exits 1 and deletes its output, which aborted the pass for every member. The plan now marks each run as a member without references (which ran alone before) or not, and the pass reads a failed run of the second kind that left no output as an empty part, which the merge already accepts. Any other failure still stops the pass. The plan's owner check shares one scope-specificity helper with the merge instead of keeping a second copy. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
zlareb1
left a comment
There was a problem hiding this comment.
A focused harness probe reproduced a lost indexer failure and deletion of a tracked config.
A referenced project's run that exited non-zero without an output file was read as an empty project, so an indexer killed before it wrote (exit 137) let the pass convert and publish an index without that project. A run is read as empty only on scip-typescript 0.4.0's own report that its project matched no input file: exit 1, no output, the "no files got indexed" line on stdout and nothing on stderr. A process that throws prints the same line, then its stack on stderr. Any other failure ends the pass with the indexer's exit status. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
The config that drops a project's references was written as
.scip-norefs.<name> beside the original, overwriting a tracked file of that
name, which the exit hook then deleted.
The plan creates it exclusively under a fresh name in the same directory
(mkstemp), so `include` and `${configDir}` still resolve as before, and the
exit hook removes only the file the plan created.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
scip-typescript prints the diagnostics of a tsconfig it cannot load (an unknown compiler option, an unresolvable extends) on stdout, skips the project, and ends like an empty run: exit 1, no output, the "no files got indexed" report on stdout, nothing on stderr. The pass read that as an empty project and dropped its real files from the index. A run is empty only when stdout holds nothing but the report line, so the pass now fails with the indexer's exit status. The kill test's fake prints the report line before it exits 137, so the test pins the status, not the output. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
write_plan creates the no-references configs before the shell reads any `config` line. When a later mkstemp raises (a read-only member directory), the shell exits under `set -e` without a cleanup hook and the earlier files stay in the tree, each under a fresh name. write_plan now unlinks what it created and re-raises. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
zlareb1
left a comment
There was a problem hiding this comment.
The new failure checks distinguish a genuinely empty project from an indexer failure. One temporary-file cleanup gap remains.
The helper raised before returning its path, so the caller's cleanup never saw the file: a partial `.scip-norefs.*` config stayed in the checkout, and an `fdopen` that failed left mkstemp's descriptor open too. The helper now closes the descriptor and unlinks the file on any error, then re-raises. Two tests fail after creation, one at the write and one at the open. Each asserts the checkout holds no `.scip-norefs.*` file; the open case also asserts the descriptor was closed, which is the state POSIX hides (it unlinks an open file happily, so only the descriptor shows the leak). Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
zlareb1
left a comment
There was a problem hiding this comment.
The harness closes the descriptor and removes the generated config when opening or writing fails. All 53 focused project and harness tests pass. GitHub reports conflicts with main in the TypeScript harness, index merge, and umbrella test.
main changed the harness where this branch also edits, so each conflict keeps main's structure and the branch's intent: - run_typescript_delta.sh: main added paths_rewrite [tsconfig...], which rewrites only the configs the indexer is given. The branch's plan-based loop already calls it with the selected configs, so both functions stay, indexed_no_file first, each with its own body. - scip_merge_indexes.py: main loads scip_to_delta and copies documents from the top-level records without decoding them. The branch's ownership helpers need scope_specificity, which the branch moved into scip_ts_projects; that import sits beside main's converter load, and the rest of the function is main's. - test_run_typescript_delta_umbrella.py: the branch gave _run a scip parameter so a test can pass its own indexer stub; main resets the .tsconfig call log there. _run keeps both: the log is cleared and the stub is the parameter's, defaulting to _FAKE_SCIP. docs/architecture/code-index-architecture.md merged without a conflict. The branch's behaviour is unchanged: a generated config is closed and removed when writing or opening it fails, and a project that indexes no file stays an empty part. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
|
Merged main. Three conflicts, all in the harness: main added At the merged head: 504 passed across the converter, path, CLI, worker and doc-link suites. The umbrella file passes 29 on CPython 3.13 and fails on 3.12.3, which is a stdlib argparse fix between patch releases rather than this code: the |
zlareb1
left a comment
There was a problem hiding this comment.
The merged harness keeps the project plan and preserves each member’s ownership when it merges the index parts. The temporary config is removed if opening or writing it fails. The tests cover empty references, failed indexer runs, and cleanup.
…ation Upstream now plans the TypeScript pass as one run per project of the members' reference closures (ClickHouse#2008) and gives a one-member delta's references to terms the index does not hold a `held_edges` list (ClickHouse#2003); this branch isolates a member whose indexer fails. The resolutions compose the two: - scripts/scip_harness/run_typescript_delta.sh keeps the plan: one process per project, each project once, the merge given each run once per member. A member's run that exits with an error no longer ends the pass: its part is left out of the merge, the merge names it `--failed-project` so the paths it owns come back as `--failed-paths`, and the converter lists them (`--failed-files`) so the server keeps those rows and marks the files stale. A shared project of the closures (`own` 0) still fails the pass with the indexer's status: its documents are more than one member's input, and running it alone is the case upstream reads as a failure. A member killed by a signal, or a pass whose every member failed, fails too; a run that indexed no file is still read as empty. - scripts/scip_harness/scip_to_delta.py takes upstream's `_ts_definition_unseen` and `_held_edges` beside this branch's `_ts_prepass(..., skips)`: a document that refers into a failed file is still skipped whole, and a reference to a term the converted index does not hold keeps its edge in `held_edges`. - scripts/scip_harness/scip_merge_indexes.py drops the local `_scope_specificity` for upstream's shared `scip_ts_projects.scope_specificity`. - tests/unit/test_run_typescript_delta_umbrella.py keeps both indexer fixtures (the branch's FAIL_TARGET stub and upstream's reference-following writer), `_run` raises CalledProcessError as upstream's failure tests read it, and `_run_status` keeps `extra_env` as its fifth positional argument. - tests/unit/test_scip_ts_kind_prepass.py passes the `tier` that `apply_delta` now requires and its repo stand-in answers `scip_stale_marks`. - docs: the TypeScript row of the producer table and rolling-upgrades rules 70 and 71 name both behaviours (the branch's skipped-files rule renumbered from a duplicate 69). tests/unit/test_code_scip_*.py and tests/unit/test_scip_*.py: 634 passed. tests/unit/test_run_typescript_delta_umbrella.py: 36 passed. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
Title: TypeScript member runs index each referenced project once
Related: #1961
TL;DR: one scip-typescript process per member re-indexed every project the member references, so typescript-eslint's 36 members made 289 project runs for 37 projects. The harness now runs each project once, only for the members whose merge can keep its documents, and feeds the merge the same inputs, so the rows are identical. On typescript-eslint a full pass takes 290 s instead of 550 s and a one-package delta 18 s instead of 45 s, with a smaller largest process.
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
The TypeScript pass over a monorepo whose member projects reference each other indexes each referenced project once, and a delta no longer indexes the packages a changed member references, with the same rows and a smaller indexer process.
Why
Since #1782 the harness runs one scip-typescript process per member. scip-typescript 0.4.0 indexes every project a target references, recursively, in the same process (
indexSingleProjectindist/src/main.js), and the merge then drops the copies the member does not own. On typescript-eslint, whose members are per-packagetsconfig.build.jsonandtsconfig.spec.jsonfiles that reference the build configs of their dependencies, the 36 member processes run 289 projects; the members' closures hold 37. A delta that editspackages/utilsselectsutils' two configs and the root-leveltsconfig.repo-config-files.json, whose closure holds 17 projects.scip_ts_projects.py planwalks each selected member's references as the indexer does (references first, depth first, each argument once per process; afiles: []solution config is walked, not run) and returns one run per project:{"extends": "./<name>"}, created exclusively under a fresh name (.scip-norefs.<random>.<name>,mkstemp).referencesis the one fieldextendsdoes not inherit, so the program has the same files and options and the indexer stops there. The leading dot keeps the file out of*include globs; the harness removes on exit only the files the plan created, so a file already in the tree is never overwritten or deleted.--projectownership and the last-copy rule see the same documents in the same order as before.filesandincludeentry of a referenced project, through itsextendschain, lies in the project's directory, and that directory is outside the member's scope or inside a more specific member's, the member gets nothing from it. An entry outside the directory, or anextendsthe helper cannot find, keeps the pair.A member without references gets the same single run as on
main.Shapes measured on typescript-eslint
a1faa174(scip-typescript 0.4.0, node 22, 8 GiB heap):--full,main: one process per member--full, one process over all members--full, one process,--no-global-caches--full, this changemain, file by filepackages/utils/src,mainmainThe first, second and fourth rows ran at the same time on one host, and the two delta rows likewise; the third ran earlier under a lighter load, so its wall time reads low against the others. The one-process shapes are faster because the indexer's source-file cache spans every project, and that cache is the heap #1782 split the umbrella to avoid: the single process grows to 1.69 GiB here, and on the repository from #1678 the root pass needed 39 GB.
--no-global-cachesdoes not bound it (2.00 GiB). One process also writes every project's documents into one index without saying which project emitted each: split by owner path with the existing merge, it keeps the copy ofpackages/eslint-plugin/typings/eslint-rules.d.tsemitted by another project, so one file's rows differ frommain. One process per project keeps the largest process at the largest single project, belowmain's, and the merge sees the same inputs.On the repository from #1678 no member references another project: the plan gives each of its 222 members the same single run as
mainand writes no generated config, so the change does not alter that pass.Scope and risk
scripts/scip_harness/scip_ts_projects.py(theplansubcommand),scripts/scip_harness/run_typescript_delta.sh(runs the plan; the merge call is unchanged), the architecture row forscip-typescript, and tests. Deltas keep their selection: only the members that own a changed path are planned. A member that shares references with a selected member but owns no changed path does not run, as before, because the merge keeps none of its documents from the selected members' runs.Limits:
includematches no file made no output inside a member's process; on its own the indexer exits 1 with "no files got indexed" and deletes its output. The plan marks each run as a member without references, which ran alone before, or not. For any other run, the part is read as empty, which the merge already accepts, only on the indexer's own report: exit 1, no output file,error: no files got indexed.as the only thing on stdout and nothing on stderr (a process that throws prints the same line, then its stack on stderr; a project whose tsconfig fails to load prints its diagnostics on stdout before the same line). Any other failure, a killed process included, stops the pass with the indexer's exit status before the merge. A later scip-typescript that words the report differently fails the pass instead of being read as empty. Only afiles: []solution config is recognised and skipped. Onmaina member without references that matches no file already fails the pass, and still does.package.jsonsearch at a project argument that names a directory, and a reference arrives as one. A project reached through a directory reference that has references of its own now runs through its generated config, a file, so a file of it with nopackage.jsonbetween it and that directory gets the package above that directory instead of an anonymous one. typescript-eslint references configs by file; the repository from The TypeScript tier cannot index a large monorepo through its root tsconfig, and every delta repeats the full cost #1678 has no references.jsconfig.json(scip-typescript adds compiler options by that name) and a project outside the checkout run as they are and still index their own references.Compatibility, rollout and rollback
Tests
tests/unit/test_run_typescript_delta_umbrella.py::test_full_pass_indexes_each_project_of_a_shared_closure_once: an umbrella with memberspackages/appandpackages/lib, whereappreferenceslibandpackages/app/tools, which no member names. The stub indexer follows references as scip-typescript 0.4.0 does and writes one document per project it indexes. Each tsconfig is indexed once,appthrough its generated config; the merged index holds the documents ofapp,app/toolsandlib;git status --ignoredis empty afterwards. Onmainit fails:libis indexed twice.test_run_typescript_delta_umbrella.py::test_delta_indexes_the_closure_of_the_selected_member_only: an edit inapprunsappandtools, notlib, and mergesapp's andtools' documents; an edit inlibrunslibalone. Fails onmain, whereapp's process also indexeslib.test_run_typescript_delta_umbrella.py::test_a_referenced_project_that_matches_no_file_does_not_fail_the_pass:appreferencesshared, whoseincludematches no file. The stub indexer prints 0.4.0's "no files got indexed" line, exits 1 and writes no output for a process that indexed no document. The pass completes, onlyappis indexed and merged, and the checkout is clean. It fails without the empty-run rule.test_run_typescript_delta_umbrella.py::test_a_referenced_indexer_killed_before_its_output_fails_the_pass: the stub prints the report line, then exits 137 before writing forpackages/app/tools, which no member names. The pass exits 137 and the converter is not called. Before the confirmed-empty rule the pass read that run as empty and converted (DID NOT RAISE CalledProcessError).test_run_typescript_delta_umbrella.py::test_a_referenced_project_whose_tsconfig_fails_to_load_fails_the_pass: the stub printserror TS5023: Unknown compiler option 'bogusOption'., a blank line and the report line forpackages/app/tools, then exits 1. The pass exits 1 and the converter is not called. With the report line alone as the test, the pass read that run as empty.test_run_typescript_delta_umbrella.py::test_a_tracked_file_with_the_generated_config_name_is_left_as_it_is: a committedpackages/app/.scip-norefs.tsconfig.jsonis byte-identical after a full pass, the checkout is clean, and the merged documents are unchanged. Before the fresh name the harness overwrote it and the exit hook deleted it (FileNotFoundError).tests/unit/test_scip_ts_projects.py, nine tests for the plan: the typescript-eslint layout (a/tsconfig.build.jsonreferencesb,a/tsconfig.spec.jsonreferencesa's build config) gives three runs,bfor itself only, and the per-member merge order; a root-level member skips its reference to a package member and keeps the root-level config it references; a reference with anincludeoutside its directory, or anextendsthat cannot be found, still runs; members without references keep their runs and get no generated file; the generated config is{"extends": "./tsconfig.build.json"}, beside the config it extends under a fresh name; afiles: []config is walked and not run; ajsconfig.jsonruns as it is; a plan that raises midway removes the configs it already wrote. All fail onmain, which has no plan.a1faa174,run_typescript_delta.shinDELTA_OUTmode frommainand from this branch, for the full pass and for the delta in the table: every file entry of the delta (path, symbols, edges) is identical, and the checkout is clean after each run.test_scip_ts_projects.py,test_run_typescript_delta_umbrella.py,test_run_typescript_delta_projects.py,test_scip_merge_indexes.py,test_scip_ts_paths.py,test_scip_harness_windows.py,test_scip_harness_checkout_path.py,test_code_scip_ts_delta_worker.py,test_scip_to_delta_cli.py,test_tunable_constants.pyandtest_public_copy.py: 147 passed.ruff check,ruff format --check,bash -n,shfmt -d, the function-length gate andscripts/gates/mypy_gate.pypass; mypy onscip_ts_projects.pyreports the same five errors as onmain. The full unit suite was not run here; CI runs it.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code wrote the diff and the tests. Checked: I reviewed the diff and its tests; the runs listed under Tests are the agent's.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make test-unitand applicable integration results are reported by CI; a full local run is not required before pushing.main; no merged migration is edited: no migration.hooks/,lib/,bin/,skills/,.mcp.json, the Codexplugin-defaults.json) bumps both plugin manifests' version: no plugin file changed.npm --prefix frontend run build) and its tests pass, iffrontend/changed: it did not.docs/describe the system as it now is, and this description names any operator steps and wire changes: thescip-typescriptrow indocs/architecture/code-index-architecture.mdsays each project of the closures is indexed once.tests/unit/test_public_copy.py).git commit -s), as CONTRIBUTING.md asks.Note
Medium Risk
Changes SCIP TypeScript harness orchestration and failure semantics for indexer subprocesses; output is intended to match prior merges but regressions would affect symbol/edge freshness without obvious wire changes.
Overview
Replaces one
scip-typescriptprocess per umbrella member with a planned set of runs that indexes each project in the members' reference closures exactly once, while keeping merge output identical to the old per-member behavior.The harness now calls
scip_ts_projects.py plan, which walksreferenceslike the indexer, deduplicates projects, skips runs whose documents no member would keep, and emits temporary.scip-norefs.*tsconfigs (extend the real config withoutreferences) so referenced projects are not re-walked inside every member process.run_typescript_delta.shexecutes that plan, merges with the same per-member ordering as before, and treats only confirmed "no files got indexed" empty runs as harmless.scip_merge_indexes.pynow uses sharedscope_specificityfrom the planner. Architecture docs and unit/integration tests cover closures, deltas, empty vs failed indexer exits, and cleanup of generated configs.Reviewed by Cursor Bugbot for commit 638fc8d. Bugbot is set up for automated code reviews on this repo. Configure here.