chore: 删除 5 个遗留调试脚本并同步文档引用

- 删除 agent_loop.py / dwg_review_agent.py / countOfCircle.py
  (硬编码 DeepSeek API Key)与 test.py / test_autoagent.py
  (重复实现;且 test_autoagent.py 名字与 pytest 的 test_*.py 收集规则冲突)
- CODEBUDDY.md 测试章节改为「pytest 快层 + verify_* 慢层」
- review_checklist.json 描述改指 dwg_review 包
- ai.memory 同步引用与历史说明

安全:Key 已随提交 bdd77af 进入 git 历史并推到远程,删除文件不能清除历史,
需去 DeepSeek 控制台轮换该 Key(已在 ai.memory 备案)。
This commit is contained in:
gjm committed 2026-10-14 19:07:35 +08:00
1 parent 0656397a68
commit 8c0fcfee83
10 files changed
+53 -701

No files matched your search

+22 -6
View File
@@ -27,16 +27,32 @@ cmake --build --preset R243 --config Release
### 测试
工程内**没有单元测试框架**。所谓“测试”是根目录下的 Python 脚本,它们是 MCP 客户端的联调工具,**必须先启动已加载插件的 CAD,并确认 8080 端口在监听**:
分两层,**互不替代**:
**快层 —— pytest 离线单元测试**(`tests/`,无需 CAD、不联网、秒级):
```bash
python test.py # 最小示例:截图 -> 发给 DeepSeek 视觉模型 -> 回答
python test_autoagent.py # 仅拉取一次视口截图并保存为 test_screenshot.png
python countOfCircle.py # 伪造一次 zoom_window_normalized 调用,验证 TCP 链路
python agent_loop.py # 完整 Agent 循环(多回合 截图/缩放/结论),需 openai 包与 API Key
pip install -r requirements-dev.txt # 仅 pytest
python -m pytest # 期望全绿
```
脚本通过 TCP 连接 `127.0.0.1:8080` 收发 JSON-RPC。`agent_loop.py` / `test.py` 中硬编码了 DeepSeek API Key 与模型名,属于调试脚本。
全部使用假 LLM + 假 MCP 基座(`tests/fakes.py`),锁定 `dwg_review` 流水线既有行为。
配置见 `pytest.ini`(`testpaths = tests`)与根 `conftest.py`(把仓库根加入 `sys.path`,
并提供 `RENDER_WAIT=0` / `REPORT_DIR=tmp` 两个 fixture)。**注意**:`dwg_review.config`
的常量在导入期定值,测试改 `os.environ` 无效,须 `monkeypatch.setattr(config, ...)`。
**慢层 —— 端到端冒烟脚本**(仓库根 `verify_*.py`,**必须先启动已加载插件的 CAD,并确认
8080 端口在监听**):
```bash
python verify_mcp_frame.py # 基座最小集:分帧 / id / isError 映射
python verify_mcp_tcp_hardening.py # TCP 收发路径加固(超长帧 / 粘包 / 半关闭)
python verify_mcp_fault_injection.py # 工具异常保护(类型错误不再崩 CAD)
python verify_stdio_bridge.py # stdio ↔ TCP 桥(协议协商 / 转发 / 通知)
python verify_annotate.py # 批注回写链路
```
这些脚本通过 TCP 连接 `127.0.0.1:8080` 收发 JSON-RPC。
## 架构