From 9952412eff0a8dbae4474e55e56decdb46f8ef74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9A=E7=AB=A0=E6=B5=A9?= Date: Tue, 24 Nov 2026 14:43:03 +0800 Subject: [PATCH] =?UTF-8?q?fix(release):=20=E5=85=BC=E5=AE=B9=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E9=A2=84=E8=A7=88=E7=9A=84=E5=AF=8C=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E5=9B=9E=E8=AF=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/release_handoff.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/release_handoff.py b/scripts/release_handoff.py index 9b5112b..d1df9a4 100644 --- a/scripts/release_handoff.py +++ b/scripts/release_handoff.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 """HiFox comment handoffs on the release executor. All user-visible actions are scoped to a verified event.""" import argparse +import html import json import re import sys @@ -125,8 +126,17 @@ def preflight(task, event=None): lines = [f"{s[:12]} {candidate.git('show', '-s', '--format=%s', s, cwd=assistant.SOURCE)}" for s in scope['extra']] safe_title = ' '.join(task['title'].splitlines()).replace('```', '') body = f"发布范围预览 · {task['identifier']}\n\n线上基线 `{scope['base']}`\n\n候选 `{sha}`\n\n本次修复:{safe_title}\n\n同批改动:\n" + '\n'.join(lines or ['无']) + '\n\n请负责人在这条评论下回复「确认范围」,系统将据此准备候选包。' - comment = coordinator.add_comment(launch['id'], 'scope ' + cd.acceptance_digest(scope), body) - stored = next(r for r in comments(launch['id']) if r['id'] == comment) + marker = '[KG candidate scope ' + cd.acceptance_digest(scope) + ']' + entries = [r for r in comments(launch['id']) if r['content'].startswith(marker + '\n')] + if not entries: + cli('task', 'comment', launch['id'], '--body', marker + '\n\n' + body) + entries = [r for r in comments(launch['id']) if r['content'].startswith(marker + '\n')] + cd.require(len(entries) == 1, 'expected one scope preview comment') + stored = entries[0] + normalized = html.unescape(stored['content']).replace( + f"[{task['identifier']}](mention://task/{task['id']})", task['identifier']) + cd.require(normalized == marker + '\n\n' + body, 'scope preview readback differs from plan') + comment = stored['id'] cd.record(path, {'plan': scope, 'comment': comment, 'content': stored['content']}) return {'state': 'awaiting_scope', 'url': launch['url'], 'plan': scope}