Commit 1101d24
authored
fix(native): keep nativeDb open through finalize for correct build_meta (#784)
* fix(native): keep nativeDb open through finalize for correct build_meta (#751)
nativeDb was closed before finalize(), making persistBuildMetadata fall
back to the JS (better-sqlite3) path. After native WAL truncation the JS
connection's page cache was stale, causing the setBuildMeta write to
silently fail and leaving stale version/engine metadata. This broke
incremental builds by triggering a spurious "version changed" full
rebuild on every subsequent run.
Keep nativeDb alive through finalize so all metadata writes, advisory
checks, and count queries use the native path. Refresh the JS DB
beforehand so it has a valid page cache if finalize falls back to JS.
* fix(native): use npm version for engine_version in build_meta (#751)
engine_version was set to ctx.engineVersion which comes from the Rust
crate's CARGO_PKG_VERSION via native.engineVersion(). When the Rust
crate version drifts from the npm package version (e.g. Cargo.toml not
bumped during release), build_meta stores the wrong version. Use
CODEGRAPH_VERSION (the npm package.json version) for both
codegraph_version and engine_version since the native engine is
distributed as part of the npm package.
Also strengthens the #751 regression test to assert engine_version
equals the npm version and uses a full rebuild to ensure metadata is
written for the small test fixture.1 parent 2848205 commit 1101d24
3 files changed
Lines changed: 41 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
303 | | - | |
304 | | - | |
305 | | - | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
306 | 310 | | |
307 | 311 | | |
308 | 312 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
477 | 477 | | |
478 | 478 | | |
479 | 479 | | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
480 | 512 | | |
481 | 513 | | |
482 | 514 | | |
| |||
0 commit comments