Garry Tan and Claude Opus 4.7
306fc0e1ef
fix(init): error on existing-brain dim mismatch + embedding-migration recipe
...
Adds A4 hard-error path: when `gbrain init --embedding-dimensions N` is
run against an existing brain whose `content_chunks.embedding` column is
a different `vector(M)`, init exits 1 with an inline four-step ALTER
recipe and a pointer to docs/embedding-migrations.md.
This kills the silent-corruption pattern surfaced by issue #673 : the
v0.27 schema seeded `('embedding_dimensions', '1536')` regardless of the
flag, so users got a config saying 768 but a column at 1536 — first
sync write blew up with "expected 1536, got 768."
A4's contract:
1. Connect to engine BEFORE saveConfig so we can read the live column type
2. If column exists AND dim != requested, exit 1 (loud failure)
3. If column doesn't exist (fresh init) OR dim matches, proceed normally
Recipe in docs/embedding-migrations.md (and inlined in init's error
output) covers all four destructive steps codex's plan-review caught:
1. DROP INDEX IF EXISTS idx_chunks_embedding (HNSW won't survive ALTER)
2. ALTER TABLE content_chunks ALTER COLUMN embedding TYPE vector(N)
3. UPDATE content_chunks SET embedding = NULL, embedded_at = NULL
4. CREATE INDEX HNSW *only if N <= 2000* (pgvector cap)
Step 4 is conditional: dims > 2000 (e.g. Voyage 4 Large 2048d) cannot
be HNSW-indexed in pgvector; the recipe explicitly says "Skip reindex"
in that case so the user doesn't paste a CREATE INDEX that crashes.
Helper `readContentChunksEmbeddingDim` and message builder
`embeddingMismatchMessage` live in src/core/embedding-dim-check.ts so
doctor 8b (next commit) can reuse the same source of truth.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com >
2026-05-06 18:01:18 -07:00
..
2026-05-06 17:58:20 -07:00
2026-04-25 12:25:34 -07:00
2026-05-04 12:59:52 -07:00
2026-05-04 21:11:15 -07:00
2026-04-29 23:46:36 -07:00
2026-05-04 12:59:52 -07:00
2026-05-04 12:59:52 -07:00
2026-04-22 01:34:22 -07:00
2026-04-29 23:46:36 -07:00
2026-04-26 20:45:05 -07:00
2026-05-02 08:41:11 -07:00
2026-04-18 16:57:38 +08:00
2026-04-21 18:35:45 -07:00
2026-04-11 21:25:44 -10:00
2026-04-14 19:41:34 -10:00
2026-04-22 01:34:22 -07:00
2026-04-20 07:30:00 +08:00
2026-04-20 07:30:00 +08:00
2026-04-18 18:16:18 +08:00
2026-05-02 08:41:11 -07:00
2026-04-30 20:47:32 -07:00
2026-05-02 22:01:05 -07:00
2026-05-03 20:16:15 -07:00
2026-05-02 22:01:05 -07:00
2026-04-20 23:14:38 +08:00
2026-04-29 10:12:10 -07:00
2026-04-21 11:51:32 -07:00
2026-04-25 12:25:34 -07:00
2026-04-23 19:34:27 -07:00
2026-05-02 08:41:11 -07:00
2026-04-09 12:25:04 -10:00
2026-04-25 12:25:34 -07:00
2026-04-25 12:25:34 -07:00
2026-04-29 23:46:36 -07:00
2026-04-21 17:54:13 -07:00
2026-05-02 08:41:11 -07:00
2026-04-12 07:48:47 -10:00
2026-04-25 12:25:34 -07:00
2026-04-25 12:25:34 -07:00
2026-04-25 12:25:34 -07:00
2026-04-06 16:50:15 -07:00
2026-04-26 15:49:48 -07:00
2026-04-29 22:13:05 -07:00
2026-04-30 01:23:29 -07:00
2026-04-30 23:04:47 -07:00
2026-04-14 19:41:34 -10:00
2026-04-22 16:24:23 -07:00
2026-05-03 20:41:39 -07:00
2026-04-29 22:21:07 -07:00
2026-04-20 21:54:36 +08:00
2026-04-26 15:49:48 -07:00
2026-05-04 17:31:32 -07:00
2026-04-30 01:23:29 -07:00
2026-05-02 22:01:05 -07:00
2026-04-20 21:54:36 +08:00
2026-04-25 12:25:34 -07:00
2026-05-04 12:59:52 -07:00
2026-05-06 18:01:18 -07:00
2026-04-11 00:01:09 -10:00
2026-04-14 19:41:34 -10:00
2026-04-20 07:30:00 +08:00
2026-04-25 12:25:34 -07:00
2026-05-01 09:02:43 -07:00
2026-05-01 09:02:43 -07:00
2026-05-01 09:02:43 -07:00
2026-05-01 09:02:43 -07:00
2026-05-01 09:02:43 -07:00
2026-05-01 09:02:43 -07:00
2026-04-13 21:03:40 -10:00
2026-05-02 22:01:05 -07:00
2026-04-22 01:34:22 -07:00
2026-04-29 10:12:10 -07:00
2026-04-20 07:05:27 +08:00
2026-04-20 07:30:00 +08:00
2026-04-14 21:40:48 -10:00
2026-04-25 12:25:34 -07:00
2026-04-09 10:17:13 -07:00
2026-04-13 07:49:13 -10:00
2026-04-16 23:03:15 -07:00
2026-04-13 07:49:13 -10:00
2026-04-23 19:34:27 -07:00
2026-04-29 23:46:36 -07:00
2026-04-29 23:46:36 -07:00
2026-04-26 20:45:05 -07:00
2026-04-29 23:26:25 -07:00
2026-04-26 20:45:05 -07:00
2026-04-29 23:46:36 -07:00
2026-04-18 18:16:18 +08:00
2026-04-29 22:13:05 -07:00
2026-04-28 17:01:40 -07:00
2026-05-01 09:02:43 -07:00
2026-04-19 07:14:24 +08:00
2026-04-09 10:17:13 -07:00
2026-04-12 07:48:47 -10:00
2026-04-25 12:25:34 -07:00
2026-04-18 16:57:38 +08:00
2026-04-16 23:03:15 -07:00
2026-04-22 01:34:22 -07:00
2026-04-13 21:03:40 -10:00
2026-04-25 12:25:34 -07:00
2026-04-25 12:25:34 -07:00
2026-04-24 00:08:54 -07:00
2026-04-26 20:45:05 -07:00
2026-04-11 21:25:44 -10:00
2026-04-26 20:45:05 -07:00
2026-04-24 00:08:54 -07:00
2026-05-04 21:11:15 -07:00
2026-05-01 09:02:43 -07:00
2026-04-21 21:14:17 -07:00
2026-05-06 12:14:26 -07:00
2026-04-26 20:45:05 -07:00
2026-04-20 23:14:38 +08:00
2026-04-18 16:57:38 +08:00
2026-04-18 16:57:38 +08:00
2026-04-18 18:16:18 +08:00
2026-04-19 07:14:24 +08:00
2026-04-22 01:34:22 -07:00
2026-04-20 07:30:00 +08:00
2026-04-29 23:46:36 -07:00
2026-04-22 01:34:22 -07:00
2026-04-25 12:25:34 -07:00
2026-04-25 12:25:34 -07:00
2026-04-26 20:45:05 -07:00
2026-04-22 01:34:22 -07:00
2026-04-24 01:09:28 -07:00
2026-04-29 23:06:16 -07:00
2026-05-02 22:01:05 -07:00
2026-05-02 22:01:05 -07:00
2026-05-03 20:41:39 -07:00
2026-05-04 21:11:15 -07:00
2026-04-30 01:23:29 -07:00
2026-05-02 22:01:05 -07:00
2026-05-03 20:41:39 -07:00
2026-04-25 12:25:34 -07:00
2026-04-08 23:26:11 -10:00
2026-04-29 22:21:07 -07:00
2026-04-12 17:38:48 -07:00
2026-04-23 19:34:27 -07:00
2026-05-02 08:41:11 -07:00
2026-04-20 07:30:00 +08:00
2026-04-21 18:35:45 -07:00
2026-04-18 16:57:38 +08:00
2026-05-03 20:16:15 -07:00
2026-04-29 23:46:36 -07:00
2026-04-30 20:47:32 -07:00
2026-05-01 09:02:43 -07:00
2026-04-12 13:23:55 -10:00
2026-04-21 21:14:17 -07:00
2026-04-25 12:25:34 -07:00
2026-04-16 23:03:15 -07:00
2026-04-22 01:34:22 -07:00
2026-04-22 01:34:22 -07:00
2026-05-03 20:16:15 -07:00
2026-04-23 19:34:27 -07:00
2026-04-25 12:25:34 -07:00
2026-04-19 07:14:24 +08:00
2026-04-23 19:34:27 -07:00
2026-04-11 21:25:44 -10:00
2026-04-25 12:25:34 -07:00
2026-04-21 18:35:45 -07:00
2026-04-24 01:39:58 -07:00
2026-04-22 01:34:22 -07:00
2026-04-30 23:17:54 -07:00
2026-04-23 19:34:27 -07:00
2026-04-29 23:46:36 -07:00
2026-05-06 12:22:19 -07:00
2026-04-27 22:59:08 -07:00
2026-04-25 12:25:34 -07:00
2026-04-16 23:03:15 -07:00
2026-04-18 18:16:18 +08:00
2026-04-29 23:46:36 -07:00
2026-04-30 20:47:32 -07:00
2026-04-09 10:17:13 -07:00
2026-04-23 19:34:27 -07:00
2026-04-22 02:07:00 -07:00
2026-04-30 23:17:54 -07:00
2026-04-18 16:57:38 +08:00
2026-04-30 23:17:54 -07:00
2026-04-23 19:34:27 -07:00
2026-05-02 08:41:11 -07:00
2026-04-14 19:41:34 -10:00
2026-04-11 10:52:30 -10:00
2026-04-29 22:21:07 -07:00
2026-04-22 16:24:23 -07:00
2026-05-03 20:41:39 -07:00
2026-04-22 16:24:23 -07:00
2026-04-29 22:21:07 -07:00
2026-04-29 22:21:07 -07:00
2026-04-29 22:21:07 -07:00
2026-04-29 22:21:07 -07:00
2026-04-29 22:21:07 -07:00
2026-04-13 07:49:13 -10:00
2026-04-21 21:14:17 -07:00
2026-04-21 21:14:17 -07:00
2026-04-22 01:34:22 -07:00
2026-04-22 01:34:22 -07:00
2026-04-09 10:17:13 -07:00
2026-04-29 23:06:16 -07:00
2026-04-25 12:25:34 -07:00
2026-04-29 22:53:41 -07:00
2026-04-25 12:25:34 -07:00
2026-04-29 22:34:04 -07:00
2026-04-29 22:53:41 -07:00
2026-04-25 12:25:34 -07:00
2026-04-29 10:12:10 -07:00
2026-04-29 23:46:36 -07:00
2026-04-14 19:41:34 -10:00
2026-04-20 23:14:38 +08:00
2026-05-04 21:11:15 -07:00
2026-04-25 12:25:34 -07:00
2026-04-18 18:16:18 +08:00
2026-04-19 18:23:02 +08:00
2026-04-22 01:34:22 -07:00
2026-04-20 07:30:00 +08:00
2026-04-09 10:17:13 -07:00