feat(code-graph-incremental): typescript + rust support

What does this MR do and why?

The last two rule files: TypeScript (which also serves TSX and JavaScript) and Rust. With them every language the reference supports is in the crate, and this MR then works the Rust and TypeScript gaps down on top: crate roots and workspaces, scoped supertypes, return types, inline modules, type parameters, Deref, tsconfig path aliases. Tests the engine still fails are skipped with the gap written beside them. Nothing is wired to the CLI or server yet.

Where the suites stand

fixtures_incremental/, 257 suites, 1582 tests. A suite counts as passing only when none of its tests are skipped.

Language Suites Tests Left to do
bash, c, cpp, csharp, go, jvm, kotlin, lua, php, ruby, scala, swift, zig 104/104 819/819 –
python 42/46 189/199 exact edge counts through if/elif/try branches (6), chained annotated return types, nested-class containment, link.builtins, dotted import a.b as c alias
java 17/20 129/133 deep call chains through return types, inheritance across packages, annotation imports, duplicate edges
elixir 3/4 16/18 Foo.greet -> Baz.hello across files, exact edge count
cross_language 1/2 7/8 nested-class containment edge
rust 30/40 162/184 field-sensitive local flow (13), macros (4, out of scope), UFCS argument dispatch, colliding trait-impl fqns and alias-based impl names (old-pipeline conventions), external ImportedSymbol row shapes
typescript 17/22 94/116 export-proxy Definitions (7, by decision), GitLab monolith aliases ee/ jh/ ee_else_ce ~ (5), Vue SFC (3), external namespace ImportedSymbol rows, type-only exclusions
javascript 4/11 39/68 Vue SFC (8), module.exports = name marking an existing def as default export (7), export-proxy Definitions (6, by decision), monolith aliases (3), CommonJS fallbacks and fqn prefixing (5)
vue 0/3 0/19 Vue SFC extraction (13), export-proxy Definitions (6, by decision)
next 0/3 14/30 Next.js route conventions (7), export-proxy Definitions (4, by decision), JSX through re-export chains
react 0/2 12/18 JSX components through namespace default and star re-export chains (3), type-only exclusions
Total 218/257 1451/1582 131 skipped

What the remaining 131 group into

Category Tests Kind of work
Old pipeline synthesized a Module / export-proxy Definition per file 23 None. The incremental engine points imports at the concrete definition; these assertions stay as a record of the difference
Vue SFC extraction 24 Feature: <script> / <script setup> blocks as TypeScript, template component references
Field-sensitive local flow 13 Engine: track record fields and tuple positions through locals, destructuring and reassignment. Rust fixtures, but the same SSA change serves every language
GitLab monolith and framework path conventions 15 Rules and config: ee/, jh/, ee_else_ce, ~ aliases; Next.js route files
CommonJS module.exports = existing as default export 7 Rules: JavaScript
Branch and chain precision ~12 Engine: exact edge counts through if/elif/try, chained return types across annotations (python, java, elixir)
JSX through namespace / star re-export chains 3 Resolver: follow export * from and import * as ns for component references
Rust macros 4 Out of scope
Old-pipeline conventions and row shapes ~30 Case by case: ImportedSymbol rows for external crates and namespaces, type-only exclusions, colliding-method fqns, UFCS dispatch

Relates to #1284. Reference implementation: !2454 (closed).

Testing

cargo nextest run -p integration-tests-codegraph: incremental_suites 260/260 (was 177), suites 247/247 unchanged. cargo test -p code-graph-incremental: 52. The Rust incremental suite (rust/incremental/manifest_and_module.yaml) is the first to exercise the parse_files manifest branch of Prepare, which had no test since !2629 (merged).

Performance Analysis

No runtime change: nothing calls this crate yet.

  • This merge request does not introduce any performance regression. If a performance regression is expected, explain why.
Agent context: long-form analysis, file-by-file walkthroughs, profiler output, alternatives considered

What lands

crates/code-graph-incremental/langs/{typescript,rust}.yaml
crates/code-graph-incremental/src/treesitter.rs           lang_yaml: TypeScript | Tsx | JavaScript -> typescript.yaml; Rust
crates/integration-tests-codegraph/fixtures_incremental/{typescript,javascript,vue,react,next,rust}/
crates/integration-tests-codegraph/fixtures_incremental/cross_language/file_reasons.yaml   (pipeline: typescript)
crates/integration-tests-codegraph/src/incremental.rs     `pipeline: generic` means auto-detect, as in the old runner

Rule files and fixtures are copied from !2454 (closed). The skips were placed by running every suite and marking each failing test; the reasons group as:

Skipped tests Gap
32 Rust: trait impl attribution and cross-file trait resolution
31 Vue SFC extraction is not implemented
30 tsconfig/webpack path aliases, barrels, export proxies, namespace re-exports
27 Rust: module path resolution (crate::, super::, mod.rs, use, re-exports)
20 Rust: enum variant, tuple field and extern item definitions
19 JSX component calls and Next.js route conventions
13 the old pipeline synthesized a module Definition per file
13 Rust: Cargo workspace manifests, crate-qualified FQNs, path dependencies
9 CommonJS require
7 Rust: operator, await, try and record-expression desugaring
6 span contract changed on main (b24987e0)
18 smaller groups: macros, cfg, field-sensitive flow, imported-symbol fallback

Rust is the language with the most ground to make up (26 of 39 suites touched). That is its own effort on rust.yaml, with these fixtures as the target.

MR stack

MR Contents
!2620 (merged) !2627 (merged) !2629 (merged) !2631 (merged) !2633 (merged) !2638 (merged) !2641 (merged) !2644 (merged) !2648 (merged) !2652 (merged) merged: runner through language families
11 (this) TypeScript family and Rust
12 orbit index --engine incremental, full index through the existing DuckDB sink
13 snapshot next to the DuckDB file, changed paths from git, incremental CLI
14 default flip per language; old pipeline and its fixtures retire

%{all_commits}

Edited by Michael Usachenko

Merge request reports

Loading
Loading