工程(架构审查P1余项·闸件落地): §四待执行三项同批做完并同步文档——①static_scan.sh 的 S8 加 settlement/ 目录域反向对账(实有 .gd 未登记进清单即红,只覆盖该目录并写明根下四件结算码不在目录域内、仍归「模块归属」B1 登记面),S7 的 S7_B1_SET 与 S8_FILES 两份14文件抄本合一为单点 B1_SET(两份靠人工同步必漂),绿文案「10 个 .gd」改派生计数并申报反向对账已在案 ②audit_type_hints.py/audit_file_headers.py 各补扫描面空转自检(缺目录或零个 .gd 即红、绿时打印面件数;原实现 rglob 空集与 is_dir continue 两处静默绿,违背 test-conventions §7 零命中自检辅证与脚本前言自立纪律) ③architecture S 表 S8 行登记单点与反向对账判据、S9/S10 偏差句改判已清偿、版本1.33→1.34 ④审计报告 §4.2 待执行清单改判已落地并记验证口径。验证:static_scan 全量13条规则绿退出码0;两件负证(面清单改成不存在目录各返回1)正证(真实面158个 .gd 归零PASS)。§四 P1 四条至此全部闭合;零需求卡片(纯闸件属工程改动),待办清单与第五节P2按用户令未动

This commit is contained in:
DKChan committed 2026-11-03 20:37:31 +08:00
1 parent 47c752eaf3
commit c40db898aa
5 files changed
+53 -28

No files matched your search

+13 -9
View File
@@ -59,19 +59,23 @@ def audit_path(path):
def main():
# 扫描面空转自检:目录缺失或零个 .gd 一律判红——原实现 `if not is_dir(): continue`
# 会让路径写错静默零命中换绿,违背 test-conventions §7「零命中自检为辅证」。
missing = [d for d in SCAN_DIRS if not (ROOT / d).is_dir()]
face = [p for d in SCAN_DIRS for p in sorted((ROOT / d).rglob("*.gd"))]
if missing or not face:
print("[audit_file_headers] FAIL——扫描面为空(缺目录:%s;面清单:%s)"
% ("、".join(missing) if missing else "无", "、".join(SCAN_DIRS)))
return 1
violations = 0
for d in SCAN_DIRS:
base = ROOT / d
if not base.is_dir():
continue
for path in sorted(base.rglob("*.gd")):
for lineno, msg in audit_path(path):
print("%s:%d: %s" % (path.relative_to(ROOT), lineno, msg))
violations += 1
for path in face:
for lineno, msg in audit_path(path):
print("%s:%d: %s" % (path.relative_to(ROOT), lineno, msg))
violations += 1
if violations:
print("[audit_file_headers] FAIL: 文件头存量 %d 处(存量按 code-conventions §1.4.1 白名单清偿)" % violations)
return 1
print("[audit_file_headers] ok: 头注零黑名单命中(R0 载体/R2 日期/R3 变更叙事)")
print("[audit_file_headers] ok: 头注零黑名单命中(R0 载体/R2 日期/R3 变更叙事;扫描面 %d 个 .gd)" % len(face))
return 0
+13 -6
View File
@@ -78,16 +78,23 @@ def audit_file(path):
def main():
if hasattr(sys.stdout, "reconfigure"):
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
# 扫描面空转自检:目录缺失或零个 .gd 一律判红——路径写错不得静默零命中换绿
# (test-conventions §7「零命中自检为辅证」;game/tests/static_scan.sh 前言同款纪律)。
missing = [d for d in SCAN_DIRS if not (ROOT / d).is_dir()]
face = [p for d in SCAN_DIRS for p in sorted((ROOT / d).rglob("*.gd"))]
if missing or not face:
print("[audit_type_hints] FAIL——扫描面为空(缺目录:%s;面清单:%s)"
% ("、".join(missing) if missing else "无", "、".join(SCAN_DIRS)))
return 1
total = 0
for d in SCAN_DIRS:
for p in sorted((ROOT / d).rglob("*.gd")):
for line, rule, text in audit_file(p):
print("[%s] %s:%d: %s" % (rule, p.relative_to(ROOT).as_posix(), line, text))
total += 1
for p in face:
for line, rule, text in audit_file(p):
print("[%s] %s:%d: %s" % (rule, p.relative_to(ROOT).as_posix(), line, text))
total += 1
if total:
print("[audit_type_hints] FAIL——存量 %d 处(R1 无类型容器/R2 有值返回缺类型/R3 参数缺类型)" % total)
return 1
print("[audit_type_hints] PASS——产品码类型闸归零(R1/R2/R3)")
print("[audit_type_hints] PASS——产品码类型闸归零(R1/R2/R3;扫描面 %d 个 .gd)" % len(face))
return 0