Files
playbook/test
cshandClaude Fable 5 7408c532f0 🐛 fix(commit-message): enforce one rule owner across skill and CI
CI ran .gitea/ci/commit_message_lint.py, an independent reimplementation
that parsed the type/emoji mapping out of docs/common/commit_message.md.
Its scope pattern accepted fix(-a), fix(a-), fix(a--b) and fix(_), and it
had no subject length check, so the gate that actually blocks merges
enforced weaker rules than the Validation this skill reports.

The CI entry is now a wrapper that locates the skill validator and
delegates to it with no arguments; commit_policy.json becomes the only
rule source and explanatory docs stop being a machine policy input.

The validator also learns the workflow_run event, whose payload carries
neither a PR title nor a before/after range. An upstream pull_request now
validates <integration-branch>..head_sha instead of HEAD alone, taking
the branch name from COMMIT_LINT_MAIN_BRANCH, and degrades to the
upstream head commit with a WARN rather than guessing a base.

Alongside: --help now documents the no-argument CI mode it had always
supported silently, CI wiring detail moves to references/ci-wiring.md,
and the description gains negative boundaries.

test/test_commit_message_policy.py asserts policy/spec-table equality and
uses ast to assert the CI entry imports no regex and reads no file, so a
second implementation cannot reappear unnoticed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-20 15:21:37 +08:00
..

🧪 Playbook 测试套件

本目录包含 Playbook 项目的测试,用于验证 CLI、模板与文档链接。

📋 目录结构

test/
├── README.md                       # 本文件:测试文档
├── test_playbook.py                # snapshot/subtree 参数化完整部署测试
├── test_template_contracts.py      # 模板内容、占位符、文案契约测试
├── test_main_loop_cli.py           # ticket 调度、隔离、证据与集成测试
├── agent/                          # Agent 题面/运行时验证测试定义
├── test_thirdparty_skills_pipeline.py # thirdparty skills 流水线配置与同步产物测试
├── test_tsl_playbook_sync.py       # TSL Playbook 构建与同步边界测试
├── test_tsl_syntax_reference.py    # TSL 语法文档结构与检索测试
└── integration/                    # 集成测试
    └── check_doc_links.py          # 文档链接有效性检查

🚀 快速开始

# 进入 playbook 根目录
cd /path/to/playbook

# 1. 运行 Python 测试(test/ 下的 test_*.py
python -X utf8 -B -m unittest discover -s test -p "test_*.py" -v

# 2. 运行文档链接检查
python test/integration/check_doc_links.py

🧭 CI 自动化测试

测试套件通过 Gitea Actions 自动运行(见 .gitea/workflows/checks.ymltests job):

  • 触发方式workflow_run——「🧰 准备环境」(prepare.yml)完成后触发。 Prepare 监听 push:mainpull_requestworkflow_dispatch 与每日 schedule 故推送到 main、对 main 开 PR 或手动运行 Prepare 都会经 Prepare 传导到测试。
  • 运行平台standard-ubuntu-22
  • checks.yml 同时包含 commit message 规范校验(standards job)。

📚 测试详解

1. Playbook 部署测试 (test_playbook.py)

使用同一个完整 playbook.toml 参数化验证:

  • snapshot 与 subtree 两种安装模式
  • rules、memory bank、prompts、standards 和 skills 同步
  • 重复执行的幂等性与自定义文件保留

2. 模板合同测试 (test_template_contracts.py)

随 Python 测试检查通用模板的关键 marker、占位符和流程合同。

3. 主循环测试 (test_main_loop_cli.py)

使用临时 Git 仓库验证 ticket 队列、串行与 worktree 隔离、并发 claim、heartbeat/reclaim、 验证与 review 证据绑定,以及 ticket/feature 两级集成。

4. TSL 契约测试

  • test_tsl_playbook_sync.py:验证 TSL Playbook 构建和同步文件边界
  • test_tsl_syntax_reference.py:验证语法文档结构、section ID 与检索结果

5. 文档链接检查 (integration/)

扫描 docs/ 与模板文件中的本地链接,确保引用路径有效。