feat(01-01): stage preserved sessions and import typed hashed receipts

This commit is contained in:
UnixNight committed 2026-11-12 19:02:34 -05:00
1 parent 597caa0b49
commit cd7783ba3a
3 files changed
+605

No files matched your search

+21
View File
@@ -242,6 +242,27 @@ class FidelitySessions(unittest.TestCase):
value['schema_version'] = 99
path.write_text(json.dumps(value))
self.assertNotEqual(self.cli('validate', path, '--root', bundle).returncode, 0)
def test_historical_report_hashes_actual_bytes_and_retains_missing(self):
api = self.api()
report = self.base / 'report.md'
report.write_text('Historical Wine/component evidence; native Windows open')
result = api.identify_report(self.original, report, self.original / 'game.exe',
self.base / 'missing-resources')
self.assertTrue(result['historical'])
self.assertEqual(result['actual']['executable']['sha256'], self.files[0]['sha256'])
self.assertIn('Historical Wine/component', result['recorded_scope'])
self.assertTrue(any('resources absent' in s for s in result['missing_evidence']))
def test_cli_hostile_output_and_tampering_exit_nonzero(self):
result = self.cli('stage', '--source', self.original, '--manifest', self.manifest,
'--output', self.original / 'illegal', '--session-id', 'new')
self.assertNotEqual(result.returncode, 0)
self.assertFalse((self.original / 'illegal').exists())
bundle, path, _ = self.fixture_receipt()
(bundle / 'port.txt').write_text('changed')
self.assertNotEqual(self.cli('import', path, '--root', bundle,
'--output', self.base / 'test-index').returncode, 0)
path.write_bytes(b' ' * (4 * 1024 * 1024 + 1))
self.assertNotEqual(self.cli('validate', path, '--root', bundle).returncode, 0)