Skip to content

feat: add --strict mode to Research Pack validator#88

Merged
ShadyUnderLight merged 1 commit into
mainfrom
feat/validator-strict-mode
May 12, 2026
Merged

feat: add --strict mode to Research Pack validator#88
ShadyUnderLight merged 1 commit into
mainfrom
feat/validator-strict-mode

Conversation

@ShadyUnderLight
Copy link
Copy Markdown
Owner

问题

Closes #82validate_research_pack.py 当前只检查 required headings / empty sections / placeholder artifacts,但不会校验 source ID 格式、source/claim 映射关系、或 audit status。

修改

scripts/validate_research_pack.py

新增 --strict 参数,开启后依次执行:

  1. Source ID 检查 — Source register 中是否有 [Sxx] 格式的 ID
  2. 引用完整性 — 正文/claim register 引用的 [Sxx] 是否都有定义;是否有定义了但从未使用的源
  3. Claim register 标签检查 — 提醒 claim 缺少 [Sxx]/[Ixx]/[Uxx] 引用标签
  4. Final audit status — 值必须是 Pass / Partial / Fail 之一;Partial 输出 warning (exit 0),Fail 输出 error (exit 4)

原有结构检查(missing headings, empty sections, artifacts)保持不动,且总是运行。

退出码:

含义
0 正常 / strict 警告
1 用法错误
2 缺少 heading 或空 section
3 占位符残留
4 strict 模式硬错误

scripts/test_validator_regression.py

新增 9 个 strict 模式测试:

  • strict valid baseline — 完整 source ID + Pass,exit 0
  • strict no source IDs — source register 无 [Sxx],exit 4
  • strict undefined source ref — claim 引用 [S99] 但未定义,exit 4
  • strict unused source id[S01] 定义了但未引用,exit 0 (warning)
  • strict audit status Partial — exit 0 (warning)
  • strict audit status Fail — exit 4 (error)
  • strict audit status invalidPending 非法值,exit 4
  • strict claim no evidence tags — claim 缺引用标签,exit 0 (warning)
  • non-strict ignores strict checks — 不加 --strict 时不报错

examples/research-pack-example.md

补充 [S01][S03] 到 Source register,claim register 添加引用,Final audit status 改为 Pass

.github/workflows/ci.yml

quick job 增加 --strict 模式检查示例文件。

不改的

  • 不改 md_to_pdf.py / render_pdf.py / markdown_to_html.py
  • 不改 README.md / SKILL.md / references/
  • 不改 checklists/(checklist 是手动审计工具,validator 是自动化补充)

测试

python3 -m py_compile scripts/*.py
python3 scripts/test_validator_regression.py    # 17 tests, all PASS
python3 scripts/validate_research_pack.py examples/research-pack-example.md --strict  # exit 0

@ShadyUnderLight ShadyUnderLight force-pushed the feat/validator-strict-mode branch 2 times, most recently from 05427f0 to 8cbc217 Compare May 11, 2026 16:03
- Add --strict flag to validate_research_pack.py that checks source ID
  format, reference mapping (body claims reference defined IDs), unused
  source IDs, claim register evidence tags, and Final audit status
  (Pass/Partial/Fail with warnings).
- Keep existing structural checks unchanged and always-on.
- Update examples/research-pack-example.md with [Sxx] source IDs and
  Final audit status: Pass so it passes strict mode.
- Add 9 regression tests for strict-mode validation.
- Add strict-mode check to CI quick job.
@ShadyUnderLight ShadyUnderLight force-pushed the feat/validator-strict-mode branch from 8cbc217 to dc0e10a Compare May 12, 2026 02:16
@ShadyUnderLight ShadyUnderLight merged commit 42ef9d3 into main May 12, 2026
2 checks passed
@ShadyUnderLight ShadyUnderLight deleted the feat/validator-strict-mode branch May 12, 2026 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

为 Research Pack validator 增加严格模式,校验 source id 映射和 audit status

1 participant