Bind repair execution receipts to the reviewed plan hash

This commit is contained in:
2026-11-08 19:09:27 +08:00
parent 3f81734e69
commit c05b979b01
2 changed files with 3 additions and 0 deletions
+2
View File
@@ -181,6 +181,8 @@ def run(db, out, *, pg_service=None, pg_schema=None, plan=None, plan_sha256=None
raise ValueError('Plan belongs to another database/schema')
report = apply_plan(c, expected) if expected is not None else inspect(c)
report['database'] = identity
if expected is not None:
report['plan_sha256'] = plan_sha256
if expected is not None:
c.commit()
except BaseException:
+1
View File
@@ -108,6 +108,7 @@ class JointEditionTests(unittest.TestCase):
result=run(self.db,Path(self.tmp.name)/'applied.json',plan=out,plan_sha256=sha)
again=run(self.db,Path(self.tmp.name)/'retry.json',plan=out,plan_sha256=sha)
self.assertEqual(result['updated_editions'],2);self.assertEqual(again['updated_editions'],0)
self.assertEqual(result['plan_sha256'],sha);self.assertEqual(again['plan_sha256'],sha)
altered=json.loads(raw);altered['database']['path']='another.sqlite'
bad=Path(self.tmp.name)/'wrong-db.json';bad.write_text(json.dumps(altered))
with self.assertRaisesRegex(ValueError,'another database'):