BUG-995: privacy tests were swallowing node:test TAP by replacing process.stdout.write without calling through.
57 lines
2.5 KiB
Markdown
57 lines
2.5 KiB
Markdown
# PROGRESS · 寒暄隐私测试 stdout mock 透传(2026-09-21 / 执行 2026-09-22)
|
||
|
||
工作树:`.worktrees/smalltalk-test-stdout-mock-20260921`
|
||
分支:`codex/smalltalk-test-stdout-mock-20260921`
|
||
基线:`origin/staging` @ `24795cbf`(任务书写 `a06829b3`;开工 fetch 后实际 head)
|
||
|
||
## 任务状态
|
||
|
||
| 任务 | 状态 | 说明 |
|
||
| --- | --- | --- |
|
||
| F1 mock 透传 | 完成 | 保存并 bind 原始 `write`,记录后原样转发,返回原始返回值 |
|
||
| F1 单文件三次 | 完成 | 每次 `# tests 33` / `# fail 0` / `default Mastra adapter` 的 `ok` 行 = 4 |
|
||
| F1 变异 | 完成 | `invalid_schema` / `bad_json` 的 `not ok` 含用例名和 `PROBE`;已撤回 |
|
||
| F1 隐私探针 | 完成 | 写 sentinel 后三条均 `SDK must not log private text`;已撤回 |
|
||
| F2 记录 | 完成 | BUG-995;状态板改待验收;无 CHANGELOG |
|
||
| F3 `frontend/AGENTS.md` | 完成 | 比用例名列表 diff,不比 `# tests` |
|
||
|
||
未改既有断言,无三栏。未跑 `next build`(只动测试与文档,不碰 `frontend/src`)。
|
||
|
||
## 开工复现
|
||
|
||
本机 Windows 单跑该文件三次(改前)已经是 4 条 `default Mastra adapter` / `# tests 33`,没有复现任务书在 Linux 主检出上看到的 1/4。仍按 D2 做透传:全仓只有这一处接管 `process.stdout.write`,且变异证明失败报告现在带用例名。
|
||
|
||
## 变异输出片段(已撤回,未提交)
|
||
|
||
`invalid_schema`:
|
||
|
||
```
|
||
# Subtest: default Mastra adapter protects privacy and usage on invalid_schema
|
||
not ok 21 - default Mastra adapter protects privacy and usage on invalid_schema
|
||
PROBE
|
||
```
|
||
|
||
`bad_json`:
|
||
|
||
```
|
||
# Subtest: default Mastra adapter protects privacy and usage on bad_json
|
||
not ok 22 - default Mastra adapter protects privacy and usage on bad_json
|
||
PROBE
|
||
```
|
||
|
||
隐私探针(`process.stdout.write(sentinel)`):exit 1,`# fail 3`,三条均含 `SDK must not log private text`。
|
||
|
||
## 测试
|
||
|
||
| 项 | 结果 |
|
||
| --- | --- |
|
||
| `tsc --noEmit` | 0 错 |
|
||
| `npm run lint` | 0 error / 119 warning |
|
||
| 单文件 ×3(改后) | 每次 33 / 0 fail / Mastra `ok` 4 |
|
||
| 全量 `npm test` 本机 | `# tests 3603` / `# pass 3514` / `# fail 89`;Mastra `ok` 4。89 条为 Windows Docker/symlink/shell 既有缺口,与本单无关;Linux 门禁以推送后 run 为准 |
|
||
| `npm run build` | 未跑(本单不碰 `frontend/src`) |
|
||
|
||
## 环境缺口
|
||
|
||
本机全量三次无法当作门禁证据:与基线相同量级的 89 条 Windows 失败(Docker 网段、symlink、chmod、shell)。本单验收看 Gitea `backend-quality-gate` 的该文件 TAP 与全量绿盘。
|