chore: 一致性门禁收尾(plan 计数、尾换行、消息与注释润色)
This commit is contained in:
@@ -58,3 +58,4 @@
|
||||
| 2026-08-09 13:51 | Agent 实现 | LLM 错误码对齐 Task4:api-design §7 补 LLM_NETWORK_ERROR 行(对齐异常树 error_code)。在 docs/api-design.md §7 错误码表 LLM_TIMEOUT 行后插入新行 `| LLM_NETWORK_ERROR | 502 | 网络失败/5xx 重试耗尽 | retry / skip / abort | exceptions.LLMNetworkError |`,保留 LLM_NOT_CONFIGURED/LLM_PARSE_ERROR 与 INTERNAL_ERROR 兜底行不动;纯文档改动,全量回归 128 passed 覆盖 100.00%(803 stmts/188 br),fail_under=99 达标 | docs/api-design.md, _AI_USAGE_LOG.md | deepseek-v4-flash-free |
|
||||
| 2026-08-09 | 测试验证 | 里程碑3.1 LLM错误码对齐收尾改动(最终评审 Minor):① 删除 tests/test_inference_engine.py 中 test_chat_failed_error_code_not_configured 首行未使用变量 client = FakeLLMClient(...)(死代码,未引用,函数自洽性核查通过);② 补齐 src/genesis/inference/engine.py 文件末尾换行符(最后一字节 ) → \n)。覆盖测试 22 passed;pytest 全量 128 passed,覆盖 100.00%(803 stmts/188 br),fail_under=99 达标;提交见 git log | tests/test_inference_engine.py, src/genesis/inference/engine.py, _AI_USAGE_LOG.md | deepseek-v4-flash-free |
|
||||
| 2026-08-09 | 测试验证 | 新增 api §7 ↔ 异常树 error_code 一致性门禁测试(防文档漂移)。新建 tests/test_api_design_consistency.py(4 用例:树→文档 / 文档→树双向断言 + 行数护栏 / 空解析护栏);首次运行 RED(行数护栏 ==5 与事实 4 冲突,文档与异常各为 4 条/4 个子类,双向一致)→ 修正护栏为 4 → GREEN(聚焦 4 passed);pytest 全量 132 passed 覆盖 100.00%(803 stmts/188 br),fail_under=99 达标;提交见 git log | tests/test_api_design_consistency.py, _AI_USAGE_LOG.md | deepseek-v4-flash-free |
|
||||
| 2026-08-09 | 测试验证 | 一致性门禁最终评审收尾修复(Important x1 + Minor x3):① plan 文档 Interfaces 段 L311-314「五行 LLM 行」→「四行」(与 ==4 护栏一致);② 测试文件补尾随换行(末字节 " → \n);③ 断言消息改「异常类存在文档未登记或来源类名失配的 error_code」(覆盖双失败场景);④ _LLM_ROW_RE 加正则隐式限域注释。覆盖测试 4 passed;pytest 全量 132 passed 覆盖 100.00%,fail_under=99 达标 | docs/superpowers/plans/2026-08-09-error-code-consistency-test.md, tests/test_api_design_consistency.py, _AI_USAGE_LOG.md | deepseek-v4-flash-free |
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
- Modify: `_AI_USAGE_LOG.md`(追加一行)
|
||||
|
||||
**Interfaces:**
|
||||
- Consumes: `src/genesis/inference/exceptions.py` 的 `LLMError.error_code` 类属性(基类 `None`;四子类 `LLM_TIMEOUT`/`LLM_NETWORK_ERROR`/`LLM_NOT_CONFIGURED`/`LLM_PARSE_ERROR`);`docs/api-design.md` §7 表格(L311-314 五行 LLM 行,行格式 `| \`CODE\` | 含义 | ... | exceptions.Xxx |`)
|
||||
- Consumes: `src/genesis/inference/exceptions.py` 的 `LLMError.error_code` 类属性(基类 `None`;四子类 `LLM_TIMEOUT`/`LLM_NETWORK_ERROR`/`LLM_NOT_CONFIGURED`/`LLM_PARSE_ERROR`);`docs/api-design.md` §7 表格(L311-314 四行 LLM 行,行格式 `| \`CODE\` | 含义 | ... | exceptions.Xxx |`)
|
||||
- Produces: 无(测试文件独立,无下游依赖)
|
||||
|
||||
- [ ] **Step 1: 写失败测试**
|
||||
|
||||
@@ -16,6 +16,7 @@ from genesis.inference.exceptions import LLMError
|
||||
API_DOC = Path(__file__).resolve().parents[1] / "docs/api-design.md"
|
||||
|
||||
# §7 表格 LLM 行:| `CODE` | 语义 | ... | exceptions.Xxx |
|
||||
# 当前全文档仅 §7 含 exceptions. 行,此正则隐式限域;若他处新增类似行需加小节锚定。
|
||||
_LLM_ROW_RE = re.compile(
|
||||
r"^\|\s*`([A-Z][A-Z_]+)`\s*\|.*\|\s*exceptions\.([A-Za-z_]+)\s*\|$"
|
||||
)
|
||||
@@ -51,7 +52,7 @@ def test_error_doc_lists_every_llm_error_code():
|
||||
if cls.error_code not in mapping or mapping[cls.error_code] != cls.__name__
|
||||
}
|
||||
assert not missing, (
|
||||
"异常类表存在文档未登记的 error_code(请同步 api-design.md §7):\n"
|
||||
"异常类存在文档未登记或来源类名失配的 error_code(请同步 api-design.md §7):\n"
|
||||
+ repr(missing)
|
||||
)
|
||||
|
||||
@@ -80,4 +81,4 @@ def test_error_doc_stable_llm_row_count():
|
||||
def test_error_doc_parse_guard_prevents_silent_noop():
|
||||
# 格式护栏:解析结果为空须硬失败(表格格式变更会静默失效,这里立即暴露)
|
||||
mapping = _extract_llm_error_rows(API_DOC.read_text(encoding="utf-8"))
|
||||
assert mapping, "api §7 表格解析结果为空:若无匹配行,请检查表格格式与 _LLM_ROW_RE 是否一致。"
|
||||
assert mapping, "api §7 表格解析结果为空:若无匹配行,请检查表格格式与 _LLM_ROW_RE 是否一致。"
|
||||
|
||||
Reference in New Issue
Block a user