From ef552931df5f549733c74cb0abf56cd683e22f90 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 20:04:45 +0100 Subject: [PATCH] Kill the last endless-wait mutants --- bin/rule_hook/endless_wait.py | 6 +++--- bin/rule_hook/test_rule_hook.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/rule_hook/endless_wait.py b/bin/rule_hook/endless_wait.py index 2def4542..bdca2335 100644 --- a/bin/rule_hook/endless_wait.py +++ b/bin/rule_hook/endless_wait.py @@ -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[:1] + kind = simple.words[0] if simple.words else None for loop in open_loops: loop.append(simple) - if first and first[0] in LOOPS: + if kind in LOOPS: open_loops.append([simple]) - elif first == ["done"] and open_loops: + elif kind == "done" and open_loops: closed.append(open_loops.pop()) return closed + open_loops diff --git a/bin/rule_hook/test_rule_hook.py b/bin/rule_hook/test_rule_hook.py index 97b6756b..fd47fb90 100644 --- a/bin/rule_hook/test_rule_hook.py +++ b/bin/rule_hook/test_rule_hook.py @@ -166,7 +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([breach.directory for breach in breaches("cd /w && until [ -s f ] && cd /x && true; do 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):