diff --git a/.github/PROJECT_SYNC.md b/.github/PROJECT_SYNC.md index 82de095184c..7b05650ce4c 100644 --- a/.github/PROJECT_SYNC.md +++ b/.github/PROJECT_SYNC.md @@ -68,7 +68,7 @@ A delivery is released only when all associated implementation PRs are merged, t ## Schedule and recovery - Issue and same-repository PR events reconcile the changed item and its linked items. Fork PR events are skipped; full scans include their repository-visible state. -- Scheduled runs every six hours and manual runs perform full reconciliation, including release verification. Event runs preserve an existing release result while implementation links are unchanged. +- Scheduled runs every six hours and manual runs perform full reconciliation, including release verification. Event runs preserve an existing release result while 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. - Full scans include open issues, all PRs, tracked or linked closed issues, and items closed since Project creation. Archived items and draft issues are skipped. Preview catch-up before applying to an older Project. - Each run validates the schema and prints its plan before writing. Runs are serialized and have a 120-minute total timeout. API errors or missing fetched tags stop the run. - A failed apply reports confirmed, outcome-unknown, and unattempted writes. Rerun or wait for the next scheduled scan to reconcile partial changes. The Actions log shows scan progress. 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 (