feat(tmux): add server death watchdog daemon and multi-socket approver enhancements
This commit is contained in:
@@ -131,6 +131,44 @@ class TestApprovalFlags(unittest.TestCase):
|
||||
p = w.muse_approval_flags([])
|
||||
self.assertFalse(p["auto_approve"])
|
||||
|
||||
def test_permission_profile(self):
|
||||
p = w.muse_approval_flags(
|
||||
["muse", "--permission-profile", ":unrestricted"])
|
||||
self.assertEqual(p["profile"], ":unrestricted")
|
||||
self.assertEqual(p["mode"], ":unrestricted")
|
||||
self.assertIn("permission-profile=:unrestricted", p["flags"])
|
||||
self.assertFalse(p["bypass"])
|
||||
|
||||
def test_permission_profile_equals(self):
|
||||
p = w.muse_approval_flags(
|
||||
["muse", "--permission-profile=:read-only"])
|
||||
self.assertEqual(p["profile"], ":read-only")
|
||||
self.assertEqual(p["mode"], ":read-only")
|
||||
|
||||
def test_yolo_mode_and_bypass(self):
|
||||
p = w.muse_approval_flags(["muse", "--yolo"])
|
||||
self.assertEqual(p["mode"], "yolo")
|
||||
self.assertTrue(p["bypass"])
|
||||
self.assertIsNone(p["profile"])
|
||||
|
||||
def test_bypass_without_profile(self):
|
||||
p = w.muse_approval_flags(["muse", "--disable-approval"])
|
||||
self.assertTrue(p["bypass"])
|
||||
self.assertEqual(p["mode"], "default")
|
||||
|
||||
def test_default_mode(self):
|
||||
p = w.muse_approval_flags(["muse"])
|
||||
self.assertEqual(p["mode"], "default")
|
||||
self.assertFalse(p["bypass"])
|
||||
self.assertIsNone(p["profile"])
|
||||
|
||||
def test_sandbox_and_trust_flags(self):
|
||||
p = w.muse_approval_flags(
|
||||
["muse", "--disable-sandbox", "--trust-workspace"])
|
||||
self.assertIn("disable-sandbox", p["flags"])
|
||||
self.assertIn("trust-workspace", p["flags"])
|
||||
self.assertFalse(p["bypass"])
|
||||
|
||||
|
||||
def _tmux_result(returncode=0, stdout="", stderr=""):
|
||||
r = mock.Mock()
|
||||
@@ -238,6 +276,33 @@ class TestRuntimeRows(unittest.TestCase):
|
||||
self.assertEqual(rows[0]["height"], 7)
|
||||
self.assertTrue(rows[1]["squeezed"])
|
||||
|
||||
def test_rows_carry_permission_posture(self):
|
||||
patches = self._patched(
|
||||
captures={"%37": STATE_OPEN, "%38": STATE_SHELL},
|
||||
children={2880158: [2881158]},
|
||||
cmdlines={2881158: ["/home/super/.local/bin/muse-bin-1.4.3",
|
||||
"--permission-profile", ":unrestricted",
|
||||
"--disable-sandbox"]})
|
||||
with patches[0], patches[1], patches[2], patches[3], patches[4]:
|
||||
rows = w.runtime_rows("/tmp/sock")
|
||||
self.assertEqual(rows[0]["permission_mode"], ":unrestricted")
|
||||
self.assertEqual(rows[0]["permission_profile"], ":unrestricted")
|
||||
self.assertFalse(rows[0]["permission_bypass"])
|
||||
self.assertIn("permission-profile=:unrestricted",
|
||||
rows[0]["approval_flags"])
|
||||
self.assertIsNone(rows[1]["permission_mode"])
|
||||
|
||||
def test_narrow_but_tall_not_squeezed(self):
|
||||
# Empirical sizing: 35-wide panes answer cleanly when tall
|
||||
# enough; only short height drops dialog text. Width minimum
|
||||
# must not flag working panes as squeezed.
|
||||
listing = "muse\t1\t%37\tmuse-bin-1.4\t2880158\t35\t35\n"
|
||||
patches = self._patched(
|
||||
tmux_stdout=listing, captures={"%37": STATE_OPEN})
|
||||
with patches[0], patches[1], patches[2], patches[3], patches[4]:
|
||||
rows = w.runtime_rows("/tmp/sock")
|
||||
self.assertFalse(rows[0]["squeezed"])
|
||||
|
||||
|
||||
class TestNodeFromSession(unittest.TestCase):
|
||||
def test_conforming_sessions(self):
|
||||
|
||||
Reference in New Issue
Block a user