chore: 一致性门禁收尾(plan 计数、尾换行、消息与注释润色)

This commit is contained in:
lhl
2026-08-09 17:11:38 +08:00
parent f6172903b8
commit 464423b7ef
3 changed files with 5 additions and 3 deletions
+3 -2
View File
@@ -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 是否一致。"