From 7411da7262b017fdd125209faa6d274790facd26 Mon Sep 17 00:00:00 2001 From: Yufeng He <40085740+he-yufeng@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:12:05 +0800 Subject: [PATCH] fix: preserve integrated delivery during Project events --- .github/PROJECT_SYNC.md | 4 +++- scripts/sync_github_project.py | 10 --------- tests/test_project_events.py | 37 ++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 11 deletions(-) diff --git a/.github/PROJECT_SYNC.md b/.github/PROJECT_SYNC.md index 3973346fc6d..ce72f774565 100644 --- a/.github/PROJECT_SYNC.md +++ b/.github/PROJECT_SYNC.md @@ -41,7 +41,9 @@ or deletes source Issues/PRs. Project, preview catch-up before writes. Skip archived items and draft issues. - Release version verification runs only during full scans. Event runs defer it to the next full scan, while preserving an existing published result when its - implementation links are unchanged. + implementation links are unchanged. They still require every associated merge + commit to be reachable from the trusted default branch before reporting + `已合入待发布`; a merged state alone is not integration evidence. - Validate the Project schema/options and calculate all changes before writing; skip unchanged values and clear stale text. Paginate every GraphQL connection, reject stalled cursors, and serialize runs. Apply mode prints the plan first; diff --git a/scripts/sync_github_project.py b/scripts/sync_github_project.py index 5deb0dcb50b..7ded4fc82fa 100644 --- a/scripts/sync_github_project.py +++ b/scripts/sync_github_project.py @@ -913,16 +913,6 @@ def reconcile( desired["发布版本"] = current.get("发布版本", "") desired["发布说明"] = current.get("发布说明", "") else: - desired["交付进度"] = ( - "已合入待发布" - if any( - pr["state"] == "MERGED" - for pr in linked.get(content["number"], []) - ) - else "尚未合入" - if desired["实现关联"] - else "未关联实现" - ) desired["发布版本"] = "" desired["发布说明"] = "" desired["Status"] = status_names[desired["Status"]] diff --git a/tests/test_project_events.py b/tests/test_project_events.py index 78f7d1a97f6..afc637af21b 100644 --- a/tests/test_project_events.py +++ b/tests/test_project_events.py @@ -153,6 +153,43 @@ def test_event_path_reads_no_full_release_connection(self): self.assertFalse(any("pullRequests(first:" in query for query in queries)) self.assertFalse(any("items(first:" in query for query in queries)) + def test_merged_pr_event_marks_integrated_delivery_pending_release(self): + merged = { + **self.pr, + "state": "MERGED", + "mergeCommit": {"oid": "a" * 40}, + } + with ( + patch.object(sync, "event_snapshot", return_value=([merged], {}, {})), + patch.object(sync, "connection", side_effect=[self.fields]), + patch.object(sync, "ancestor", return_value=True), + patch.object(sync.subprocess, "run", return_value=Mock(stdout="a" * 40)), + ): + plan = sync.reconcile("P", "AstrBotDevs/AstrBot", subject=2) + + self.assertEqual(plan[0]["changes"]["Status"], "Done") + self.assertEqual(plan[0]["changes"]["交付进度"], "已合入待发布") + + def test_issue_event_keeps_unreachable_merge_out_of_integrated_delivery(self): + merged = { + **self.pr, + "state": "MERGED", + "mergeCommit": {"oid": "a" * 40}, + } + with ( + patch.object( + sync, + "event_snapshot", + return_value=([self.issue, merged], {}, {1: [merged]}), + ), + patch.object(sync, "connection", side_effect=[self.fields]), + patch.object(sync, "ancestor", return_value=False), + patch.object(sync.subprocess, "run", return_value=Mock(stdout="b" * 40)), + ): + plan = sync.reconcile("P", "AstrBotDevs/AstrBot", subject=1) + + self.assertEqual(plan[0]["changes"]["交付进度"], "尚未合入") + def test_subject_reads_never_scan_repository_or_project_connections(self): node = {**self.issue, "issueState": "OPEN"} with (