Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(embeddings): replace mv brain.pglite recipes with readiness enablement
garrytan8ae97f2e3c6e
diff --git a/src/commands/config.ts b/src/commands/config.tsindex 9534a0df99..3303a0f8a8 100644--- a/src/commands/config.ts+++ b/src/commands/config.ts@@ -930,32 +930,7 @@ export async function runConfig(engine: BrainEngine, args: string[]) {//// No `--force` escape hatch (CDX2-13): keeping a known-no-op DB-only// write preserves the split-brain footgun the wave exists to close.- // Switching providers requires wipe-and-reinit; the recipe below is- // paste-ready and uses the actual command path that works after Lane B.- if (key === 'embedding_model' || key === 'embedding_dimensions') {- const { gbrainPath } = await import('../core/config.ts');- const isPgliteEngine = (await import('../core/config.ts')).loadConfig()?.engine === 'pglite';- const dbPath = gbrainPath('brain.pglite');- console.error(`[config] ${key} is a file-plane field that sizes the schema.`);- console.error(`[config] Setting it in the DB has no effect on the embed pipeline (silent no-op).`);- console.error(`[config]`);- if (isPgliteEngine) {- console.error(`[config] To switch embedding models/dimensions on PGLite, wipe and re-init:`);- console.error(`[config] mv ${dbPath} ${dbPath}.bak`);- if (key === 'embedding_model') {- console.error(`[config] gbrain init --pglite --embedding-model ${value}`);- } else {- console.error(`[config] gbrain init --pglite --embedding-dimensions ${value}`);- }- console.error(`[config] gbrain sync # re-imports your brain repo`);- } else {- console.error(`[config] To switch embedding models/dimensions on Postgres, see:`);- console.error(`[config] docs/embedding-migrations.md`);- }- console.error(`[config]`);- console.error(`[config] No --force escape: silently writing a no-op preserves the bug class this rejection closes.`);- process.exit(1);- }+ if (key === 'embedding_model' || key === 'embedding_dimensions') await refuseSchemaSizingKey(key, value);// v0.37.10.0 (D6): strict unknown-key rejection with --force escape hatch.// Catches the silent-no-op class for namespaced typos like `embedding.provider`,@@ -1235,3 +1210,36 @@ export async function runConfig(engine: BrainEngine, args: string[]) {process.exit(1);}}++/**+ * `config set embedding_model|embedding_dimensions` is refused (a DB-plane+ * write is a silent no-op). The recipe comes from readiness (A7): enabling is+ * in place and keeps pages and DB-only facts; switching an active model is a+ * previewed migration. Never a wipe.+ */+async function refuseSchemaSizingKey(key: 'embedding_model' | 'embedding_dimensions', value: string): Promise<never> {+ const { loadConfig } = await import('../core/config.ts');+ const { embeddingEnablement } = await import('../core/readiness.ts');+ const { shellQuote } = await import('../core/agent-output.ts');+ const cfg = loadConfig() ?? ({ engine: 'pglite' } as GBrainConfig);+ const requested = key === 'embedding_model' ? { embedding_model: value } : { embedding_dimensions: Number(value) };+ const active = !cfg.embedding_disabled ? cfg.embedding_model?.trim() : undefined;+ console.error(`[config] ${key} is a file-plane field that sizes the schema.`);+ console.error(`[config] Setting it in the DB has no effect on the embed pipeline (silent no-op).`);+ console.error(`[config]`);+ if (active) {+ const to = key === 'embedding_model' ? value : active;+ const dim = key === 'embedding_dimensions' ? ['--dim', value] : [];+ console.error(`[config] This brain already embeds with ${active}. Switching is a re-embed migration (pages and facts are kept); preview it first:`);+ console.error(`[config] ${shellQuote(['gbrain', 'migrate', 'embeddings', '--to', to, ...dim, '--dry-run'])}`);+ } else {+ const fix = embeddingEnablement({ ...cfg, ...requested } as GBrainConfig);+ console.error(`[config] To turn embeddings on in place:`);+ if (fix.argv) console.error(`[config] ${shellQuote(fix.argv)}`);+ console.error(`[config] ${fix.why}`);+ for (const input of fix.inputs ?? []) console.error(`[config] Needs ${input.name}: ${input.how}`);+ }+ console.error(`[config]`);+ console.error(`[config] No --force escape: silently writing a no-op preserves the bug class this rejection closes.`);+ process.exit(1);+}diff --git a/src/commands/reinit-pglite.ts b/src/commands/reinit-pglite.tsindex cf124b774e..abc2376f03 100644--- a/src/commands/reinit-pglite.ts+++ b/src/commands/reinit-pglite.ts@@ -3,18 +3,14 @@ import { assertManagedFilesystemWrite } from '../core/persistence/filesystem-gua/*** `gbrain reinit-pglite` — wipe-and-reinit PGLite brain in one command.*- * v0.37 fix wave (deferred TODO, shipped end-of-wave): the canonical path- * for switching embedding models / dimensions on PGLite is wipe-and-reinit- * (PGLite cannot `ALTER COLUMN TYPE vector(N)` — pgvector ships as WASM).- * The recipe is 3 commands by hand:- *- * mv ~/.gbrain/brain.pglite ~/.gbrain/brain.pglite.bak- * gbrain init --pglite --embedding-model X --embedding-dimensions N- * gbrain sync- *- * This command wraps that into one call so users (and agents reading- * `embeddingMismatchMessage` recipes) don't have to type the wipe + the- * init + the sync separately.+ * Last-resort width change on PGLite (PGLite cannot `ALTER COLUMN TYPE+ * vector(N)` — pgvector ships as WASM): moves the datastore aside to+ * `<path>.bak`, re-inits at the new width and re-syncs the brain repo.+ * DB-only pages and `remember` facts are NOT carried over (they live only in+ * the moved-aside datastore). Turning embeddings on for a keyless brain never+ * needs this: readiness's `embeddingEnablement` enables in place and keeps+ * everything; a width change with preserved data is+ * `gbrain migrate embeddings --to <model> --dim <N>`.** Destructive. TTY confirmation required unless `--yes` is passed. JSON* output via `--json` for scripted callers.diff --git a/src/core/embedding-dim-check.ts b/src/core/embedding-dim-check.tsindex 4be1e87775..f4888f8374 100644--- a/src/core/embedding-dim-check.ts+++ b/src/core/embedding-dim-check.ts@@ -152,10 +152,11 @@ export async function readContentChunksEmbeddingDim(engine: BrainEngine): Promis* are fundamentally different:** - **PGLite** has no native pgvector extension (the WASM build can't- * `ALTER COLUMN TYPE vector(N)`), so the only path is wipe-and-reinit- * via `gbrain init --pglite --embedding-model X --embedding-dimensions N`.- * The recipe derives the active database path so users don't paste a- * stale literal that ignores `GBRAIN_HOME` / `--path` / their config.+ * `ALTER COLUMN TYPE vector(N)`). The recipe offers, in order: keeping the+ * existing width when the model supports it (in-place `init --force` on+ * the active database path), a previewed `gbrain migrate embeddings` that+ * keeps pages and DB-only facts, and `gbrain reinit-pglite` as the labelled+ * last resort. It never prints a hand-run wipe.* - **Postgres** keeps the existing four-step SQL recipe.** The old recipe pointed at `gbrain config set embedding_model X` which@@ -193,26 +194,29 @@ export function embeddingMismatchMessage(opts: EmbeddingMismatchOpts): string {if (engineKind === 'pglite') {const activePath = databasePath ?? gbrainPath('brain.pglite');const modelArg = requestedModel ? ` --embedding-model ${requestedModel}` : '';+ const keepWidth = requestedModel && resolveSchemaEmbeddingDim({ embedding_model: requestedModel, embedding_dimensions: currentDims }).ok;const lines = [header,``,` Existing column: vector(${currentDims})`,` Requested: vector(${requestedDims})${requestedModel ? ` (${requestedModel})` : ''}`,``,- `Switching dims is destructive: it drops every embedding in your brain.`,- `PGLite cannot ALTER vector column types (pgvector ships as embedded WASM,`,- `not a native extension). Wipe-and-reinit is the only path.`,+ `${source === 'doctor' ? '' : 'Nothing was changed. '}Switching dims re-embeds every chunk and fact;`,+ `PGLite cannot ALTER vector column types in place (pgvector ships as WASM).`,``,- `Recommended (one command):`,+ ...(keepWidth ? [+ `Keep this brain's width (no rebuild; pages and facts kept):`,+ ``,+ ` gbrain init --force${modelArg} --embedding-dimensions ${currentDims} --path ${activePath}`,+ ``,+ ] : []),+ `Change the width (re-embeds; pages and DB-only facts kept; preview first):`,``,- ` gbrain reinit-pglite${modelArg} --embedding-dimensions ${requestedDims}`,+ ` gbrain migrate embeddings --to ${requestedModel ?? '<provider:model>'} --dim ${requestedDims} --dry-run`,``,- `Or by hand:`,+ `Last resort (moves the datastore aside; DB-only pages and facts are NOT carried over):`,``,- ` mv ${activePath} ${activePath}.bak`,- ` gbrain init --pglite${modelArg} --embedding-dimensions ${requestedDims}`,- ` gbrain sync # re-imports your brain repo from disk`,- ` gbrain embed --stale`,+ ` gbrain reinit-pglite${modelArg} --embedding-dimensions ${requestedDims}`,``,`Full guide: docs/embedding-migrations.md`,];diff --git a/test/embedding-dim-check.test.ts b/test/embedding-dim-check.test.tsindex 2ca3870165..c25ef937d9 100644--- a/test/embedding-dim-check.test.ts+++ b/test/embedding-dim-check.test.ts@@ -152,36 +152,52 @@ describe('embeddingMismatchMessage', () => {expect(doctorMsg).toContain('Embedding dimension mismatch detected');});- // v0.37 fix wave Lane D.1: PGLite branch uses wipe-and-reinit recipe- // because PGLite can't ALTER vector column types.- test('PGLite branch uses wipe-and-reinit, not ALTER COLUMN', () => {+ // PGLite can't ALTER vector column types. A7 (agent operator wave): the+ // recipe keeps pages and DB-only facts (keep-width init, previewed+ // migration) and never prints a hand-run wipe of the datastore.+ test('PGLite branch keeps data: keep-width init and migration, no hand-run wipe, not ALTER COLUMN', () => {const msg = embeddingMismatchMessage({currentDims: 1536,requestedDims: 1024,- requestedModel: 'voyage:voyage-4',+ requestedModel: 'openai:text-embedding-3-small',source: 'init',engineKind: 'pglite',databasePath: '/tmp/test-brain.pglite',});expect(msg).toContain('vector(1536)');expect(msg).toContain('vector(1024)');- expect(msg).toContain('mv /tmp/test-brain.pglite /tmp/test-brain.pglite.bak');- expect(msg).toContain('gbrain init --pglite --embedding-model voyage:voyage-4 --embedding-dimensions 1024');+ expect(msg).toContain('gbrain init --force --embedding-model openai:text-embedding-3-small --embedding-dimensions 1536 --path /tmp/test-brain.pglite');+ expect(msg).toContain('gbrain migrate embeddings --to openai:text-embedding-3-small --dim 1024 --dry-run');expect(msg).toContain('PGLite cannot ALTER vector column types');+ expect(msg).not.toMatch(/\bmv /);// Must NOT contain the Postgres-only SQL recipe.expect(msg).not.toContain('ALTER TABLE content_chunks ALTER COLUMN');expect(msg).not.toContain('DROP INDEX IF EXISTS idx_chunks_embedding');});+ test('PGLite branch omits the keep-width line when the model cannot produce the existing width', () => {+ const msg = embeddingMismatchMessage({+ currentDims: 1536,+ requestedDims: 1024,+ requestedModel: 'voyage:voyage-4',+ source: 'init',+ engineKind: 'pglite',+ databasePath: '/tmp/test-brain.pglite',+ });+ expect(msg).not.toContain('gbrain init --force');+ expect(msg).toContain('gbrain migrate embeddings --to voyage:voyage-4 --dim 1024 --dry-run');+ });+test('PGLite branch falls back to default database path when omitted', () => {const msg = embeddingMismatchMessage({currentDims: 1536,requestedDims: 1280,+ requestedModel: 'openai:text-embedding-3-small',source: 'init',engineKind: 'pglite',});// Default falls back to gbrainPath('brain.pglite').- expect(msg).toMatch(/mv .+brain\.pglite .+brain\.pglite\.bak/);+ expect(msg).toMatch(/--embedding-dimensions 1536 --path \S+brain\.pglite/);});test('PGLite branch must NOT recommend `gbrain config set embedding_model` (no-op after Lane C.2)', () => {diff --git a/test/fixtures/goldens/doctor/json-pglite-degraded.json b/test/fixtures/goldens/doctor/json-pglite-degraded.jsonindex ff2ebe7d10..dced1eb590 100644--- a/test/fixtures/goldens/doctor/json-pglite-degraded.json+++ b/test/fixtures/goldens/doctor/json-pglite-degraded.json@@ -1227,7 +1227,7 @@},{"category": "brain",- "message": "Schema width mismatch: content_chunks.embedding is vector(1024) but gateway resolved embedding_dimensions = 3072.\n\nEmbedding dimension mismatch detected.\n\n Existing column: vector(1024)\n Requested: vector(3072) (openai:text-embedding-3-large)\n\nSwitching dims is destructive: it drops every embedding in your brain.\nPGLite cannot ALTER vector column types (pgvector ships as embedded WASM,\nnot a native extension). Wipe-and-reinit is the only path.\n\nRecommended (one command):\n\n gbrain reinit-pglite --embedding-model openai:text-embedding-3-large --embedding-dimensions 3072\n\nOr by hand:\n\n mv <home>/.gbrain/brain.pglite <home>/.gbrain/brain.pglite.bak\n gbrain init --pglite --embedding-model openai:text-embedding-3-large --embedding-dimensions 3072\n gbrain sync # re-imports your brain repo from disk\n gbrain embed --stale\n\nFull guide: docs/embedding-migrations.md",+ "message": "Schema width mismatch: content_chunks.embedding is vector(1024) but gateway resolved embedding_dimensions = 3072.\n\nEmbedding dimension mismatch detected.\n\n Existing column: vector(1024)\n Requested: vector(3072) (openai:text-embedding-3-large)\n\nSwitching dims re-embeds every chunk and fact;\nPGLite cannot ALTER vector column types in place (pgvector ships as WASM).\n\nKeep this brain's width (no rebuild; pages and facts kept):\n\n gbrain init --force --embedding-model openai:text-embedding-3-large --embedding-dimensions 1024 --path <home>/.gbrain/brain.pglite\n\nChange the width (re-embeds; pages and DB-only facts kept; preview first):\n\n gbrain migrate embeddings --to openai:text-embedding-3-large --dim 3072 --dry-run\n\nLast resort (moves the datastore aside; DB-only pages and facts are NOT carried over):\n\n gbrain reinit-pglite --embedding-model openai:text-embedding-3-large --embedding-dimensions 3072\n\nFull guide: docs/embedding-migrations.md","name": "embedding_width_consistency","status": "warn"},@@ -1373,7 +1373,7 @@"tier": "symptom"},{- "fix": "Schema width mismatch: content_chunks.embedding is vector(1024) but gateway resolved embedding_dimensions = 3072.\n\nEmbedding dimension mismatch detected.\n\n Existing column: vector(1024)\n Requested: vector(3072) (openai:text-embedding-3-large)\n\nSwitching dims is destructive: it drops every embedding in your brain.\nPGLite cannot ALTER vector column types (pgvector ships as embedded WASM,\nnot a native extension). Wipe-and-reinit is the only path.\n\nRecommended (one command):\n\n gbrain reinit-pglite --embedding-model openai:text-embedding-3-large --embedding-dimensions 3072\n\nOr by hand:\n\n mv <home>/.gbrain/brain.pglite <home>/.gbrain/brain.pglite.bak\n gbrain init --pglite --embedding-model openai:text-embedding-3-large --embedding-dimensions 3072\n gbrain sync # re-imports your brain repo from disk\n gbrain embed --stale\n\nFull guide: docs/embedding-migrations.md",+ "fix": "Schema width mismatch: content_chunks.embedding is vector(1024) but gateway resolved embedding_dimensions = 3072.\n\nEmbedding dimension mismatch detected.\n\n Existing column: vector(1024)\n Requested: vector(3072) (openai:text-embedding-3-large)\n\nSwitching dims re-embeds every chunk and fact;\nPGLite cannot ALTER vector column types in place (pgvector ships as WASM).\n\nKeep this brain's width (no rebuild; pages and facts kept):\n\n gbrain init --force --embedding-model openai:text-embedding-3-large --embedding-dimensions 1024 --path <home>/.gbrain/brain.pglite\n\nChange the width (re-embeds; pages and DB-only facts kept; preview first):\n\n gbrain migrate embeddings --to openai:text-embedding-3-large --dim 3072 --dry-run\n\nLast resort (moves the datastore aside; DB-only pages and facts are NOT carried over):\n\n gbrain reinit-pglite --embedding-model openai:text-embedding-3-large --embedding-dimensions 3072\n\nFull guide: docs/embedding-migrations.md","name": "embedding_width_consistency","status": "warn","tier": "symptom"diff --git a/test/readiness-advice-lint.test.ts b/test/readiness-advice-lint.test.tsnew file mode 100644index 0000000000..412bd0f50b--- /dev/null+++ b/test/readiness-advice-lint.test.ts@@ -0,0 +1,90 @@+/**+ * A7 lint: "turn on / switch embeddings" advice comes from readiness+ * (`embeddingEnablement` in src/core/readiness.ts), never from hand-written+ * strings elsewhere in src/.+ *+ * Protects: the six contradictory renderings of "turn on embeddings" (one of+ * them a `mv brain.pglite` wipe that loses DB-only facts) from coming back. A+ * new hard-coded recipe fails here; the allowlist below is the pre-wave+ * baseline, shrink-only (Lanes B/E sweep these sites onto readiness), and a+ * stale count fails too so the list cannot hide a regression.+ */+import { describe, expect, test } from 'bun:test';+import { readdirSync, readFileSync, statSync } from 'node:fs';+import { join, relative } from 'node:path';+import { RECIPES } from '../src/core/ai/recipes/index.ts';++const ROOT = join(import.meta.dir, '..');+const SRC = join(ROOT, 'src');+const EXEMPT = new Set(['src/core/readiness.ts', 'src/core/cli-flag-registry.generated.ts']);++/** Shrink-only baseline: file → allowed hit count, with the owner that removes it. */+const ALLOWLIST: Record<string, { count: number; reason: string }> = {+ 'src/commands/doctor/checks/embedding-health.ts': { count: 1, reason: 'Lane E1: doctor fixes become readiness Actions' },+ 'src/commands/init.ts': { count: 3, reason: 'Lane E/G5: init deferred-setup hint renders embeddingEnablement' },+ 'src/commands/models.ts': { count: 1, reason: 'Lane E: models dims hint' },+ 'src/commands/reindex-code.ts': { count: 2, reason: 'Lane E: reindex-code embedding hint' },+ 'src/commands/reinit-pglite.ts': { count: 2, reason: 'usage examples of reinit-pglite\'s own --embedding-model flag' },+ 'src/core/advisor/collect-setup-smells.ts': { count: 2, reason: 'Lane E: advisor setup smells read readiness' },+ 'src/core/ai/dims.ts': { count: 2, reason: 'Lane B: dims validation error hints' },+ 'src/core/embed-preflight.ts': { count: 5, reason: 'Lane E: embed preflight refusals carry the readiness fix' },+ 'src/core/embedding-dim-check.ts': { count: 2, reason: 'Lane E: keyless embed/import refusal (advises a refused config set)' },+};++const WIPE = /\bmv\s+\S+\s+\S+\.bak\b|\bmv\s+\S*brain\.pglite/;+const REFUSED_CONFIG_SET = /config set embedding_(?:model|dimensions)\b/;+const LITERAL_MODEL = /--embedding-model[ =]+([a-z][a-z0-9-]*):[a-z0-9]/g;++function isComment(line: string): boolean {+ const t = line.trimStart();+ return t.startsWith('*') || t.startsWith('//') || t.startsWith('/*');+}++function hitsIn(text: string): number {+ let hits = 0;+ for (const line of text.split('\n')) {+ if (isComment(line)) continue;+ if (WIPE.test(line) || REFUSED_CONFIG_SET.test(line)) { hits++; continue; }+ for (const m of line.matchAll(LITERAL_MODEL)) {+ if (RECIPES.has(m[1])) { hits++; break; }+ }+ }+ return hits;+}++function walk(dir: string, out: string[] = []): string[] {+ for (const name of readdirSync(dir)) {+ const p = join(dir, name);+ if (statSync(p).isDirectory()) walk(p, out);+ else if (p.endsWith('.ts')) out.push(p);+ }+ return out;+}++describe('embedding enablement advice lives in readiness', () => {+ const found = new Map<string, number>();+ for (const file of walk(SRC)) {+ const rel = relative(ROOT, file);+ if (EXEMPT.has(rel)) continue;+ const n = hitsIn(readFileSync(file, 'utf8'));+ if (n > 0) found.set(rel, n);+ }++ test('no wipe recipe and no new hard-coded embedding_model advice outside readiness.ts', () => {+ const offenders = [...found].filter(([f, n]) => n > (ALLOWLIST[f]?.count ?? 0));+ expect(offenders).toEqual([]);+ });++ test('allowlist is shrink-only: a fixed site must drop its entry', () => {+ const stale = Object.entries(ALLOWLIST).filter(([f, a]) => (found.get(f) ?? 0) < a.count).map(([f]) => f);+ expect(stale).toEqual([]);+ });++ test('the detector catches the removed recipes', () => {+ expect(hitsIn('console.error(` mv ${dbPath} ${dbPath}.bak`);')).toBe(1);+ expect(hitsIn("' mv ~/.gbrain/brain.pglite ~/.gbrain/brain.pglite.bak'")).toBe(1);+ expect(hitsIn("'Enable with `gbrain init --force --embedding-model voyage:voyage-4`'")).toBe(1);+ expect(hitsIn("'Use --embedding-model provider:model.'")).toBe(0);+ expect(hitsIn(' * mv brain.pglite in a comment')).toBe(0);+ });+});diff --git a/test/v0_28_5-fix-wave.serial.test.ts b/test/v0_28_5-fix-wave.serial.test.tsindex b2e1a70368..7eac90957b 100644--- a/test/v0_28_5-fix-wave.serial.test.ts+++ b/test/v0_28_5-fix-wave.serial.test.ts@@ -260,15 +260,15 @@ describe('v0.28.5 A4 — existing-brain dim mismatch loud failure', () => {engineKind: 'pglite',});- // PGLite branch: wipe-and-reinit recipe (no ALTER COLUMN — that fails- // on PGLite's WASM pgvector). Asserts the recipe references the- // correct dim and model and points at `gbrain init --pglite`.+ // PGLite branch (no ALTER COLUMN — that fails on PGLite's WASM+ // pgvector). Asserts the recipe references the correct dim and model+ // and points at the data-preserving migration, never a hand-run wipe.expect(msg).toContain('vector(1536)');expect(msg).toContain('vector(768)');- expect(msg).toContain('gbrain init --pglite --embedding-model ollama:nomic-embed-text --embedding-dimensions 768');+ expect(msg).toContain('gbrain migrate embeddings --to ollama:nomic-embed-text --dim 768 --dry-run');expect(msg).toContain('PGLite cannot ALTER vector column types');expect(msg).toContain('docs/embedding-migrations.md');- expect(msg).toContain('gbrain embed --stale');+ expect(msg).not.toMatch(/\bmv /);} finally {await engine.disconnect();}diff --git a/test/v0_37_fix_wave.serial.test.ts b/test/v0_37_fix_wave.serial.test.tsindex 67a4670124..00be94f5a4 100644--- a/test/v0_37_fix_wave.serial.test.ts+++ b/test/v0_37_fix_wave.serial.test.ts@@ -298,7 +298,7 @@ describe('v0.37 deferred TODO shipped — gbrain reinit-pglite', () => {expect(CLI_ONLY_SELF_HELP.has('reinit-pglite')).toBe(true);});- test('embeddingMismatchMessage PGLite branch recommends `gbrain reinit-pglite`', async () => {+ test('embeddingMismatchMessage PGLite branch keeps `gbrain reinit-pglite` as the labelled last resort', async () => {const { embeddingMismatchMessage } = await import('../src/core/embedding-dim-check.ts');const msg = embeddingMismatchMessage({currentDims: 1536,@@ -308,14 +308,13 @@ describe('v0.37 deferred TODO shipped — gbrain reinit-pglite', () => {engineKind: 'pglite',databasePath: '/tmp/test.pglite',});- // The one-command path appears before the by-hand recipe.+ // reinit-pglite stays available, labelled as the last resort AFTER the+ // data-preserving migration (A7: no hand-run wipe recipe).expect(msg).toContain('gbrain reinit-pglite --embedding-model voyage:voyage-4 --embedding-dimensions 1024');- // The by-hand path is still present as fallback.- expect(msg).toContain('mv /tmp/test.pglite /tmp/test.pglite.bak');- // The recommended-section header precedes the by-hand section.- const recIdx = msg.indexOf('Recommended');- const handIdx = msg.indexOf('Or by hand');- expect(recIdx).toBeGreaterThan(0);- expect(handIdx).toBeGreaterThan(recIdx);+ expect(msg).not.toMatch(/\bmv /);+ const migrateIdx = msg.indexOf('gbrain migrate embeddings --to voyage:voyage-4 --dim 1024 --dry-run');+ const lastResortIdx = msg.indexOf('Last resort');+ expect(migrateIdx).toBeGreaterThan(0);+ expect(lastResortIdx).toBeGreaterThan(migrateIdx);});});