Kill the surviving endless-wait mutants

This commit is contained in:
2026-11-18 19:51:18 +01:00
parent 281220a69b
commit 85e69a9760
2 changed files with 6 additions and 5 deletions
+3 -3
View File
@@ -45,12 +45,12 @@ def loops(simples: list[Simple]) -> list[list[Simple]]:
open_loops: list[list[Simple]] = []
closed = []
for simple in (Simple(core(simple.words), simple.directory) for simple in simples):
first = simple.words[0] if simple.words else ""
first = simple.words[:1]
for loop in open_loops:
loop.append(simple)
if first in LOOPS:
if first and first[0] in LOOPS:
open_loops.append([simple])
elif first == "done" and open_loops:
elif first == ["done"] and open_loops:
closed.append(open_loops.pop())
return closed + open_loops
+3 -2
View File
@@ -155,7 +155,7 @@ class CommandBreaches(unittest.TestCase):
self.assertEqual(checked(command), [])
def test_a_pgrep_or_pkill_f_whose_pattern_the_command_contains_breaks_endless_wait(self):
for command in ["pgrep -f chunk-pr", "pkill -f 'loop-claude'", "pgrep -fa chunk-pr", "pgrep -u me -f chunk-pr", "pgrep --full chunk-pr", "pkill -9 -f loop-claude", "pkill -KILL -f loop-claude", "pgrep -f chunk-pr -u", "pgrep -f -", "pgrep -U me -f chunk-pr", "pgrep -fUME chunk-pr", "pgrep -f9 chunk-pr", "pgrep --signal TERM --full chunk-pr", "pgrep -f 'chunk[pr'", "pgrep -f 'chunk-pr .*merg'", "nice pgrep -f chunk-pr", "bash -c 'pgrep -f chunk-pr'"]:
for command in ["pgrep -f chunk-pr", "pkill -f 'loop-claude'", "pgrep -fa chunk-pr", "pgrep -u me -f chunk-pr", "pgrep --full chunk-pr", "pkill -9 -f loop-claude", "pkill -KILL -f loop-claude", "pgrep -f chunk-pr -u", "pkill --full chunk-pr --signal", "pgrep -f -", "pgrep -U me -f chunk-pr", "pgrep -fUME chunk-pr", "pgrep -f9 chunk-pr", "pgrep --signal TERM --full chunk-pr", "pgrep -f 'chunk[pr'", "pgrep -f 'chunk-pr .*merg'", "nice pgrep -f chunk-pr", "bash -c 'pgrep -f chunk-pr'"]:
with self.subTest(command):
self.assertEqual(checked(command), ["endless-wait"])
self.assertIn("pgrep -x", breaches("pgrep -f chunk-pr")[0].detail)
@@ -166,6 +166,7 @@ class CommandBreaches(unittest.TestCase):
self.assertEqual([breach.directory for breach in found], ["/w"])
self.assertIn(f"`{head[:60]}`, has neither a time limit nor a count cap; use `~/.claude/bin/wait-for", found[0].detail)
self.assertEqual([breach.directory for breach in breaches("cd /w && bash -c 'pgrep -f x; until [ -s f ]; do sleep 1; done'")], ["/w", "/w"])
self.assertEqual([breach.directory for breach in breaches("cd /w && until [ -s f ]; do cd /x && sleep 1; done")], ["/w"])
self.assertEqual(len(breaches("pgrep -f aa; bash -c 'pgrep -f bb'")), 2)
def test_a_loop_that_waits_on_its_own_pgrep_breaks_endless_wait_twice(self):
@@ -174,7 +175,7 @@ class CommandBreaches(unittest.TestCase):
self.assertEqual(checked(command.replace("-f ", "-x ")), ["endless-wait"])
def test_a_pgrep_f_on_a_pattern_the_command_lacks_or_a_pgrep_without_f_passes_endless_wait(self):
for command in ["pgrep -f '[c]hunk-pr merg'", "pgrep -f \"$name\"", "pgrep -f '^python3 .*loop-claude$'", "pgrep -x chunk-pr", "pgrep chunk-pr", "pgrep -u me -x chunk-pr", "pkill -f -u me '[l]oop-claude'", "pkill --signal TERM --full '[c]hunk'", "pkill --signal=TERM --full '[c]hunk'", "pgrep -f -U me '[c]hunk' -u", "echo pgrep -f chunk-pr", "git commit -m 'Refuse pgrep -f chunk-pr'", "pgrep -f"]:
for command in ["pgrep -f '[c]hunk-pr merg'", "pgrep -f \"$name\"", "pgrep -f '^python3 .*loop-claude$'", "pgrep -x chunk-pr", "pgrep chunk-pr", "pgrep -u me -x chunk-pr", "pkill -f -u me '[l]oop-claude'", "pkill --signal TERM --full '[c]hunk'", "pkill -KILL -f '[l]oop-claude'", "pkill -9 -f '[l]oop-claude'", "pkill --signal=TERM --full '[c]hunk'", "pgrep -f -U me '[c]hunk' -u", "echo pgrep -f chunk-pr", "git commit -m 'Refuse pgrep -f chunk-pr'", "pgrep -f"]:
with self.subTest(command):
self.assertEqual(checked(command), [])