session-mechanism:多角度自检后的 5 处修补 + 新增「21 条条目名三方同源」自测

按用户令「优化完成后 在详细多角度 检查确认无误」,对 05/06/SKILL.md/索引 做了一轮多角度核对。

查出的真问题(都已修):
- 05 残留旧编号「06 的 B⑨/B⑥」⇒ 06 的编号已统一成 #N,改为 #9/#6
- 06 总表 #15 写「上游→下游不断裂」,而正文与 SKILL.md 都写「上下游不断裂」⇒ 统一
- 05 用了旧称「宿主库」(该文件 10-15 新写,按术语规范应当用正式名)⇒ 改「WorkBuddy 本体的库」
- 06 的 A 段声明「不复述判据」,但 #3 条又把 env/roots.env 的细节抄了一遍 ⇒ 删复述
- SKILL.md §0 ⑨ 的 A 段没编号、C 层写简写(「职责不越界」vs 正文「步骤间职责不越界」)⇒ 补 #1~#5、统一 C 层全名

新增自测 t_skill06_entries_same_source(5 项):SKILL.md §0 ⑨ 与 06 正文/总表 21 条逐条同名(数字 + 名字)。
该判据第一版自己就有两个毛病,靠变异对照照出来:① 抓取正则在「(」处不停 ⇒ 名字带括号内容;② 06 正文 A 段是
列表项、SKILL.md 却没编号 ⇒ 两边都只抓到 16 条。修完口径后三态齐全(基线绿/写简写则红并精确报出 #13/复原绿)。

验收:全量自测 PASS 113 / FAIL 0;体检 fail 0 / warn 1 / ok 15;manifest 82 份;install.py --verify 全绿;
05 = 95 行、06 = 120 行(均在一页纸内)。
This commit is contained in:
admin committed 2026-10-16 00:00:44 +08:00
1 parent ea02f186a5
commit 24a644f57b
4 files changed
+48 -6

No files matched your search

+42
View File
@@ -7920,5 +7920,47 @@ def t_term_table_single_source():
return rows
@case("🔴 06 的 21 条条目名:SKILL.md §0 ⑨ 与 06 正文/总表三方逐条同名(⛔ 写成简写=对不上)")
def t_skill06_entries_same_source():
"""🔴 2026-10-15 立(当日实测踩到)。
`SKILL.md §0 ⑨` 是**匹配面**(点开技能就读到),`06` 正文与总表是**真源**。
实测:§0 把 C 层写成简写「职责不越界」,而正文是「步骤间职责不越界」——
两边都不报错,读者按简写去正文里搜就搜不到。
⇒ 判据落在**21 条逐条同名**上(数字 + 名字都要对上)。
"""
import re as _re
SK = (HERE.parent / "SKILL.md").read_text(encoding="utf-8", errors="replace")
P6 = (HERE.parent / "references" / "06-技能优化规程.md").read_text(
encoding="utf-8", errors="replace")
i = SK.find("**⑨ 我要优化技能本身**")
j = SK.find("\n\n", i) if i >= 0 else -1
blk = SK[i:j] if i >= 0 and j > i else ""
a = {int(n): nm for n, nm in _re.findall(r"#(\d{1,2}) ([^(\s]+)", blk)}
b = {int(n): nm for n, nm in _re.findall(r"^(?:- )?\*\*(\d{1,2}) ([^(\s]+)\*\*", P6, _re.M)}
c = {int(n): nm for n, nm in _re.findall(
r"^\| (\d{1,2}) \| [A-D] [^|]*\| ([^|\s]+) \|", P6, _re.M)}
# 🔴 句末标点不算差异(§0 是句子、正文是标题、「配置外置 /」后面跟分隔符)——
# 2026-10-15 实测:不清洗时 #5 会因「入仓按白名单。」多一个句号而报红,那是**假红**。
def _clean(d):
return {k: _re.sub(r"[。.,,、;;//]+$", "", v) for k, v in d.items()}
a, b, c = _clean(a), _clean(b), _clean(c)
rows = [("§0 ⑨ 读到条目名 %d 条(应 21)" % len(a), len(a) == 21),
("06 正文读到条目名 %d 条(应 21)" % len(b), len(b) == 21),
("06 总表读到条目名 %d 条(应 21)" % len(c), len(c) == 21)]
for tag, other in (("06 正文", b), ("06 总表", c)):
bad = sorted(k for k in set(a) | set(other) if a.get(k) != other.get(k))
detail = ""
if bad:
k0 = bad[0]
detail = "(⛔ 首处不一致 #%d:§0=%r/%s=%r)" % (k0, a.get(k0), tag, other.get(k0))
rows.append(("§0 ⑨ 与 %s **21 条逐条同名**%s" % (tag, detail), not bad))
return rows
if __name__ == "__main__":
sys.exit(main())