From f4a2ea823d91aed85b87847c8dd9504d762cbb38 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 28 Oct 2026 14:55:19 +0100 Subject: [PATCH] =?UTF-8?q?Answer=20stability=20round=202:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=202=20=F0=9F=9F=A1=20(0=20misread);=20test=20call?= =?UTF-8?q?s=20that=20neither=20read=20nor=20write,=20a=20change=20in=20th?= =?UTF-8?q?e=20read's=20millisecond,=20and=20the=20change=20stamp's=20form?= =?UTF-8?q?at?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/rule_hook/test_rule_hook.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/bin/rule_hook/test_rule_hook.py b/bin/rule_hook/test_rule_hook.py index 13427c92..c7f7c44c 100644 --- a/bin/rule_hook/test_rule_hook.py +++ b/bin/rule_hook/test_rule_hook.py @@ -12,7 +12,7 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) from rule_hook.repeat_read import Asked, result_lines from rule_hook.rules import blocks, Breach, check, command_breaches, file_breaches, overrides -from rule_hook.main import breaches_of, read_breaches +from rule_hook.main import breaches_of, modified, read_breaches from rule_hook.call import Call, parsed_call from git_command import Commit, commit_message, commits from test_rank_todo import DECISIONS, README, TODO @@ -430,6 +430,23 @@ class RepeatRead(unittest.TestCase): self.assertEqual(self.found("Read", {"file_path": self.file, "limit": 10}), []) # Claude Code's Edit refuses a file changed since the agent last read it with Read, or wrote it with Edit or Write, until it reads it again. + def test_calls_that_neither_read_nor_write_the_file_are_passed_over(self): + self.used("Grep", {"pattern": "line", "path": self.folder}, "f.txt") + self.used("Bash", {"command": "ls"}, "f.txt") + self.read(1, 10) + self.assertEqual(rules(self.found("Read", {"file_path": self.file, "offset": 1, "limit": 10})), ["repeat-read"]) + + def test_a_change_in_the_millisecond_of_the_last_read_counts_as_before_it(self): + self.read(1, 10) + at = datetime.datetime(2026, 6, 1, tzinfo=datetime.UTC).timestamp() + os.utime(self.file, (at, at)) + self.assertEqual(rules(self.found("Read", {"file_path": self.file, "offset": 1, "limit": 10})), ["repeat-read"]) + + def test_a_file_s_change_is_stamped_as_the_transcript_stamps_its_entries(self): + at = datetime.datetime(2026, 6, 1, 12, 30, 5, 250000, tzinfo=datetime.UTC).timestamp() + os.utime(self.file, (at, at)) + self.assertEqual(modified(self.file), "2026-06-01T12:30:05.250Z") + def test_a_read_goes_through_once_the_file_changed_after_the_last_read(self): self.read(1, 10) self.change(30)