Skip to content

docs: 修正入门文档里已经失效的运维事实 - #26

Merged
oratis merged 2 commits into
mainfrom
claude/eloquent-dirac-679fc8
Aug 9, 2026
Merged

docs: 修正入门文档里已经失效的运维事实#26
oratis merged 2 commits into
mainfrom
claude/eloquent-dirac-679fc8

Conversation

@oratis

@oratis oratis commented Aug 9, 2026

Copy link
Copy Markdown
Owner

背景

收到一份 brand-voice embedding 的 bug 报告,说 server/brand-voice-search.js 用错了 llm.embed() 的签名。排查结论:问题真实存在过,但已经在 #200c5323b)修掉了 —— 两个调用点现在都是 const { vectors } = await llm.embed([text]),契约测试 server/__tests__/brand-voice-embed-contract.test.js 也已经在仓库里。所以本 PR 不含任何代码修改

但核对上下文的过程中撞上好几处文档与现状不符,每一处都会让下一个会话走一段冤枉路,所以单独收成这个 docs PR。

改了什么

位置 文档写的 实际
CLAUDE.md ×2 / memory.md ×3 prod DB 密码"在 .env 里" 这台机器上没有 .env,只有 .env.example。改为 gcloud secrets versions access latest --secret=DATABASE_URL --project=gameclaw-492005
CLAUDE.md(两处自相矛盾:377 / 234)、memory.md ×2(234) 服务端测试数 656 个 / 69 个文件,~1 秒
CLAUDE.md「Frontend has no tests」+「4 Vitest component tests」 前端没测试 13 个 vitest 文件 + 5 条 Playwright(3 个 spec),与 memory.md §6 已关闭表一致
memory.md §5.4「没有 Sentry / OTEL(Sprint 1 待加)」 没接入 都已接入server/sentry.js / server/otel.js),只是要配 SENTRY_DSN / OTLP endpoint 才上报。原文与同文件 §6 和 CLAUDE.md 自相矛盾

顺带查证的生产事实

借这次机会用 Cloud SQL Auth Proxy 只读查了一次 prod:

brand_voices coverage: { total: 0, with_embedding: 0, with_model: 0 }

表是空的 —— embedding 写入路径坏了这么久并没有造成数据损失,不需要 backfill。 下次部署后创建的第一条 brand voice 就会正常写入向量。这条结论记进了 memory.md §6,省得以后再查一遍。

同时新增一条「仍然成立」条目:embedding 只在 POST /api/brand-voices 创建时写(server/index.js:3419 是唯一写点),目前只有 GET/POST/DELETE、没有 update 路由所以暂时无害,但以后加编辑接口必须重新 embed

验证

  • 纯文档改动,未触碰任何代码路径
  • npm test656/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

oratis and others added 2 commits August 9, 2026 23:05
排查一份 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>
@oratis

oratis commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

Review: approving — every claim checked, but the numbers had themselves gone stale

A docs PR is only worth its accuracy, so I re-verified each claim against main at 7df4183 instead of reading the diff for plausibility.

claim verdict
no local .env, only .env.example ls confirms .env: No such file or directory
Sentry + OTEL wired server/sentry.js, server/otel.js both present
13 Vitest files under client/src/{components,pages,utils}/ ✅ exactly 13 — 6 / 5 / 2 across those three dirs
5 Playwright tests across 3 specs ✅ 3 spec files in e2e/tests/
brand_voices empty in prod → no backfill ✅ consistent with 0c5323b; not re-queried
656 tests / 69 files stale — actually 678 / 71

Fixed in b9dbea5

#23 (+9 tests, +1 file) and #24 (+7, +1) merged while this branch sat open, so 656 / 69 was wrong before it could land. That's precisely the failure mode this PR exists to fix, just with a shorter fuse. Corrected in all five places — CLAUDE.md ×2, memory.md §5.2, §7.3, and the Last reviewed footer, which also still read post #20.

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 added

The SQLITE_BUSY flake, because it cost me a diagnostic detour on this very batch. npm test is node --test, which runs files concurrently against the one shared influencex.db at the repo root — writes collide and 2–5 files go red on a rotating cast. It reproduces on main with zero changes applied, and serialized (--test-concurrency=1) is a stable 678/678.

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 main, and on main + #25 + this branch.

Merging.

@oratis
oratis merged commit f8686bc into main Aug 9, 2026
5 checks passed
@oratis
oratis deleted the claude/eloquent-dirac-679fc8 branch August 9, 2026 15:16
oratis added a commit that referenced this pull request Aug 9, 2026
…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>
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