Skip to content

Index TypeScript monorepos by member project, not the umbrella root - #1782

Merged
zlareb1 merged 18 commits into
ClickHouse:mainfrom
ZYZ666-RGB:fix-1678-ts-umbrella-delta
Dec 1, 2026
Merged

zlareb1 merged 18 commits into
ClickHouse:mainfrom
ZYZ666-RGB:fix-1678-ts-umbrella-delta

Conversation

@ZYZ666-RGB

@ZYZ666-RGB ZYZ666-RGB commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Closes: #1678

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in a release)

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 tier expands an umbrella root tsconfig to its member projects, and a delta indexes only the projects that contain the changed files.

Why

Loading a solution-style root tsconfig (project references only) makes scip-typescript hold every member project in one V8 heap. On a large monorepo that OOMs, and even after listing scip_ts_projects by hand every delta re-indexes the full list because the changed-file list only bounds the converted output.

Scope and risk

The change is in run_typescript_delta.sh and a new helper, scripts/scip_harness/scip_ts_projects.py. A root tsconfig is treated as an umbrella only when it has references and no files of its own (files: [], or an empty include). Nested umbrellas are expanded. A regular root project is unchanged.

On a delta, only members that own a changed or deleted path are indexed. A change to a root config (package.json, tsconfig*.json, workspace manifests) or any lockfile falls back to the full member set. TypeScript changes that sit outside every named project also fall back, so the converter still sees them. The worker and watermark are unchanged; discovery happens from the checkout at git_head.

This was not measured against OpenClaw in this PR (that run needs the scip-typescript binary and the full tree). The tests use a stub indexer and check which project directories are passed to it.

Compatibility, rollout and rollback

  • Wire: none.
  • Operator steps: none. An existing scip_ts_projects list still works and is also filtered on deltas. Repositories with an umbrella root and the setting unset start indexing member projects automatically.
  • Rollback: revert the PR; no stored data or migrations.

Tests

uv run --extra dev python -m pytest -q tests/unit/test_scip_ts_projects.py tests/unit/test_run_typescript_delta_umbrella.py tests/unit/test_run_typescript_delta_projects.py — 10 passed. ruff check and ruff format passed on the new files.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Grok Bot. I checked the umbrella detection against a solution-style files: [] root, the delta filter (including prefix isolation and lockfile fallback), the existing named-project harness test, and that a regular root tsconfig is not expanded.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Local format, lint, type checks and focused tests pass. The full make test-unit and applicable integration results are reported by CI; a full local run is not required before pushing.
  • Generated files are regenerated in this PR, not by hand: the SDK op tables, docs/reference/configuration.md and the docs/reference/ tables (python scripts/codegen/docs_reference.py), the reach manifest, schemas/schema.sql (make schema-dump), the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py) and the standalone skill bundles (python3 scripts/codegen/standalone_skills.py).
  • A new migration is additive and numbered after the latest on main; no merged migration is edited.
  • A behaviour change to any file a plugin ships (hooks/, lib/, bin/, skills/, .mcp.json, the Codex plugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.
  • The frontend builds (npm --prefix frontend run build) and its tests pass, if frontend/ changed.
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers; the history goes in this description (tests/unit/test_public_copy.py).
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.
  • I signed the Contributor License Agreement (CLA) if CLA assistant requested a signature.

Note

Medium Risk
Changes indexing scope and merge semantics for the TypeScript compiler tier; incorrect ownership could drop or duplicate symbols in monorepos, but regular single-project repos and watermarks are unchanged.

Overview
The TypeScript SCIP harness stops treating umbrella (solution-style) roots as one workspace. It discovers member projects from tsconfig references via scip_ts_projects.py, runs scip-typescript once per member (isolating V8 heap), and merges partial indexes with scip_merge_indexes.py using directory ownership so project-reference spillover and subset rebuilds do not clobber other packages.

On delta passes, only members that own changed TypeScript or member config are indexed; root lockfiles, shared configs, unowned .ts paths, or config-only windows widen to all members and convert full member indexes (keeping deletions) instead of bounding with --changed-files.

Architecture docs for scip-typescript are updated; unit tests cover discovery, merge ownership, and harness behavior including regular non-umbrella roots unchanged.

Reviewed by Cursor Bugbot for commit d848bd1. Bugbot is set up for automated code reviews on this repo. Configure here.

Expand a solution-style root tsconfig to its referenced projects so
scip-typescript does not load the whole graph in one process. On a
delta, index only the projects that contain the window's files, and
fall back to the full set when a shared config or lockfile changes.

Closes ClickHouse#1678

Signed-off-by: yuzhou <1991039819@qq.com>
@vercel

vercel Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
loom-docs Ready Ready Preview Dec 1, 2026 10:42am UTC
loom-telemetry Ready Ready Preview Dec 1, 2026 10:42am UTC

Request Review

@cla-assistant

cla-assistant Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@zlareb1 zlareb1 self-assigned this Nov 30, 2026

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The harness skips the shared-config fallback and falls back to the root on valid inline JSONC. I reproduced both with the stub indexer. The existing threads cover those two cases. Shared config · Inline JSONC

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The format job rejects the same docs/pages/adoption.astro assignment on this CI merge and on clean main. The pinned formatter passes with the existing repair. PR job · Main job · Repair #1706

Preserve explicit tsconfig file references through discovery and the
indexer invocation. Parse JSONC with string-aware comment stripping so
inline comments and paths globs like @/* still expand to members. Pass
the full delta window (not only TypeScript globs) into the project
filter so a shared config change falls back to every member, and do the
same when any changed TypeScript path is unowned.

Signed-off-by: yuzhou <1991039819@qq.com>
@ZYZ666-RGB

Copy link
Copy Markdown
Contributor Author

Pushed 315c4d7 to address the review notes: string-aware JSONC parsing, passing the full delta window into the shared-config fallback, preserving explicit tsconfig file references, and falling back when any changed TypeScript path is unowned. Added unit and harness coverage for each case.

On the format job: agreed this is the same docs/pages/adoption.astro rejection that already fails on clean main, as noted in the existing repair. I left that file alone here.

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 — scripts/scip_harness/run_typescript_delta.sh:142 still sends every member to one indexer process on a full pass. The pinned indexer already walks root references one at a time and shares its source-file cache across them. Passing those same members as arguments retains the same cache and heap, so the change leaves the reported out-of-memory path in place. Bound the cache or isolate member runs, and validate the full pass on a monorepo that hits the current limit. Index loop · Source-file cache

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conflict resolver's attestation test fails at the same superseder assertion on this run and on clean main with ClickHouse 26.11.5.8. Repair #1781 keeps the timestamp assertion at equal standing and tests lower standing separately. PR job · Main job · Repair

scip-typescript shares its source-file cache across every target in one
process, so a full umbrella pass that passed every member as arguments
kept the same heap growth as indexing the root. Run one member per
process and merge the indexes.

Discover and filter print one path per line so a member directory with a
space is not split in the shell.

Signed-off-by: yuzhou <1991039819@qq.com>
@ZYZ666-RGB

Copy link
Copy Markdown
Contributor Author

Pushed c0d7465 for the notes from the 06:35 PT review.

  • A full pass now starts one scip-typescript process per member and merges the resulting indexes, so the source-file cache does not accumulate across the umbrella. The 24-member fixture asserts one target per process. I did not run the real indexer on a monorepo large enough to hit the current memory limit.
  • Discover and filter print one path per line, so a member directory with a space survives both the full and delta passes.

The format job, the conflict-resolver attestation, and the other failures that also fail on clean main are unchanged; I left those alone here.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 — A regular root tsconfig produces an empty index. I reproduced this on the full pass and on a delta that edits one TypeScript file. The harness exits successfully with zero indexer calls in both cases. Restore the workspace invocation when no member list is configured and cover both passes with the existing stub. Existing thread

All 21 focused tests passed, including the spaced path, mixed shared-config window, and one indexer process per member.

An empty member list wrote a zero-byte index and skipped scip-typescript,
so a checkout with an ordinary root tsconfig produced no compiler symbols.
Restore the workspace invocation for that case, and cover a full pass and
a one-file delta with the stub indexer.

Signed-off-by: yuzhou <1991039819@qq.com>
@ZYZ666-RGB

Copy link
Copy Markdown
Contributor Author

Pushed 7a6c9a2 (and merged current main at 11c0a52) for the empty-index note on a regular root tsconfig.

  • With no member list, a full pass and a one-file delta now invoke the indexer on the workspace instead of writing a zero-byte index.
  • Also ran ruff format on tests/unit/test_scip_merge_indexes.py and Prettier on the architecture table cell that this branch updated.

The unit-6 failure in test_every_extraction_field_has_an_explicit_content_classification (changed_files) still matches clean main, so I left it alone.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Isolated scip-typescript runs follow project references, so a
dependency's documents can appear in more than one part. Merge by
relative_path and keep the copy from the owning member.

posix_path no longer uses lstrip("./"), which was stripping the
leading dot from hidden directories such as .storybook.

Signed-off-by: yuzhou <1991039819@qq.com>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All 28 focused tests pass, including both regular-root paths. A separate probe with two explicit tsconfigs in one directory kept only the test document and dropped the app document. The existing thread covers that loss. A config-only delta also skips indexing.

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The three failures in these unit jobs reproduce on the CI base 196ef2fb1b. The extraction classification, adoption timeout, and sender census checks all pass on current main. Unit part 1 · Unit part 4 · Classification and timeout fix · Sender census fix

Explicit tsconfigs in the same directory share a project scope, so
picking an owner by filename dropped the other sibling's documents.
When the longest scope is tied, each member keeps what it emitted.

A window that only changes a shared config selected every member,
then exited before indexing because the TypeScript window was empty.
Reindex the selected members and convert the full member indexes so
module-resolution changes rebuild compiler rows.

Signed-off-by: yuzhou <1991039819@qq.com>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The root package-only window now writes a delta. A mixed window still leaves affected compiler rows behind. I also reproduced the member README rebuild with the harness stub.

A shared-config change plus a TypeScript edit indexed every member, but
the converter still received only the edited TypeScript path, so compiler
rows in the other members could stay stale. Convert the full member
indexes in that case and keep TypeScript deletions.

A non-config change inside a member, such as a README, no longer selects
that member for a full rebuild. Isolated merges also drop documents
followed through project references when the owning package is not in
the current run.

Signed-off-by: yuzhou <1991039819@qq.com>
@ZYZ666-RGB

Copy link
Copy Markdown
Contributor Author

Pushed 2c7d09a (and merged current main) for the 6:35 PM PT review.

  • A mixed window that updates a shared config and a TypeScript file still indexes every member, but conversion no longer passes --changed-files, so compiler rows in the other members are rebuilt. TypeScript deletions are still passed to the converter.
  • A member README no longer selects that package for a full rebuild.
  • Isolated merges drop documents followed through project references when the owning package is not in the current run.

The focused harness and merge tests pass. I left the CI failures that also fail on clean main alone here.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

A root-level tsconfig owns every path, so a subset rebuild that
indexes it alone could keep documents followed into other packages.
Merge now uses the full discovered member set for ownership and drops
those rows when a more specific member exists.

An unowned package.json or tsconfig no longer leaves the filter empty
while keeping the full project list, so it takes the empty-delta exit
instead of reindexing every member.

Signed-off-by: yuzhou <1991039819@qq.com>
…a-delta

Picks up ClickHouse#1871, which moved MCP places limits into settings so
test_no_new_tunable_constant no longer fails on this branch.

Signed-off-by: yuzhou <1991039819@qq.com>
@ZYZ666-RGB

Copy link
Copy Markdown
Contributor Author

Addressed the two new Bugbot notes in 6e72312:

  • A subset rebuild of a root-level tsconfig now uses the full discovered member set for ownership, so followed documents in other packages are dropped.
  • An unowned package.json / tsconfig no longer reindexes every member.

Also merged main (c24cf1d) to pick up #1871. The previous ci run on 2c7d09a (#18248, attempt 2) failed for two jobs that are not from the TypeScript harness: test_no_new_tunable_constant (module constants in server/transport/code_lean.py, moved into settings on main) and a flake in test_the_resolver_keeps_its_invariants_under_concurrent_writes (errored: 2, resolver did not settle).

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The root-level tsconfig and nested config-only paths now have coverage. The generated-tsconfig ownership finding remains on this head. The harness passes the generated config file as the indexed project and its parent directory as the known owner. The merge compares those strings and drops the member’s documents. Use the same project identity for both lists and cover a member with no original tsconfig.

The format job failed on `&& \` at the end of the line. Move the
operator to the continued line so `shfmt -d` is clean.

Signed-off-by: yuzhou <1991039819@qq.com>

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shell formatting fix leaves the generated-tsconfig ownership finding in place. A member indexed through a generated config still loses its documents when the merge compares the config path with the member directory.

Ownership compared the raw --project and --known-project strings, so a
member named dir/tsconfig.scip.json dropped every document when the
known project was dir. Compare project_scope instead.

Signed-off-by: yuzhou <1991039819@qq.com>

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The scope comparison keeps documents from a generated tsconfig. The merge still lets a broader project keep a referenced document when two narrower configs share its owning directory.

With a root tsconfig and two explicit configs under packages/app,
_preferred_owner returned None on the tie, so a root index merged
last could replace the app document. Return a longest-scope owner
so sibling configs still keep their docs and the root is dropped.

Signed-off-by: yuzhou <1991039819@qq.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit e8fbb33. Configure here.

A root scope '.' has string length 1, the same as a one-character
member directory. Treating the root as specificity 0 keeps the
member's documents even when the root is listed first.

Signed-off-by: yuzhou <1991039819@qq.com>

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The merge keeps the member document when two configs share its directory and when the owning directory has a one-character name. All 48 focused TypeScript project, harness, and SCIP merge tests pass.

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type gate rejects the streamed SCIP header adapter's dynamic annotation. The same error reproduces on clean main. Repair #1915 uses the model field annotation and keeps the header bounds.

@KaloyanNaumov

Copy link
Copy Markdown
Contributor

Thanks for taking #1678 on. After the merge we ran the member split against six repositories: a small pnpm workspace, references-style and include-style monorepos, and trees with non-UTF-8 text and file names. The follow-ups are filed separately, so each can be discussed on its own:

Each issue has its reproduction and the measurements.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The TypeScript tier cannot index a large monorepo through its root tsconfig, and every delta repeats the full cost

3 participants