fix(governance): audit merged PRs after branch cleanup
This commit is contained in:
@@ -23,6 +23,8 @@ from audit_gitea_coordination import (
|
||||
parse_datetime,
|
||||
parse_write_paths,
|
||||
select_latest_claim,
|
||||
RemoteTask,
|
||||
validate_pull_request,
|
||||
)
|
||||
from setup_gitea_labels import LABELS, NoRedirect, build_plan
|
||||
from test_gitea_claim_race import PROBE_PREFIX, new_probe_branch
|
||||
@@ -180,6 +182,31 @@ class OfflineRuleTests(unittest.TestCase):
|
||||
|
||||
|
||||
class GiteaHelperTests(unittest.TestCase):
|
||||
def test_merged_pr_accepts_gitea_deleted_branch_ref(self) -> None:
|
||||
sha = "a" * 40
|
||||
task = RemoteTask(
|
||||
number=1,
|
||||
task_id="T-123",
|
||||
state="closed",
|
||||
status="status/done",
|
||||
labels={"status/done"},
|
||||
body="",
|
||||
work_branch="agent/worker-1/T-123",
|
||||
context_ref=sha,
|
||||
write_paths=["docs/tasks/T-123.md"],
|
||||
)
|
||||
pr = {
|
||||
"merged": True,
|
||||
"head": {"ref": "refs/pull/1/head"},
|
||||
"body": (
|
||||
"Closes #1\n"
|
||||
"task_file: docs/tasks/T-123.md\n"
|
||||
f"context_ref: {sha}\n"
|
||||
"work_branch: agent/worker-1/T-123\n"
|
||||
),
|
||||
}
|
||||
self.assertEqual([], validate_pull_request(pr, task))
|
||||
|
||||
def test_waiting_status_is_not_claimable_or_active(self) -> None:
|
||||
self.assertIn("status/waiting", STATUS_LABELS)
|
||||
self.assertNotIn("status/waiting", READY_OR_ACTIVE_LABELS)
|
||||
|
||||
Reference in New Issue
Block a user