Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LutgzyJqNhPpZy1nFsJtN3
40 lines
3.1 KiB
Markdown
40 lines
3.1 KiB
Markdown
# TASK · 服务器内存与数据库往返修复单(issue #58,第 1 次打回)
|
||
|
||
- 日期:2026-10-14
|
||
- 原任务书:`docs/tasks/TASK-node-runtime-resources-20261013.md`
|
||
- 被验 SHA:`4c3485bc2352e8f9de097d81d9979092ee2bb280`(`codex/node-runtime-resources-20261013`)
|
||
- 执行方:Grok,同一分支续做(落后 staging 时用 merge,不改写已推历史)
|
||
- BUG 编号:沿用 BUG-1326~1328、1346
|
||
|
||
## 1. 验收结论:一项未通过,其余全部通过
|
||
|
||
| 检查 | 结果 | 证据 |
|
||
| --- | --- | --- |
|
||
| 前端全量 `npm test`(与 staging 基线逐名比对) | **未通过:新增 1 条真实失败** | `runtime-sources-no-test-imports.test.ts`「files copied into the web image never import from frontend/tests」:`actual: ['scripts/bench-local-pg-roundtrips.ts']` |
|
||
| 同上,另一条新增 | 环境缺口(不算未通过) | `database-local-postgres-session-setup.test.ts` 报 `spawnSync docker ENOENT`,本机无 Docker;以 Grok 的 test:db 回报为准 |
|
||
| T1 报告 worker 摘监听 / T1b | 通过 | 代码与新测试逐行看过 |
|
||
| T2 元数据缓存 + 合并身份设置 | 通过 | 角色仍只来自构造函数白名单;只缓存表结构;`off` 走原语句顺序;A/B 记录 49→32 往返、中位数降 51.9%、逐字节一致 |
|
||
| T3 三张内存表 | 通过 | — |
|
||
| T6 登录读缓存 | 通过(默认关,理由成立) | 改密码 / 注销 / 后台三处已强制绕过;默认关是因为没有身份库真实耗时对照,符合原任务书门槛 |
|
||
| tsc / lint / next build | 通过 | 0 错 / 0 error / `/` 仍 Static |
|
||
| 越界 / 隐私 | 通过 | — |
|
||
|
||
**根因**:`frontend/scripts/bench-local-pg-roundtrips.ts` 第 16 行 `import { startPostgresFixture } from "../tests/helpers/postgres-fixture.ts";`。web 镜像只复制 `frontend/src` 与 `frontend/scripts`,不复制 `frontend/tests`,而 `next build` 会类型检查 `frontend/` 下所有 `.ts`——推上 staging 后镜像构建会失败(BUG-1140,同一形状)。**这条路径是原任务书 T4 指定的,错在任务书,不是执行偏差。**
|
||
|
||
## 2. 修法要求
|
||
|
||
1. 把脚本挪到 `frontend/tests/bench-local-pg-roundtrips.ts`(文件名**不得**以 `.test.ts` 结尾,避免被 `npm test` 自动收进去),导入改成 `./helpers/postgres-fixture.ts`;脚本头注释里的运行命令改成 `npx tsx tests/bench-local-pg-roundtrips.ts`。
|
||
2. 同步改引用:`docs/tasks/PROGRESS-node-runtime-resources-20261013.md`、`docs/testing/node-runtime-resources-ab-20261013.md`。原任务书不改(历史记录),在 PROGRESS 里写一行「按修复单挪位置」。
|
||
3. 不改任何业务代码;A/B 数字不用重跑。
|
||
4. 先把最新 `origin/staging` 合并进分支(用 merge)。
|
||
|
||
## 3. 验收标准
|
||
|
||
- `frontend/tests/runtime-sources-no-test-imports.test.ts` 通过;
|
||
- 前端全量 `npm test` 的失败清单只剩 staging 基线那 24 条 + 本单新增的 Docker 测试(无 Docker 时);
|
||
- `git diff 4c3485bc2..<新 SHA> -- frontend/src` 为空(业务代码一字未动)。
|
||
|
||
## 4. 让步顺序
|
||
|
||
无。这是第 1 次打回;再打回会停下等产品负责人。
|