-
Notifications
You must be signed in to change notification settings - Fork 4
bug(native): SQLITE_CORRUPT during incremental rebuild — breaks benchmark #715
Description
Summary
The native (Rust) engine crashes with SQLITE_CORRUPT during 1-file incremental rebuilds, causing the benchmark worker to exit with code 1 and producing "native": null in benchmark results since v3.6.0.
Evidence
From CI workflow run #538, build-benchmark job logs:
[codegraph] Using native engine (v3.6.0)
[codegraph] Parsed 514 files (0 skipped)
[codegraph] Graph built: 13184 nodes, 25423 edges
[native] Benchmarking no-op rebuild...
...
Then during the 1-file incremental rebuild:
at runPipelineStages (file:///tmp/codegraph-bench-ulUFNK/node_modules/@optave/codegraph/dist/domain/graph/builder/pipeline.js:176:11)
at async buildGraph (file:///tmp/codegraph-bench-ulUFNK/node_modules/@optave/codegraph/dist/domain/graph/builder/pipeline.js:230:9)
at async file:///home/runner/work/ops-codegraph-tool/ops-codegraph-tool/scripts/benchmark.ts:168:15 {
code: 'SQLITE_CORRUPT'
}
Node.js v22.22.1
[fork] native worker exited with code 1
Impact
- PR docs: update build performance benchmarks (3.6.0) #712 (build benchmarks) and PR docs: update incremental benchmarks (3.6.0) #714 (incremental benchmarks) both report
native: nullfor v3.6.0 - README now only shows WASM metrics, losing the native comparison that existed in v3.4.1
- The native full build completes fine (25,423 edges); corruption only happens during incremental rebuild
Additional context
Edge count discrepancy: native reports 25,423 edges vs WASM 25,425 (−2). This parity gap may be related to the corruption — the native engine may be writing slightly different graph structures that become inconsistent on incremental update.
The no-op rebuild appears to work (it ran 3 times before the 1-file rebuild), so the corruption is triggered specifically when re-parsing a modified file and running pipeline stages on the changed subset.
Reproduce
npx codegraph build . --engine native
# modify any file
npx codegraph build . --engine native --incrementalExpected
Native incremental rebuild should succeed without SQLITE_CORRUPT, matching WASM behavior.