Skip to content

Commit 5d2905f

Browse files
authored
fix: respect --engine wasm in pipeline guard (#819)
* fix: respect --engine wasm in pipeline guard The setupPipeline function called loadNative() unconditionally, so even with --engine wasm the Rust NativeDatabase was initialized and downstream stages entered the native fast path. Guard the call with the engine preference so loadNative() is skipped entirely when wasm is requested. * fix: guard reopenNativeDb against --engine wasm (#819) Add early return in reopenNativeDb() when engine preference is 'wasm', making the guard self-contained rather than relying solely on callers checking hadNativeDb. Also remove internal ticket reference from comment.
1 parent 592c47b commit 5d2905f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/domain/graph/builder/pipeline.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ function setupPipeline(ctx: PipelineContext): void {
134134
// Use NativeDatabase for schema init when native engine is available (Phase 6.13).
135135
// better-sqlite3 (ctx.db) is still always opened — needed for queries and stages
136136
// that haven't been migrated to rusqlite yet.
137-
const native = loadNative();
137+
// Skip native DB entirely when user explicitly requested --engine wasm.
138+
const enginePref = ctx.opts.engine || 'auto';
139+
const native = enginePref !== 'wasm' ? loadNative() : null;
138140
if (native?.NativeDatabase) {
139141
try {
140142
ctx.nativeDb = native.NativeDatabase.openReadWrite(ctx.dbPath);
@@ -216,6 +218,7 @@ function closeNativeDb(ctx: PipelineContext, label: string): void {
216218

217219
/** Try to reopen the native connection for a given pipeline phase. */
218220
function reopenNativeDb(ctx: PipelineContext, label: string): void {
221+
if ((ctx.opts.engine ?? 'auto') === 'wasm') return;
219222
const native = loadNative();
220223
if (!native?.NativeDatabase) return;
221224
try {

0 commit comments

Comments
 (0)