Commit 633efba
authored
feat(native): port full-build structure computation to Rust (#937)
* feat(native): port full-build structure computation to Rust
The native Rust orchestrator only handled the small-incremental fast
path for structure computation. Full builds and large incremental
builds fell back to JS, requiring a DB round-trip through
reconstructFileSymbolsFromDb() to reload all nodes.
Add build_full_structure() to the Rust structure module that handles:
- Cleanup of previous structure data (scoped for incremental)
- Directory node insertion from discovered dirs + file paths
- Contains edges (dir→file, parent→child)
- File metrics (line count, symbol count, imports, exports, fan-in/out)
- Directory metrics (file count, symbol count, fan-in/out, cohesion)
Set structure_handled=true unconditionally so the JS fallback path
is never triggered for structure computation.
Closes #935
* fix(structure): load all file paths from DB in incremental mode (#937)
The incremental path of build_full_structure deleted all contains edges
from affected directories but only re-inserted edges for files in the
partial file_symbols set. Unchanged files in those directories
permanently lost their dir->file containment edges until the next full
rebuild. Directory metrics (file_count, symbol_count, cohesion) were
also undercounted for the same reason.
Fix: load existing file nodes from DB for affected directories before
re-inserting contains edges and computing directory metrics, ensuring
unchanged files retain their structural relationships.
Impact: 3 functions changed, 2 affected
* fix(build): remove dead structure_scope field (#937)
Since structure_handled is now unconditionally true, the JS structure
fallback never runs and structure_scope is never read. Remove the field
from BuildPipelineResult and the corresponding JS type/usage.
Impact: 2 functions changed, 5 affected
* fix(structure): restore dir->dir containment edges for unchanged sibling subdirs (#937)
During large-incremental builds, cleanup_previous_data deletes all
contains edges from affected ancestor directories. The dir->dir edge
loop only iterated over all_dirs (ancestors of changed files), so
unchanged sibling subdirectories lost their parent->child edges
permanently until the next full rebuild.
Add load_child_dirs_in_affected() to query existing directory nodes
from the DB whose parent is in the affected set, and re-insert their
containment edges after the main dir->dir loop completes.
Impact: 2 functions changed, 2 affected1 parent 9cd5276 commit 633efba
3 files changed
Lines changed: 701 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | 75 | | |
81 | | - | |
82 | | - | |
83 | | - | |
| 76 | + | |
| 77 | + | |
84 | 78 | | |
85 | 79 | | |
86 | 80 | | |
| |||
181 | 175 | | |
182 | 176 | | |
183 | 177 | | |
184 | | - | |
185 | 178 | | |
186 | 179 | | |
187 | 180 | | |
| |||
373 | 366 | | |
374 | 367 | | |
375 | 368 | | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
376 | 384 | | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | 385 | | |
382 | 386 | | |
383 | 387 | | |
| |||
489 | 493 | | |
490 | 494 | | |
491 | 495 | | |
492 | | - | |
493 | | - | |
| 496 | + | |
494 | 497 | | |
495 | 498 | | |
496 | 499 | | |
| |||
0 commit comments