Add human-readable --format table, one-page brief, claim archive via docs apply CAS, and four MCP readonly tools. Includes P1 console design doc and engineering-tool test evidence.
5.3 KiB
5.3 KiB
治理可视化 P0 测试报告
一、 测试背景 (Background)
agentctl 治理状态此前仅输出 JSON,CURRENT 并行认领表 done 行滞留(R04),MCP 缺少 queue/claim/cleanup/catalog 只读巡览工具。本轮实现人类可读渲染、brief、claim archive dry-run/apply 路径与 MCP +4。
二、 测试目标 (Test Objectives)
--format table对 status/queue/claim/cleanup 输出可读表且默认 json 兼容。brief聚合 daemon/tasks/cleanup/drift。claim archive默认 dry-run,按 retain-days 筛选 done 行。- MCP tools/list 含 queue_list、claim_status、cleanup_report、catalog_drift。
- 工程工具单测全绿。
三、 测试方案与环境 (Test Plan & Environment)
- OS: Linux;Python 3;worktree
.worktrees/governance-visibility-p0-2026-09-24 - 层级:验证契约「工程工具验收」——
unittest discover -s scripts/tests - 不适用产品 PI 全链路(NOT REQUIRED:纯 scripts/.doc 工程工具)
四、 预期结果 (Expected Results)
- table 模式含任务/队列表头;json 默认不变
- brief 为 Markdown 一页
- archive dry-run 返回 eligible_count 与 candidates
- 单测 226 OK(含新增 11 项 visibility)
五、 实际测试结果与判定 (Actual Results & Evaluation)
TC1 status --format table
- Input:
python3 scripts/agentctl.py status --format table - Actual Output:
=== status --format table ===
agentctl status main=/home/weichen/projects/Agent-System epoch=a994d494-0d9 version=1
## tasks active=1 closed=152 total=153
task owner state worktree branch
----------------------------------- ------ ------ ---------------------------------------------- ------------
governance-visibility-p0-2026-09-24 Cursor active .worktrees/governance-visibility-p0-2026-09-24 feature/gove
## runs live=0
(no live runs)
## queue depth=0
(queue empty)
## policy loaded=ok revision=agent-governance-2026-09-23-fav-constraint-restored
- Verdict: PASS
- Duration: <1s
TC2 brief
- Input:
python3 scripts/agentctl.py brief - Actual Output:
=== brief ===
# agentctl brief (2026-09-24 13:25)
- daemon: **ok** manager.lock.held=True queue pending=0
- tasks: active=1 blocked=0 live runs=0 integrate queue=0
- cleanup pending: 4 / 4 worktrees
- MATRIX drift hard alerts: 0
## Active tasks
- `governance-visibility-p0-2026-09-24` owner=Cursor state=active wt=.worktrees/governance-visibility-p0-2026-09-24
## Blockers / alerts
- cleanup backlog: 4 worktrees not removable
## Integrate queue
- (empty)
- Verdict: PASS
TC3 claim archive dry-run
- Input:
claim archive --task governance-visibility-p0-2026-09-24 --retain-days 7 - Actual Output (节选 JSON):
=== claim archive dry-run ===
{"archive_file": ".doc/archive/ops/2026-09-21-current-history.md", "candidates": [{"branch": "feature/initial-load-performance-plan", "eligible": true, "line": "| Codex | 2026-09-17-initial-load-performance-plan | feature/initial-load-performance-plan | .worktrees/feature-initial-load-performance-plan | loading-performance-audit | done |", "mutex": "loading-performance-audit", "owner": "Codex", "parsed_date": "2026-09-17", "reason": "older_than_7d", "status": "done", "task": "2026-09-17-initial-load-performance-plan", "worktree": ".worktrees/feature-initial-load-performance-plan"}], "done_scanned": 85, "eligible_count": 1, "include_undated": false, "retain_days": 7, "skipped": [{"branch": "feature/non-author-closeout-2026-09-24", "eligible": false, "line": "| Cursor | non-author-closeout-2026-09-24 | feature/non-author-closeout-2026-09-24 | .worktrees/non-author-closeout-2026-09-24 | docs+git:dev | done |", "mutex": "docs+git:dev", "owner": "Cursor", "parsed_date": "2026-09-24", "reason": "within_retain_window", "status": "done", "task": "non-author-closeout-2026-09-24", "worktree": ".worktrees/non-author-closeout-2026-09-24"}, {"branch": "feature/inte
- Verdict: PASS(done_scanned=85,eligible_count=1,默认不改文件)
TC4 MCP tools/list
- Input: NDJSON
tools/listagainstscripts/mcp/agentctl-mcp.mjs - Actual Output:
catalog_drift
catalog_overlap_ack
catalog_overlap_probe
catalog_requirement_add
catalog_search
catalog_status
claim_status
cleanup_report
docs_apply
docs_snapshot
lease_run
quarantine_status
queue_enqueue
queue_list
status
task_close
task_register
validate
---
has queue_list true
has claim_status true
has cleanup_report true
has catalog_drift true
- Verdict: PASS
TC5 unittest suite
- Input:
python3 -B -m unittest discover -s scripts/tests -p 'test_*.py' -v - Actual Output:
Ran 226 tests in ~132s→ OK - Verdict: PASS
六、 自动化测试套件汇总 (Test Suite Execution)
| 套件 | 结果 |
|---|---|
scripts/tests unittest discover |
226 OK |
| visibility 新增 | 11 OK |
| 产品 go test / 真实 PI | NOT REQUIRED(工程工具) |
七、 测试结论与后续优化建议 (Conclusion & Next Steps)
P0 验收达标。后续按 .doc/ops/short-term/2026-09-24-governance-console-plan.md 实施 P1(serve/SPA/claim new/integrate prepare/pi packet)。证据附件:.doc/test-reports/assets/2026-09-24-governance-visibility-p0/。