fix: rule_signature conditions=None防御 + 0行表格覆盖率 + UT覆盖 - Closes #21
CI / test (pull_request) Successful in 9s

- step3 rule_signature: trigger.conditions=None 时使用 `or []` 防御
- step1 _quick_validate: total_rows=0 时行覆盖率设为 100% 而非 0%
- test_step1: 新增 TestHasSectionContent (10个) + TestQuickValidateEmptySections (2个)
- test_step3: 新增 TestRuleSignature (7个) + TestNormalizeRule (4个)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-01 13:29:25 +08:00
parent 50eb37094a
commit da17b3b3b2
4 changed files with 380 additions and 1 deletions
@@ -566,6 +566,9 @@ def _quick_validate(
if src.get("type") == "table" and src.get("row")
)
row_cov = covered_rows / max(total_rows, 1)
# When there are no table rows to cover, skip the check (not a coverage failure)
if total_rows == 0:
row_cov = 1.0
print(f" 表格行覆盖率: {row_cov:.0%} ({covered_rows}/{total_rows} rows)", flush=True)
if row_cov < SECTION_COVERAGE_TARGET:
gaps["coverage_warnings"].append(