fix(ci): unbreak typecheck on the native-embed import (#79 regression)#81
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Main CI is red since #79 (embedding model) merged — this fixes it.
Cause
#79 added
search/local-embedder.tsimporting@brainstorm/native-embed, whose generatedindex.d.tsonly exists after the heavy ONNX-Runtime build.build:native-embedis opt-in (kept out of the defaultbuild:native/ CIverifyso normal CI stays fast), so a fresh checkout'stsc --noEmitfailed on the missing declaration:(ubuntu-22.04 + windows-2022
Verifyjobs.)Fix
Resolve the specifier through a
const+/* @vite-ignore */— the same opaque-dynamic-import patternstorage/sqlite.tsalready uses forbun:sqlite/better-sqlite3. The module is cast toPartial<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 --noEmitpasses with the native-embed.node/index.js/index.d.tsall absent (simulating a fresh CI checkout).🤖 Generated with Claude Code