feat(qa): 验收回执写明结论与用例
build / build (push) Successful in 2m31s

This commit is contained in:
姚章浩
2026-11-25 17:06:51 +08:00
parent 15dbc2469b
commit 7801c163e4
2 changed files with 34 additions and 1 deletions
+22 -1
View File
@@ -164,6 +164,27 @@ def summon_qa(plan, target, body):
cd.record(path, {'state': 'sent', 'result': result})
def acceptance_body(sha, bundle, tasks, reports, url_of, links):
"""State the registered verdict and its counts on the task itself, not only in metadata."""
lines = ['批次验收通过', '', f'提交 `{sha}`', '', f'归档 `{bundle}`', '']
single = len(tasks) == 1
for item in tasks:
row, result = reports[item]
if single:
lines.append(f'必测 {result["required"]} · 通过 {result["passed"]} · 失败 {result["failed"]} '
f'· 阻塞 {result["blocked"]} · 结论 {result["verdict"]}')
if result.get('url'):
lines.append(f'候选地址 {result["url"]}')
cases = result.get('cases') or {}
for group, label in (('business', '业务用例'), ('regression', '回归用例')):
if isinstance(cases.get(group), list) and cases[group]:
lines.append(f'{label}({len(cases[group])}):' + '、'.join(cases[group]))
else:
lines.append(f'{url_of(item)}#comment-{row["id"]}')
lines += ['', '需求验收与批次回归报告', links]
return '\n'.join(lines)
def register(task_id):
plan = owner_plan(task_id)
directory = STATE / cd.acceptance_digest(plan)
@@ -203,7 +224,7 @@ def register(task_id):
'register QA before the owner moves the release task to 待发布')
sha, bundle = receipt['sha'], receipt['bundle']
links = '\n'.join(f'- {task(item)["url"]}#comment-{reports[item][0]["id"]}' for item in tasks)
body = f'批次验收通过\n\n提交 `{sha}`\n\n归档 `{bundle}`\n\n需求验收与批次回归报告\n{links}'
body = acceptance_body(sha, bundle, tasks, reports, lambda item: task(item)['url'], links)
comment = add_comment(task_id, 'acceptance ' + bundle, body)
acceptance = {'verdict': 'passed', 'sha': sha, 'bundle': bundle, 'evidence': rel['url'] + '#comment-' + comment}
if cd.metadata(task(task_id), 'cd_acceptance') != acceptance: