"""Synthetic manifests verify the preflight detects tampering, with no large model files.""" from pathlib import Path import hashlib,json,tempfile,unittest from verify_assets import check class InventoryTest(unittest.TestCase): def test_manifest_tampering_is_rejected(self): with tempfile.TemporaryDirectory() as d: root=Path(d);resources=root/'resources';(resources/'text_encoder').mkdir(parents=True);(resources/'video_vae.safetensors').write_bytes(b'encoder fixture') (root/'model.safetensors').write_bytes(b'model fixture') (root/'config.json').write_text(json.dumps(dict(action_dim=20,chunk_size=32,torch_dtype='bfloat16'))) (root/'manifest.json').write_text(json.dumps(dict(kind='policy_export',format_version=1,sha256={n:hashlib.sha256((root/n).read_bytes()).hexdigest() for n in ['config.json','model.safetensors']}))) self.assertTrue(check('flux',root,resources,verify_hashes=True)['hashes_verified']) (root/'model.safetensors').write_bytes(b'changed') with self.assertRaisesRegex(ValueError,'Manifest hash mismatch'):check('flux',root,resources,verify_hashes=True) def test_pi05_requires_checkpoint_norm_stats_not_optimizer(self): with tempfile.TemporaryDirectory() as d: root=Path(d);(root/'model.safetensors').write_bytes(b'model fixture') with self.assertRaisesRegex(ValueError,'norm_stats'):check('pi05',root) n=root/'assets/umi_v3/norm_stats.json';n.parent.mkdir(parents=True);n.write_text('{"state":{"mean":[0]},"actions":{"mean":[0]}}') self.assertFalse(check('pi05',root)['optimizer_required_for_inference']) if __name__=='__main__':unittest.main()