Wave 8: tech-debt audits, core unit tests, CLI pipe input (W11.1-W11.7)
Some checks failed
CI / Determine matrix (push) Has been cancelled
CI / ${{ matrix.os }} / ${{ matrix.build_type }} (push) Has been cancelled

- W11.1 context_plugin audit (architect-huang): 3 findings on ABI exception
  safety, strdup null checks, dead g_max_tokens variable. Rating: B.
- W11.2 config audit (engineer-chen): identified 74-line TOML parser
  duplication between config_plugin and config_store, dual-store data
  isolation, dangling c_str() risk. Rating: C.
- W11.3 event_bus + service_registry unit tests (qa-liu): 12 cases total,
  ctest coverage 2 -> 4 targets, 100% pass.
- W11.4 CLI stdin pipe mode (engineer-zhao): isatty detection, single-shot
  inference path with exit codes 0/1/2/3.
- W11.6 scripts/refresh_status.py (engineer-li): 431-line generator that
  scans 16 profile.md + 5 group.md to regenerate STATUS.md.
- W11.7 destructive testing (qa-xu): 10 input scenarios PASS, found bin
  copy mismatch (BUG-1) plus 3 minor UX bugs for follow-up.

Verified: cmake build 0 error, ctest 4/4 pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-05-27 09:06:25 +08:00
parent 004a81db96
commit bb2e8c0220
14 changed files with 1122 additions and 18 deletions

View File

@@ -0,0 +1,53 @@
# W11.7 破坏性输入测试报告
**测试人**: 徐磊 (qa-xu)
**日期**: 2026-05-27
**被测二进制**: `build/dstalk-cli/dstalk-cli.exe` (MD5: 803ca2ea)
**源 Commit**: `004a81d` (Wave 7: W10.1-W10.4)
**测试环境**: Windows 11 Pro, 无 API key, 无 config.toml, 无 plugins/
## 测试结果汇总
| # | 场景 | 结果 | 退出码 | 备注 |
|---|------|------|--------|------|
| 1 | 启动+EOF (空pipe) | PASS | 0 | 直接进入 shutdown干净退出 |
| 2 | 空字符串回车 | PASS | 0 | fgets→len==0→continue 正确跳过 |
| 3 | 10000 字符超长行 | PASS | 0 | 截断警告正常触发,剩余字符 drain 正确 |
| 4 | 纯空格/纯Tab | PASS | 0 | 被当 AI promptAI 不可用报错不崩溃 |
| 5 | 未知 /command | PASS | 0 | "未知命令" 提示正常 |
| 6 | /status + /history 无session | PASS | 0 | /status 正常显示默认值;/history 报 "session service unavailable" |
| 7 | 中文+emoji prompt | PASS | 0 | UTF-8 无问题AI 不可用报错不崩溃 |
| 8 | ASCII 控制字符 \x01-\x08 | PASS | 0 | 被当 AI prompt 处理,无崩溃 |
| 9 | /quit 后重启 | PASS | 0,0 | 两次启动无残留状态 |
| 10 | 空 stdin (printf '') | PASS | 0 | fgets 立即返回 NULL干净退出 |
**结论: 10/10 全部 PASS零崩溃零 hang。**
## 发现的 Bug
### BUG-1 [CRITICAL] build/bin/dstalk-cli.exe 是损坏副本
- **MD5**: d8e8c92b (67,072 bytes) vs 正常 803ca2ea (66,048 bytes)
- **症状**: 所有命令(含 /help、/quit)被当 AI prompt 处理;任何输入退出码固定为 3错误信息是英文("AI or session service unavailable")而非正常的中文
- **推测**: CMake install/post-build 步骤拷贝了不同版本源码编译的产物,类似 PM-001 stale obj 模式
- **影响**: 任何人若按文档路径 `build/bin/dstalk.exe` 运行将得到完全不可用版本
### BUG-2 [MEDIUM] /clear 在 session 不可用时谎报成功
- `main.cpp:168-172`: `if (g_session) g_session->clear()` 后无条件 `printf("[OK] 会话已清空")`
- g_session==null 时也打印成功,误导用户
### BUG-3 [LOW] /context 在 session 不可用时静默无输出
- `main.cpp:175-185`: 仅 `if (g_session) {...}` 无 else 分支
- 用户输入 /context 后零反馈,不知所措
### BUG-4 [LOW] /file write 裸命令被当未知命令
- `strncmp(line, "/file write ", 12)` 要求尾部空格,`/file write` (无参) 匹配失败落入"未知命令"
- 应给用法提示而非未知命令
## 变更历史
| 日期 | 版本 | 变更 |
|------|------|------|
| 2026-05-27 | 1.0 | W11.7 破坏性测试10 场景全 PASS发现 4 个 bug (1 critical) |