Answer stability round 2: 0 🔴, 2 🟡 (0 misread); test calls that neither read nor write, a change in the read's millisecond, and the change stamp's format
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user