From c33c7e2700038b4a2c3c85b4c550bdf3575b3735 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:54:05 +0800 Subject: [PATCH] =?UTF-8?q?fix(release):=20=E6=8E=A5=E5=8F=97=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E6=8F=90=E7=A4=BA=E4=B8=AD=E7=9A=84=E5=B8=A6=E5=BC=95?= =?UTF-8?q?=E5=8F=B7=E8=8C=83=E5=9B=B4=E7=A1=AE=E8=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/release_handoff.py | 11 +++++++---- scripts/test_release_handoff.py | 4 ++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/release_handoff.py b/scripts/release_handoff.py index d1df9a4..e1cff39 100644 --- a/scripts/release_handoff.py +++ b/scripts/release_handoff.py @@ -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) diff --git a/scripts/test_release_handoff.py b/scripts/test_release_handoff.py index 7d17c15..8b629fa 100644 --- a/scripts/test_release_handoff.py +++ b/scripts/test_release_handoff.py @@ -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')) -- 2.52.0