Skip to content

Commit 2dcdde1

Browse files
alichherawallaUserclaude
authored
chore: demo seed (core + pro) + add @scure/bip39 for vault recovery (#26)
* chore(demo): seed BOTH core + pro data so chat/memory works in the demo `npm run demo` set only OFFGRID_SEED_PRO (pro: observations/entities/clipboard/ replay), leaving the CORE RAG/memory store empty — so "All memory" chat had nothing to query and errored with "Sorry, something went wrong…". Add OFFGRID_SEED=force so the core seeder (seedDemo) also runs, indexing synthetic chats/knowledge/memory into RAG. The demo now exercises the real chat/generation success path, not the empty-profile error path. Also clarify CLAUDE.md: the two seeders are independent (OFFGRID_SEED = core, OFFGRID_SEED_PRO = pro); capture flows that generate need both. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore: add @scure/bip39 for vault recovery phrases Audited, minimal BIP39 implementation. Consumed by the desktop-pro vault recovery-phrase feature (24-word phrase -> vault unlock), resolved from the desktop node_modules as a pro peer dep. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs: engineering guidance (integration tests, sparing mocks) + vault-recovery evidence GIF Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: User <user@Users-MacBook-Pro-174.local> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 95cd69d commit 2dcdde1

4 files changed

Lines changed: 39 additions & 2 deletions

File tree

CLAUDE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Two process rules, learned from the same incident — they matter as much as the
6161
When iterating (a request, a fix, a tweak the user just confirmed), add a test that captures that specific behavior **as part of the same change** — a regression test that would fail before the change and pass after. This applies to bug fixes (test the exact broken case), new branches/conditions (cover each), and copy/contract changes other code depends on. Do not defer tests to "later" or a separate commit.
6262

6363
- **Unit tests** — vitest, `src/**/*.test.ts` (run `npm test`). Keep logic pure and Electron-free so it's testable: extract decision logic into a no-import module and test that (see `model-sizing.ts`, `search-ranking.ts` + their `__tests__/`). DB/Electron-bound code (anything importing `getDB`, `vision`, etc.) can't be unit-tested directly — pull the pure part out.
64+
- **Integration tests over mocks** — cover the real seams too, not just the pure units. Run the actual implementation against real collaborators wherever it's feasible (a temp SQLite DB, a temp `OFFGRID_USER_DATA` dir, real crypto/WASM) — see `vault-service.test.ts`, which exercises real kdbxweb + Argon2 against a temp dir. **Use mocks very sparingly**, only at true boundaries you can't run in-process (the network, a native OS dialog, hardware IDs). A mock that stands in for your own logic hides the thing under test and lets it rot green — prefer a real (or in-memory) implementation so the test fails when the behavior actually breaks.
6465
- **Regression guards for prompts/contracts** — when a fix lives in a prompt or string contract, assert it by reading the source (see `extract-prompt.test.ts`, which guards the observation-confabulation fix).
6566
- **E2E** — Playwright Electron tour in `e2e/` (`npm run test:e2e`), DOM-driven, fresh temp profile, `OFFGRID_PRO=0`. Assert new surfaces render. Screenshot key states via `page.screenshot({ path: 'e2e/screenshots/<name>.png' })`; include those screenshots in the PR body.
6667
- Before declaring a change done: `npx tsc --noEmit -p tsconfig.node.json && npx tsc --noEmit -p tsconfig.web.json && npm test` — fix failures first.
@@ -69,7 +70,7 @@ When iterating (a request, a fix, a tweak the user just confirmed), add a test t
6970

7071
E2E and screenshot/video capture (including the Provit capture harness) run the app on a **fresh temp `OFFGRID_USER_DATA` profile** and must use **synthetic demo data only — never a real profile, never upload real user data.**
7172

72-
- **Seed with the demo script.** A blank profile is EMPTY, so any flow that *generates* (chat, especially the "All memory" scope) will error with **"Sorry, something went wrong…"**this is a **profile/RAG gap, not a bug**: no seeded memory store means the memory path throws before streaming. Launch the app with **`OFFGRID_SEED=force`** (see `src/main/index.ts``dev-seed.ts:seedDemo`) so the profile has synthetic chats/knowledge/memory and generation actually works. Use this for any e2e that exercises chat/generation.
73+
- **Seed with the demo script — BOTH seeders.** A blank profile is EMPTY, so any flow that *generates* (chat, especially the "All memory" scope) will error with **"Sorry, something went wrong…"** — a **profile/RAG gap, not a bug**: no seeded memory store means the memory path throws before streaming. There are TWO independent seeders and a flow may need both: **`OFFGRID_SEED=force`** → core `seedDemo` (`src/main/index.ts``dev-seed.ts`) seeds chats / knowledge / RAG memory (this is what "All memory" chat queries); **`OFFGRID_SEED_PRO=force`** → pro `seedProDemo` (`pro/main/index.ts``pro/main/dev-seed.ts`) seeds observations / entities / clipboard / replay frames. `npm run demo` sets both — use it (or set both env vars) for any capture that exercises chat/generation.
7374
- **Model ports are single-owner.** Only one app instance can bind the model engine ports (`:7878` gateway, `:8439` llama-server, `:7879`). A running `npm run dev` will block a second capture instance's engine → generation errors that look like a bug but aren't. Free the ports (stop the dev app) before an e2e capture, or the recording exercises the error path only.
7475
- **Never upload private data.** Screenshots/video from real-profile runs (real chats, memories) must not be published. Capture runs must be synthetic-seeded so anything that lands in a PR or the public showcase is demo data.
7576

2.03 MB
Loading

package-lock.json

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"typecheck": "npm run typecheck:node && npm run typecheck:web",
1818
"start": "electron-vite preview",
1919
"demo": "npm run build && npm run demo:run",
20-
"demo:run": "mkdir -p \"$PWD/.demo-profile\" && ln -sfn \"$HOME/Library/Application Support/Off Grid AI Desktop/models\" \"$PWD/.demo-profile/models\" && OFFGRID_PRO=1 OFFGRID_SEED_PRO=force OFFGRID_USER_DATA=\"$PWD/.demo-profile\" electron-vite preview",
20+
"demo:run": "mkdir -p \"$PWD/.demo-profile\" && ln -sfn \"$HOME/Library/Application Support/Off Grid AI Desktop/models\" \"$PWD/.demo-profile/models\" && OFFGRID_PRO=1 OFFGRID_SEED=force OFFGRID_SEED_PRO=force OFFGRID_USER_DATA=\"$PWD/.demo-profile\" electron-vite preview",
2121
"demo:fresh": "rm -rf \"$PWD/.demo-profile\" && npm run demo",
2222
"dev": "electron-vite dev",
2323
"gateway": "OFFGRID_SERVER_ONLY=1 electron-vite dev",
@@ -55,6 +55,7 @@
5555
"@radix-ui/react-tabs": "^1.1.13",
5656
"@radix-ui/react-tooltip": "^1.2.10",
5757
"@react-three/fiber": "^10.0.0-alpha.1",
58+
"@scure/bip39": "^2.2.0",
5859
"@tabler/icons-react": "^3.36.1",
5960
"@tailwindcss/vite": "^4.1.18",
6061
"@tsparticles/engine": "^3.9.1",

0 commit comments

Comments
 (0)