fix(review): cross-PR decision-lock isolation and recovery diagnosis (Closes #693)
Prevent foreign open-PR terminals on the durable review-decision lock from blocking fresh formal reviews. Scope correction authorization to the named prior review's PR/head, add read-only diagnosis with exact next_action and durable handoff payloads, require thread-visible correction audits, and cover the PR #688 → #692 recovery sequence in regression tests.
This commit is contained in:
@@ -188,20 +188,32 @@ class TestActiveHardStopPreserved(unittest.TestCase):
|
||||
mcp_server._save_review_decision_lock(None)
|
||||
mcp_server.review_workflow_load.clear_review_workflow_load()
|
||||
|
||||
def test_open_approve_still_blocks_other_pr_mark_ready(self):
|
||||
_seed([APPROVED_OPEN])
|
||||
reasons = mcp_server.terminal_review_hard_stop_reasons(592, "mark_ready")
|
||||
self.assertTrue(reasons)
|
||||
self.assertIn("#332", reasons[0])
|
||||
self.assertIn("gitea_cleanup_stale_review_decision_lock", reasons[0])
|
||||
def test_open_approve_blocks_same_pr_not_other_pr_mark_ready(self):
|
||||
_seed([APPROVED_OPEN]) # approve on PR #700
|
||||
# Same PR still hard-stopped for mark_ready.
|
||||
reasons_same = mcp_server.terminal_review_hard_stop_reasons(
|
||||
700, "mark_ready"
|
||||
)
|
||||
self.assertTrue(reasons_same)
|
||||
self.assertIn("#332", reasons_same[0])
|
||||
# #693: other PR may mark_ready without cleanup.
|
||||
self.assertEqual(
|
||||
mcp_server.terminal_review_hard_stop_reasons(592, "mark_ready"),
|
||||
[],
|
||||
)
|
||||
|
||||
def test_request_changes_still_blocks_everything(self):
|
||||
_seed([RC_OPEN])
|
||||
def test_request_changes_still_blocks_same_pr(self):
|
||||
_seed([RC_OPEN]) # request_changes on PR #701
|
||||
for op in ("merge", "mark_ready", "review"):
|
||||
self.assertTrue(
|
||||
mcp_server.terminal_review_hard_stop_reasons(592, op),
|
||||
mcp_server.terminal_review_hard_stop_reasons(701, op),
|
||||
msg=op,
|
||||
)
|
||||
# Foreign PR review path is open (#693).
|
||||
self.assertEqual(
|
||||
mcp_server.terminal_review_hard_stop_reasons(592, "mark_ready"),
|
||||
[],
|
||||
)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
|
||||
Reference in New Issue
Block a user