test: DFG Re20 provenance refuses dirty trees; versioned receipts

Per review of aceea70e: a dirty checkout is refused (HEAD would not
describe the code that runs, and a dirty-to-dirty edit would pass the
end-of-run check). On a clean tree HEAD pins the imported helpers too.
plan.json and result.json carry schema=2; schema-1 receipts (bare list,
e.g. evidence 70f6617) are documented. Adds a dirty-refusal test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-20 18:28:25 +00:00
1 parent 8064834c37
commit 2220cdd157
3 files changed
+22 -5

No files matched your search

+9 -1
View File
@@ -82,7 +82,15 @@ class Re20Provenance(unittest.TestCase):
self.assertEqual(len(record["checkout_revision"]), 40)
self.assertEqual(len(record["src_tree"]), 40)
self.assertEqual(len(record["runner_sha256"]), 64)
self.assertIn("checkout_dirty", record)
self.assertFalse(record["checkout_dirty"])
self.assertEqual(v.RESULT_SCHEMA, 2)
def test_dirty_checkout_is_refused(self):
from unittest.mock import patch
with patch("source_provenance.subprocess.check_output",
side_effect=["f" * 40 + "\n", " M src/x.py\n"]):
with self.assertRaisesRegex(RuntimeError, "clean checkout"):
v.provenance(rr.DEFAULT_SOURCE)
if __name__ == "__main__":