Skip to content

fix(ci): unbreak typecheck on the native-embed import (#79 regression)#81

Merged
th3-br41n merged 1 commit into
mainfrom
fix/native-embed-ts-import
Jul 3, 2026
Merged

fix(ci): unbreak typecheck on the native-embed import (#79 regression)#81
th3-br41n merged 1 commit into
mainfrom
fix/native-embed-ts-import

Conversation

@th3-br41n

Copy link
Copy Markdown
Contributor

Main CI is red since #79 (embedding model) merged — this fixes it.

Cause

#79 added search/local-embedder.ts importing @brainstorm/native-embed, whose generated index.d.ts only exists after the heavy ONNX-Runtime build. build:native-embed is opt-in (kept out of the default build:native / CI verify so normal CI stays fast), so a fresh checkout's tsc --noEmit failed on the missing declaration:

local-embedder.ts(123,32): error TS7016: Could not find a declaration file for module '@brainstorm/native-embed'

(ubuntu-22.04 + windows-2022 Verify jobs.)

Fix

Resolve the specifier through a const + /* @vite-ignore */ — the same opaque-dynamic-import pattern storage/sqlite.ts already uses for bun:sqlite / better-sqlite3. The module is cast to Partial<EmbedNative> at the call site regardless, so no type info is lost, and runtime resolution + graceful-degrade are unchanged. This avoids committing a build-generated file or compiling ONNX Runtime in every CI run.

Verified: tsc --noEmit passes with the native-embed .node/index.js/index.d.ts all absent (simulating a fresh CI checkout).

🤖 Generated with Claude Code

PR #79 added `local-embedder.ts` importing `@brainstorm/native-embed`, whose
generated `index.d.ts` only exists after the heavy ONNX-Runtime build. The
default `build:native` + CI `verify` deliberately skip `build:native-embed`
(opt-in, keeps CI fast), so `tsc --noEmit` on a fresh checkout failed on the
missing declaration — reddening main on ubuntu + windows.

Fix: resolve the specifier through a `const` + `/* @vite-ignore */`, the same
opaque-dynamic-import pattern `storage/sqlite.ts` uses for `bun:sqlite` /
`better-sqlite3`. The module is cast to `Partial<EmbedNative>` at the call site
anyway, so no type information is lost; typecheck no longer demands the
build-generated declaration, and runtime resolution is unchanged (graceful
degrade to lexical-only if the addon is absent). Verified: `tsc --noEmit` green
with NO native-embed artifacts on disk.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@th3-br41n th3-br41n merged commit ac02faa into main Jul 3, 2026
3 checks passed
@th3-br41n th3-br41n deleted the fix/native-embed-ts-import branch July 3, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant