feat(sdk): add strict mode and explicit fallback policy to runtime bridge

This commit is contained in:
Tom Boucher
2026-05-05 19:23:39 -04:00
parent 98dd9e4afb
commit 0026065c7a
6 changed files with 79 additions and 3 deletions

View File

@@ -28,4 +28,25 @@ describe('QueryExecutionPolicy', () => {
expect(policyArg).toEqual({ preferNative: true, allowFallbackToSubprocess: false });
});
it('allows runtime override for allowFallbackToSubprocess', async () => {
const run = vi.fn().mockResolvedValue({ ok: true });
const policy = new QueryExecutionPolicy({ run } as never);
setTransportPolicy('verify.path-exists', { preferNative: true, allowFallbackToSubprocess: true });
await policy.execute({
legacyCommand: 'verify.path-exists',
legacyArgs: [],
registryCommand: 'verify.path-exists',
registryArgs: [],
mode: 'json',
projectDir: '/tmp/project',
preferNativeQuery: true,
allowFallbackToSubprocess: false,
});
const [, policyArg] = run.mock.calls[0];
expect(policyArg).toEqual({ preferNative: true, allowFallbackToSubprocess: false });
});
});