Skip to content

feat(#678): migrate C++ indexing to Rust-owned engine - #687

Merged
jununfly merged 2 commits into
mainfrom
feat/rust-owned-cpp
Aug 16, 2026
Merged

feat(#678): migrate C++ indexing to Rust-owned engine#687
jununfly merged 2 commits into
mainfrom
feat/rust-owned-cpp

Conversation

@jununfly

Copy link
Copy Markdown
Owner

Summary

Migrates C++ indexing from the TypeScript-owned tree-sitter extractor to the Rust core engine, completing the Rust-owned language migration roadmap for C/C++ (Issue #678).

Changes

Rust Core (crates/zcodegraph-core/src/lib.rs)

  • Expanded resolve_same_file_exact_callable_refs language filter to include c | cpp (was JS/TS-only) — this was the root cause of 0 call edges for C++ files

TypeScript Shell

  • src/indexing/rust-hybrid-contract.ts: Added 'cpp' to RUST_HYBRID_RUST_OWNED_LANGUAGES — C++ files now route to Rust engine
  • src/extraction/languages/index.ts: Removed import { cppExtractor } and cpp: cppExtractor from extractor map
  • src/extraction/grammars.ts: Removed cpp: 'tree-sitter-cpp.wasm' from WASM_GRAMMAR_FILES
  • src/extraction/index.ts + src/extraction/index-stages.ts + src/index.ts: Removed 4 neededLanguages.push('cpp') auto-load blocks
  • src/extraction/tree-sitter.ts: Removed 'cpp' from STATIC_MEMBER_LANGS
  • src/extraction/languages/c-cpp.ts: Deleted — TS-owned C++ extractor fully replaced by Rust core

Tests

  • __tests__/rust-index-engine-cli-fallback.test.ts: .h boundary test — widget.h now routes to Rust (was TS fallback), engineByLanguage changed from { cpp: 'typescript' } to { cpp: 'rust' }
  • __tests__/rust-index-engine-cli-language-smoke.test.ts: Added C++ smoke test verifying symbols (Widget class, app namespace, main function, imports) and call edges (main → render) and hybrid metadata (cpp: 'rust')

Documentation

  • README.md: Language support table — C++ moved from TS-indexed to Rust-owned
  • docs/SEARCH_QUALITY_LOOP.md: Fixed dead links to c-cpp.ts → Rust core paths
  • docs/designs/plan-artifact-consolidated-closeout.md: Added PRD: Migrate C++ baseline extraction to Rust-owned indexing #678 closeout section with durable decisions
  • docs/benchmarks/2026-07-13-rust-owned-cpp-fmt-validation.md: fmtlib/fmt corpus validation evidence (71 files, 500 nodes, healthy fallback)
  • CHANGELOG.md: Added Unreleased entry

Validation

  • cargo test: 6/6 passing
  • fmtlib/fmt corpus: 71 files indexed, 500 C++ nodes extracted, fallbackState=healthy, zero TS fallback
  • CLI language smoke: C++ symbols + call edges verified through Rust engine

Closes #678

C++ files now route to the Rust core engine instead of the
TypeScript-owned tree-sitter extractor. This completes the Rust-owned
language migration roadmap for C/C++.

Changes:
- Rust core: expand resolve_same_file_exact_callable_refs language
  filter to include c | cpp (was JS/TS-only)
- TS shell: add 'cpp' to RUST_HYBRID_RUST_OWNED_LANGUAGES
- Remove TS-owned C++ extractor (src/extraction/languages/c-cpp.ts)
- Remove cpp grammar from WASM_GRAMMAR_FILES and auto-load logic
- Remove 'cpp' from STATIC_MEMBER_LANGS
- Update .h boundary test: widget.h now routes to Rust (was TS fallback)
- Add C++ language smoke test (symbols, call edges, hybrid metadata)
- Update README language support table (C++ → Rust-owned)
- Fix dead links to c-cpp.ts in SEARCH_QUALITY_LOOP.md
- Add fmtlib/fmt corpus validation evidence (71 files, 500 nodes)
- Add #678 closeout section to plan-artifact-consolidated-closeout.md
- Update CHANGELOG.md

Validation:
- cargo test: 6/6 passing
- fmtlib/fmt corpus: 71 files indexed, 500 C++ nodes, healthy fallback
- No TS fallback for C++ files
C++ is now fully Rust-owned and no longer needs a tree-sitter WASM
grammar entry. However, removing cpp from WASM_GRAMMAR_FILES broke
the Record<GrammarLanguage, string> type constraint because GrammarLanguage
still included 'cpp'.

Changes to src/extraction/grammars.ts:
- Exclude 'cpp' from GrammarLanguage type (no WASM grammar needed)
- Add 'cpp' to isLanguageSupported() returning true (Rust-owned,
  prevents files from being marked unsupported and skipped before
  reaching rust-hybrid routing)
- Add 'cpp' to getSupportedLanguages() return array
@jununfly
jununfly merged commit faf1a28 into main Aug 16, 2026
3 checks passed
@jununfly
jununfly deleted the feat/rust-owned-cpp branch August 16, 2026 13:02
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.

PRD: Migrate C++ baseline extraction to Rust-owned indexing

1 participant