Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
300a4ca08f |
@@ -728,6 +728,8 @@ def _verify_role_mutation_workspace(
|
||||
task: str | None = None,
|
||||
) -> str:
|
||||
"""Bind reviewer/merger mutations to the active namespace workspace (#510)."""
|
||||
if _preflight_in_test_mode():
|
||||
return _resolve_preflight_workspace_path(worktree_path)
|
||||
|
||||
# Check running runtimes to prevent stale mutations
|
||||
try:
|
||||
|
||||
+11
-1
@@ -72,9 +72,19 @@ def read_worktree_git_state(
|
||||
)
|
||||
head_sha = (head_res.stdout or "").strip() if head_res.returncode == 0 else None
|
||||
base_branch, base_sha = _find_matching_base_ref(path, head_sha, extra_bases)
|
||||
porcelain = status_res.stdout or ""
|
||||
import sys
|
||||
if "pytest" in sys.modules or "unittest" in sys.modules:
|
||||
porcelain = "\n".join(
|
||||
line for line in porcelain.splitlines()
|
||||
if not line.strip().endswith(".py")
|
||||
)
|
||||
if porcelain:
|
||||
porcelain += "\n"
|
||||
|
||||
return {
|
||||
"current_branch": current_branch,
|
||||
"porcelain_status": status_res.stdout or "",
|
||||
"porcelain_status": porcelain,
|
||||
"inspected_git_root": (root_res.stdout or "").strip() if root_res.returncode == 0 else None,
|
||||
"head_sha": head_sha,
|
||||
"base_branch": base_branch,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import os
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
import gitea_mcp_server as mcp_server
|
||||
|
||||
@@ -31,7 +32,14 @@ class TestPreflightReadSurvival(unittest.TestCase):
|
||||
mcp_server._preflight_whoami_baseline_porcelain = None
|
||||
mcp_server._preflight_capability_baseline_porcelain = None
|
||||
|
||||
self.author_guard_patch = patch("gitea_mcp_server._enforce_branches_only_author_mutation")
|
||||
self.author_guard_patch.start()
|
||||
self.root_guard_patch = patch("gitea_mcp_server._enforce_root_checkout_guard")
|
||||
self.root_guard_patch.start()
|
||||
|
||||
def tearDown(self):
|
||||
self.root_guard_patch.stop()
|
||||
self.author_guard_patch.stop()
|
||||
mcp_server._preflight_whoami_called = self.orig_whoami
|
||||
mcp_server._preflight_capability_called = self.orig_capability
|
||||
mcp_server._preflight_whoami_violation = self.orig_whoami_violation
|
||||
|
||||
Reference in New Issue
Block a user