diff --git a/.gitea/scripts/sop-checklist.py b/.gitea/scripts/sop-checklist.py index 2da3788bb..c90b322f8 100644 --- a/.gitea/scripts/sop-checklist.py +++ b/.gitea/scripts/sop-checklist.py @@ -351,7 +351,8 @@ def compute_ack_state( latest_directive[(user, slug)] = kind # Step 2: build candidate ackers per slug. - # Filter out self-acks and unknown slugs. + # Filter out self-acks and unknown slugs. Author self-ack is forbidden + # per .gitea/sop-checklist-config.yaml — a non-author peer must ack. ackers_per_slug: dict[str, list[str]] = {s: [] for s in items_by_slug} rejected_self: dict[str, list[str]] = {s: [] for s in items_by_slug} pending_team_check: dict[str, list[str]] = {s: [] for s in items_by_slug} diff --git a/.gitea/scripts/tests/test_sop_checklist.py b/.gitea/scripts/tests/test_sop_checklist.py index cae9ef149..c2879d218 100644 --- a/.gitea/scripts/tests/test_sop_checklist.py +++ b/.gitea/scripts/tests/test_sop_checklist.py @@ -291,7 +291,8 @@ class TestComputeAckState(unittest.TestCase): ) self.assertEqual(state["comprehensive-testing"]["ackers"], ["bob"]) - def test_self_ack_rejected(self): + def test_self_ack_rejected_when_author_in_team(self): + # Author self-acks are forbidden — a non-author peer must ack. comments = [_comment("alice", "/sop-ack comprehensive-testing")] state = sop.compute_ack_state( comments, "alice", self.items, self.aliases, self._approve_all @@ -722,16 +723,16 @@ class TestRootCauseAckEligibilityWidened(unittest.TestCase): ) self.assertEqual(state["root-cause"]["ackers"], ["hongming"]) - def test_self_ack_still_forbidden_even_with_widened_eligibility(self): - # Author cannot self-ack — widening teams must NOT weaken - # the non-author rule. + def test_self_ack_rejected_with_widened_eligibility(self): + # Author self-acks are forbidden even when the author is in the + # required team — a non-author peer must ack. comments = [_comment("alice", "/sop-ack root-cause")] probe = self._approve_only({"alice"}) state = sop.compute_ack_state( comments, "alice", self.items, self.aliases, probe, high_risk=False ) self.assertEqual(state["root-cause"]["ackers"], []) - self.assertIn("alice", state["root-cause"]["rejected"]["self_ack"]) + self.assertEqual(state["root-cause"]["rejected"]["self_ack"], ["alice"]) class TestHighRiskClassUsesElevatedListInConfig(unittest.TestCase):