Files
ai-workflow-skill/docs/tests/orch/council-report/council-report-defaults-to-consensus-when-run-is-only-unanimous.md
T

4.7 KiB

Case: council-report-defaults-to-consensus-when-run-is-only-unanimous

用例意义

验证当 council run 以 --only-unanimous 启动时,省略 --showcouncil report --json 默认只返回 consensus bucket。

前置条件

  • 使用隔离的临时目录 TMPDIR
  • 已准备好与 council-report-defaults-to-consensus-and-majority 相同的 3 份 reviewer 输出 JSON
  • 本地可使用 sqlite3task_attempts 中读取 reviewer thread ID

输入

cat <<'EOF' > TMPDIR/architecture-review.json
{"reviewer_role":"architecture-reviewer","findings":[{"title":"Split contracts","summary":"Transport contracts are mixed into UI code.","proposal":"Move API contract definitions into a dedicated module.","rationale":"This lowers coupling.","confidence":"high","tags":["architecture"],"target_refs":{"repo_path":"."}},{"title":"Share helpers","summary":"Council report rendering paths are repeated.","proposal":"Introduce shared council coordinator helpers for report rendering.","rationale":"This keeps report assembly consistent.","confidence":"medium","tags":["reporting"],"target_refs":{"repo_path":"."}}]}
EOF

cat <<'EOF' > TMPDIR/implementation-review.json
{"reviewer_role":"implementation-reviewer","findings":[{"title":"Extract contracts","summary":"Shared transport shapes are duplicated.","proposal":"Move API contract definitions into dedicated module","rationale":"This reduces duplication.","confidence":"high","tags":["maintainability"],"target_refs":{"repo_path":"."}},{"title":"Reuse report helpers","summary":"Formatting logic should stay shared.","proposal":"Introduce shared council coordinator helpers for report rendering","rationale":"This avoids formatter drift.","confidence":"medium","tags":["reporting"],"target_refs":{"repo_path":"."}}]}
EOF

cat <<'EOF' > TMPDIR/risk-review.json
{"reviewer_role":"risk-reviewer","findings":[{"title":"Lock contracts","summary":"Contract drift becomes risky over time.","proposal":"Move API contract definitions into a dedicated module.","rationale":"This reduces integration regressions.","confidence":"high","tags":["risk"],"target_refs":{"repo_path":"."}},{"title":"Cover JSON output","summary":"The council report response should stay stable.","proposal":"Add regression tests for council report JSON output.","rationale":"This catches contract regressions earlier.","confidence":"high","tags":["testing"],"target_refs":{"repo_path":"."}}]}
EOF

orch --db TMPDIR/coord.db --json council start \
  --run council_blog_report_011 \
  --target "Review the council reporting flow." \
  --only-unanimous

THREAD_ID_CR1=$(sqlite3 TMPDIR/coord.db "SELECT thread_id FROM task_attempts WHERE run_id = 'council_blog_report_011' AND task_id = 'CR1' AND attempt_no = 1;")
THREAD_ID_CR2=$(sqlite3 TMPDIR/coord.db "SELECT thread_id FROM task_attempts WHERE run_id = 'council_blog_report_011' AND task_id = 'CR2' AND attempt_no = 1;")
THREAD_ID_CR3=$(sqlite3 TMPDIR/coord.db "SELECT thread_id FROM task_attempts WHERE run_id = 'council_blog_report_011' AND task_id = 'CR3' AND attempt_no = 1;")

inbox --db TMPDIR/coord.db --json claim --agent architecture-reviewer --thread "$THREAD_ID_CR1"
inbox --db TMPDIR/coord.db --json done --agent architecture-reviewer --thread "$THREAD_ID_CR1" --summary "Review complete" --body-file TMPDIR/architecture-review.json

inbox --db TMPDIR/coord.db --json claim --agent implementation-reviewer --thread "$THREAD_ID_CR2"
inbox --db TMPDIR/coord.db --json done --agent implementation-reviewer --thread "$THREAD_ID_CR2" --summary "Review complete" --body-file TMPDIR/implementation-review.json

inbox --db TMPDIR/coord.db --json claim --agent risk-reviewer --thread "$THREAD_ID_CR3"
inbox --db TMPDIR/coord.db --json done --agent risk-reviewer --thread "$THREAD_ID_CR3" --summary "Review complete" --body-file TMPDIR/risk-review.json

orch --db TMPDIR/coord.db --json council tally \
  --run council_blog_report_011 \
  --similarity normal

orch --db TMPDIR/coord.db --json council report \
  --run council_blog_report_011

预期输出

  • 最后一条 council report 命令退出码为 0
  • ok == true
  • data.run_id == "council_blog_report_011"
  • data.show == ["consensus"]
  • data.summary.consensus == 1
  • data.summary.majority == 1
  • data.summary.minority == 1
  • data.grouped_recommendations 长度为 1
  • 唯一返回的 recommendation 的 bucket == "consensus"

断言结论

  • --only-unanimous 不会删除持久化的 majorityminority 数据,但会改变省略 --show 时的默认输出策略
  • leader 若希望在 unanimous-only run 中仍查看 majority,必须显式传入 --show

补充约束

  • 即使这里使用 --json 断言 show 默认值,命令仍会写出 markdown artifact