Skip to content

feat(search): first-run model-download progress UX (11.3)#89

Merged
th3-br41n merged 1 commit into
mainfrom
feat/11.3-download-progress
Jul 3, 2026
Merged

feat(search): first-run model-download progress UX (11.3)#89
th3-br41n merged 1 commit into
mainfrom
feat/11.3-download-progress

Conversation

@th3-br41n

Copy link
Copy Markdown
Contributor

What

The on-device semantic-search model (bge-small-en-v1.5, ~130 MB) downloads on first use inside the @brainstorm/native-embed addon. Until now that happened silently — a fresh install spent ~a minute fetching weights with zero feedback, indistinguishable from "semantic search is broken". This surfaces a live status in Settings → Search:

Idle (will download on first use) → Downloading (live byte %) → Ready, plus Failed (retryable) and Absent (native addon unavailable → lexical-only).

How (vertical slice)

  • native-embed (Rust)embedderInit(cacheDir, onProgress?). The download now streams in chunks and emits per-file byte progress via a NonBlocking ThreadsafeFunction (CalleeHandled=false → clean (progress) callback), coalesced to ~1 MB steps (~130 events for the model file, not thousands). The SHA256 pinning + size cap are unchanged — bytes are still verified before ONNX Runtime sees them. Backward-compatible: an older .node without the param simply omits ticks (the bar shows indeterminate).
  • embedder-status.ts — a pure reducer (phase + clamped/rounded percent) that folds the ticks. Fully unit-tested, no native/vault/network needed.
  • FastembedEmbedder emits status through an onStatus sink as init starts / progresses / resolves / fails.
  • search:stats carries the status; the panel renders a status card and polls (1 s) only while downloading.

a11y

The progress bar is decorative (aria-hidden) — the "Downloading … X%" detail text is the assistive-tech source, matching the existing coverage-bar pattern in the same panel. Keyboard/SR path unchanged (read-only diagnostic surface).

Tests

+29: status reducer (10) · seam progress/status forwarding (4) · handler semantic field (3) · card render across all phases (6) · plus the existing embed/degrade suite updated for the new init arg. tsc (packages + apps) + lint + size clean; shell renderer + main bundle clean.

Native addon rebuilt + smoke-checked (embedDim/exports intact, generated .d.ts matches the seam). The live download tick path needs a real HuggingFace fetch to exercise end-to-end — same verification posture as the 11.3 packaging tail (#84): compile + signature-match + smoke, with the tick-folding + rendering covered by fakes.

Remaining 11.3 tails

Real-Electron ANN latency/recall + on-disk bench.

🤖 Generated with Claude Code

The ~130 MB `bge-small-en-v1.5` embedding model downloads on first
semantic-search use inside the native-embed addon — until now silently,
so a fresh install spent a minute fetching weights with zero feedback.
Surface a live status in Settings → Search: Idle → Downloading (byte %) →
Ready, plus Failed (retryable) and Absent (lexical-only) states.

- native-embed: `embedderInit(cacheDir, onProgress?)` — the download now
  streams in chunks and emits per-file byte progress via a NonBlocking
  ThreadsafeFunction (CalleeHandled=false → clean `(progress)` callback),
  coalesced to ~1 MB steps. SHA256 pinning + the size cap are unchanged
  (still verified before ORT sees a byte). Backward-compatible: an older
  `.node` without the param just omits ticks (indeterminate bar).
- pure `embedder-status.ts` reducer (phase + clamped percent) folds the
  ticks; `FastembedEmbedder` emits status through an onStatus sink.
- `search:stats` carries the status; Settings → Search renders a card and
  polls (1 s) only while downloading. Bar is decorative (aria-hidden) —
  the "Downloading … X%" text is the assistive-tech source (matches the
  coverage bar's a11y pattern).

+29 tests (status reducer 10 · seam progress/status 4 · handler semantic
field 3 · card render 6, others). Native addon rebuilt + smoke-checked;
the live download tick path needs a real HF fetch (same verification
posture as the packaging tail). tsc + lint + size clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@th3-br41n th3-br41n merged commit df0d5f4 into main Jul 3, 2026
3 checks passed
@th3-br41n th3-br41n deleted the feat/11.3-download-progress branch July 3, 2026 20:02
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