feat: guard merged branch cleanup path

Closes #514
This commit is contained in:
2026-07-08 04:18:09 -04:00
parent 4d24c34548
commit 3cb05284b3
7 changed files with 460 additions and 1 deletions
+15
View File
@@ -11,6 +11,7 @@ import inspect
import re
from typing import Any, Callable
import branch_cleanup_guard
import issue_lock_provenance
from post_merge_cleanup_proof import assess_post_merge_cleanup_proof
from review_proofs import (
@@ -1024,6 +1025,19 @@ def _rule_shared_author_reviewer_same_run(report_text: str) -> list[dict[str, st
)
def _rule_shared_raw_branch_delete_bypass(report_text: str) -> list[dict[str, str]]:
result = branch_cleanup_guard.assess_raw_branch_delete_report(report_text)
if not result["block"]:
return []
return _findings_from_reasons(
"shared.raw_branch_delete_bypass",
result["reasons"],
field="Cleanup mutations",
severity="block",
safe_next_action=result["safe_next_action"],
)
def _rule_reviewer_review_mutation(
report_text: str,
*,
@@ -1061,6 +1075,7 @@ _SHARED_ISSUE_LOCK_RULES = (
_rule_shared_issue_lock_external_state,
_rule_shared_manual_lock_pr_override,
_rule_shared_author_reviewer_same_run,
_rule_shared_raw_branch_delete_bypass,
)
_RULES_BY_TASK: dict[str, list[Callable[..., list[dict[str, str]]]]] = {