docs: 修正入门文档里已经失效的运维事实 - #26
Conversation
排查一份 brand-voice embedding 的 bug 报告时发现问题本身已经在 #20 (`0c5323b`)修掉了,但顺手核对上下文的过程中撞上好几处文档与现状不符 —— 每一处都会让下一个会话走一段冤枉路,所以单独收一个 docs PR。 改了什么: - **prod DB 口令来源**:CLAUDE.md 和 memory.md 有 5 处说密码"在 .env 里", 但这台机器上根本没有 .env(只有 .env.example)。全部改为从 Secret Manager 取:`gcloud secrets versions access latest --secret=DATABASE_URL`。 - **测试数字**:CLAUDE.md 同时写着 377 和 234,memory.md 写 234 —— 实际是 656 个服务端测试 / 69 个文件、~1 秒。前端测试也不再是"4 个组件测试"或 "还没有",是 13 个 vitest 文件 + 5 条 Playwright(3 个 spec)。 - **Sentry / OTEL**:memory.md §5.4 还写着"没有(Sprint 1 待加)",与同文件 §6 已关闭表和 CLAUDE.md 自相矛盾。两者早已接入,只是要配 DSN / OTLP 才上报。 - **brand_voices 生产现状**:借这次机会连 prod 只读查了一次 —— 表 0 行。 也就是说 embedding 写入路径坏了这么久没有造成数据损失,不需要 backfill。 这条结论写进 memory.md §6,省得以后有人再问一遍。 - 新增一条"仍然成立":embedding 只在 `POST /api/brand-voices` 创建时写, 目前没有 update 路由所以无害,但以后加编辑接口必须重新 embed。 验证:纯文档改动,未动任何代码路径;`npm test` 656/656 通过。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…lake Review follow-up on this PR. The numbers went stale during review: #23 (+9 tests, +1 file) and #24 (+7, +1) merged while this branch sat open, so "656 / 69 files" was already wrong by the time it could land — the exact failure mode the PR exists to fix. Measured on main at 7df4183: 678 tests across 71 files. Corrected in all five places (CLAUDE.md ×2, memory.md §5.2 / §7.3 / Last-reviewed footer, which also still said "post #20"). Also documents why a clean checkout can show 2-5 red files: `npm test` is `node --test`, which runs files concurrently against the one shared influencex.db at the repo root, so writes collide and report `{ code: 'SQLITE_BUSY' }` on a rotating cast of files. It reproduces on main with no changes applied, and the triage step is a serialized re-run (--test-concurrency=1 → stable 678/678). Without this written down the next session reads the flake as its own regression — which is what the rest of this PR is trying to prevent. Verified: 678/678 serialized on main, and on main + #25 + this branch. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Review: approving — every claim checked, but the numbers had themselves gone staleA docs PR is only worth its accuracy, so I re-verified each claim against
Fixed in b9dbea5#23 (+9 tests, +1 file) and #24 (+7, +1) merged while this branch sat open, so Worth noting for future doc passes: a hardcoded count in five places goes stale on every merge. The prose that doesn't carry a number ("13 Vitest files under …") aged fine here. Also addedThe Left undocumented, the next session reads the flake as its own regression — the same wasted-detour cost the rest of this PR is written to prevent, which is why it belongs here rather than in a follow-up. Verified: 678/678 serialized on Merging. |
…nded (#31) Two defects found while reviewing the #23–#30 batch, both now on main. **Wrong PR credited.** #29's .gitattributes header and memory.md §6 both say #27 fixed the usage-ledger NUL bytes. #27 was closed as a duplicate — #30 landed the identical fix (verified byte-for-byte identical trees). Anyone following the reference lands on a closed PR with an empty diff. **The count treadmill.** #26 corrected five hardcoded test counts from 234/377/656 to the then-accurate 678. #28 merged minutes later and made it 679, so a PR whose entire purpose was de-staling docs shipped a number that was stale on arrival. Five copies of a figure that changes on every test-bearing merge cannot stay right. Counts are now stated as a magnitude pinned to a commit ("~680 as of c7c7d5b") with an instruction to measure instead of cite, and the two places that only needed "all green" no longer carry a number at all. The prose that never had one ("Vitest files under client/src/{...}") aged fine through this whole batch, which is the argument. memory.md §5.2 records the pattern so the next doc pass doesn't reinstate it. The remaining 234/656 mentions are deliberate — they are the history being explained, not live facts. Verified: 679/679 serialized on this branch; grep confirms no stale hardcoded count or bare #27 reference survives. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
背景
收到一份 brand-voice embedding 的 bug 报告,说
server/brand-voice-search.js用错了llm.embed()的签名。排查结论:问题真实存在过,但已经在 #20(0c5323b)修掉了 —— 两个调用点现在都是const { vectors } = await llm.embed([text]),契约测试server/__tests__/brand-voice-embed-contract.test.js也已经在仓库里。所以本 PR 不含任何代码修改。但核对上下文的过程中撞上好几处文档与现状不符,每一处都会让下一个会话走一段冤枉路,所以单独收成这个 docs PR。
改了什么
.env里".env,只有.env.example。改为gcloud secrets versions access latest --secret=DATABASE_URL --project=gameclaw-492005server/sentry.js/server/otel.js),只是要配SENTRY_DSN/ OTLP endpoint 才上报。原文与同文件 §6 和 CLAUDE.md 自相矛盾顺带查证的生产事实
借这次机会用 Cloud SQL Auth Proxy 只读查了一次 prod:
表是空的 —— embedding 写入路径坏了这么久并没有造成数据损失,不需要 backfill。 下次部署后创建的第一条 brand voice 就会正常写入向量。这条结论记进了 memory.md §6,省得以后再查一遍。
同时新增一条「仍然成立」条目:embedding 只在
POST /api/brand-voices创建时写(server/index.js:3419是唯一写点),目前只有 GET/POST/DELETE、没有 update 路由所以暂时无害,但以后加编辑接口必须重新 embed。验证
npm test→ 656/656 通过提醒
prod 仍停在
00049-w2x,#6–#21 这一批(含 brand-voice 修复)尚未部署。部署前检查项见docs/MASTER_PLAN_2026-08.md§5 —— 这批改了启动契约(MAILBOX_ENCRYPTION_KEY现在 fail-fast、webhook 无 secret 时 fail-closed)。🤖 Generated with Claude Code