docs: 修正错误码一致性 spec/plan 计数笔误(LLM 错误码实为 4 条非 5)

This commit is contained in:
lhl
2026-08-09 16:56:49 +08:00
parent bb38a47445
commit f6172903b8
2 changed files with 5 additions and 5 deletions
@@ -106,10 +106,10 @@ def test_error_doc_llm_rows_resolve_to_exception():
def test_error_doc_stable_llm_row_count():
# 格式护栏:LLM 行数 === 5;新增/删除 LLM 错误码需显式更新此数
# 格式护栏:LLM 行数 === 4;新增/删除 LLM 错误码需显式更新此数
mapping = _extract_llm_error_rows(API_DOC.read_text(encoding="utf-8"))
assert len(mapping) == 5, (
f"api §7 LLM 错误码行数应为 5,实际 {len(mapping)}"
assert len(mapping) == 4, (
f"api §7 LLM 错误码行数应为 4,实际 {len(mapping)}"
"新增/删除错误码须同步更新此计数。"
)
@@ -16,7 +16,7 @@
## 2. 范围与不做的事
**范围:**
- 仅验证 §7 表格中**来源列以 `exceptions.` 开头**的 5 条 LLM 错误码行(LLM_TIMEOUT / LLM_NETWORK_ERROR / LLM_NOT_CONFIGURED / LLM_PARSE_ERROR
- 仅验证 §7 表格中**来源列以 `exceptions.` 开头**的 4 条 LLM 错误码行(LLM_TIMEOUT / LLM_NETWORK_ERROR / LLM_NOT_CONFIGURED / LLM_PARSE_ERROR
- 双向验证:异常树 → 文档、文档 → 异常树
**不做(YAGNI):**
@@ -54,7 +54,7 @@ def _extract_llm_error_rows(document: str) -> dict[str, str]:
|---|------|---------|---------|
| 1 | `test_error_doc_lists_every_llm_error_code` | 异常树 → 文档 | 遍历 `LLMError.__subclasses__()`,每个子类 `error_code`(非 None)必须出现在文档映射中,且来源类名 == 子类名 |
| 2 | `test_error_doc_llm_rows_resolve_to_exception` | 文档 → 异常树 | 文档映射中每个错误码都能在 `LLMError.__subclasses__()` 中找到 `error_code` 相同、类名匹配的唯一类 |
| 3 | `test_error_doc_stable_llm_row_count` | 格式护栏 | 文档映射中 LLM 行数 == 5(防止表格结构变化静默失效;新增/删除 LLM 行需显式更新此数) |
| 3 | `test_error_doc_stable_llm_row_count` | 格式护栏 | 文档映射中 LLM 行数 == 4(防止表格结构变化静默失效;新增/删除 LLM 行需显式更新此数) |
| 4 | `test_error_doc_parse_guard_prevents_silent_noop` | 格式护栏 | 若解析结果为空(表格格式被改动导致正则失配),立即硬失败而非静默通过 |
### 3.5 失败可诊断(DX 修正 F1/F2