Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

Evals: compare a protected test as text, so CRLF checkouts match

justrachffbe7ce44cef
diff --git a/graff-evals/measurement.py b/graff-evals/measurement.py
index 213abb15..c95c15c7 100644
--- a/graff-evals/measurement.py
+++ b/graff-evals/measurement.py
@@ -226,13 +226,16 @@ def verifier_snapshot(sandbox, task, task_root):
def verifiers_unchanged(snapshot):
for path, want in snapshot.items():
try:
+ if isinstance(want, dict):
+ # Read as the snapshot did: text with universal newlines, so a
+ # CRLF checkout (Windows) matches its own protected block.
+ if want['contains'] not in Path(path).read_text(errors='replace'):
+ return False
+ continue
data = Path(path).read_bytes()
except OSError:
return False
- if isinstance(want, dict):
- if want['contains'].encode() not in data:
- return False
- elif hashlib.sha256(data).hexdigest() != want:
+ if hashlib.sha256(data).hexdigest() != want:
return False
return True
diff --git a/graff-evals/test_measurement.py b/graff-evals/test_measurement.py
index 94931ffa..658b78ca 100644
--- a/graff-evals/test_measurement.py
+++ b/graff-evals/test_measurement.py
@@ -283,6 +283,9 @@ class MeasurementTests(unittest.TestCase):
self.assertTrue(measurement.verifiers_unchanged(snap))
source.write_text(body.replace('f() == 2', 'f() == 1')) # the test itself
self.assertFalse(measurement.verifiers_unchanged(snap))
+ # Line endings are not an edit: a CRLF file still holds the block.
+ source.write_bytes(body.replace('return 1;', 'return 2;').replace('\n', '\r\n').encode())
+ self.assertTrue(measurement.verifiers_unchanged(snap))
def test_a_sandbox_gets_its_own_repository_holding_the_task(self):
import subprocess