Compare commits

..

2 Commits

Author SHA1 Message Date
姚章浩 c33c7e2700 fix(release): 接受预览提示中的带引号范围确认
build / build (push) Successful in 2m22s
2026-11-24 14:54:05 +08:00
zheromiku 91f9e00010 Merge pull request 'feat(release): 知识治理预检交接与固定版本发布' (#33) from feat/release-comment-handoff into main
build / build (push) Successful in 2m17s
2026-11-24 14:46:00 +08:00
2 changed files with 11 additions and 4 deletions
+7 -4
View File
@@ -70,7 +70,7 @@ def resolve(task, event):
return sha, sha
def frozen_approval(task_id):
def frozen_approval(task_id, comment_id=None):
"""An owner reply to the specific, unedited scope preview authorizes this immutable local plan."""
path = DIRECTORY / (task_id + '.preview.json')
if not path.exists():
@@ -81,8 +81,11 @@ def frozen_approval(task_id):
cd.require(parent.get('content') == saved['content'], 'scope preview has changed')
replies = [r for r in rows if r.get('parentId') == saved['comment'] and author(r) == cd.RELEASE_OWNER
and (r.get('author') or {}).get('type') == 'human' and not r.get('runId')]
if replies and max(replies, key=lambda r: r['createdAt'])['content'].strip() == '确认范围':
return saved['plan']
if replies:
latest = max(replies, key=lambda r: r['createdAt'])
if ((comment_id is None or latest['id'] == comment_id)
and latest['content'].strip() in ('确认范围', '「确认范围」')):
return saved['plan']
return None
@@ -172,7 +175,7 @@ def main():
if args.action == 'preflight':
return preflight(task, args.comment)
if args.action == 'scope':
cd.require(author(row) == cd.RELEASE_OWNER and row['content'].strip() == '确认范围' and frozen_approval(task['id']),
cd.require(frozen_approval(task['id'], row['id']),
'require the release owner reply on the exact scope preview')
return coordinator.queue(task['id'])
return qa(task, row)
+4
View File
@@ -31,6 +31,10 @@ class ReleaseHandoffTest(unittest.TestCase):
'author': {'id': h.cd.RELEASE_OWNER, 'type': 'human'}}
with patch.object(h, 'comments', return_value=[parent, reply]):
self.assertEqual(h.frozen_approval('task'), saved['plan'])
quoted = dict(reply, content='「确认范围」')
with patch.object(h, 'comments', return_value=[parent, quoted]):
self.assertEqual(h.frozen_approval('task', 'ok'), saved['plan'])
self.assertIsNone(h.frozen_approval('task', 'other'))
for bad in (dict(reply, parentId=None), dict(reply, runId='agent-run'), dict(reply, content='先不确认范围')):
with patch.object(h, 'comments', return_value=[parent, bad]):
self.assertIsNone(h.frozen_approval('task'))