@@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""HiFox comment handoffs on the release executor. All user-visible actions are scoped to a verified event."""
|
"""HiFox comment handoffs on the release executor. All user-visible actions are scoped to a verified event."""
|
||||||
import argparse
|
import argparse
|
||||||
|
import html
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import sys
|
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']]
|
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('```', '')
|
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请负责人在这条评论下回复「确认范围」,系统将据此准备候选包。'
|
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)
|
marker = '[KG candidate scope ' + cd.acceptance_digest(scope) + ']'
|
||||||
stored = next(r for r in comments(launch['id']) if r['id'] == comment)
|
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']})
|
cd.record(path, {'plan': scope, 'comment': comment, 'content': stored['content']})
|
||||||
return {'state': 'awaiting_scope', 'url': launch['url'], 'plan': scope}
|
return {'state': 'awaiting_scope', 'url': launch['url'], 'plan': scope}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user