test: DFG Re20 provenance refuses dirty trees; versioned receipts
Per review ofaceea70e: 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. evidence70f6617) are documented. Adds a dirty-refusal test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8064834c37
commit
2220cdd157
3 files changed
+22
-5
No files matched your search
@@ -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__":
|
||||
|
||||
Reference in new issue
Block a user