PureOne's picture
Upload research package with Eve Uploader
bbff072 verified
Raw History Blame Contribute Delete
5.14 kB
#!/usr/bin/env python3
"""Bind the complete research ZIP to validated sources and runtime artifacts."""
import hashlib
import json
from pathlib import Path
import re
import zipfile
ROOT = Path(__file__).resolve().parent
def sha(path):
return hashlib.sha256(path.read_bytes()).hexdigest()
def main():
engine_hash = sha(ROOT / 'pagefs.py')
bench = json.loads((ROOT / 'experiments/benchmark_final_results.json').read_text())
admission = json.loads((ROOT / 'experiments/admission_results.json').read_text())
bound = json.loads((ROOT / 'experiments/reservation_bound_results.json').read_text())
assert bound['passed'] and bound['engine_source_sha256'] == engine_hash
weighted = json.loads((ROOT / 'experiments/weighted_budget_results.json').read_text())
assert weighted['passed'] and weighted['engine_source_sha256'] == engine_hash
audit = json.loads((ROOT / 'evidence/audit_release.json').read_text())
assert audit['passed'] and audit['engine_sha256'] == engine_hash
crash = json.loads((ROOT / 'crash_image_results.json').read_text())
seq = json.loads((ROOT / 'sequence_results.json').read_text())
compat = json.loads((ROOT / 'experiments/compatibility_results.json').read_text())
smoke = json.loads((ROOT / 'evidence/release_smoke.json').read_text())
build = json.loads((ROOT / 'dist/build_artifacts.json').read_text())
assert bench['sources_unchanged_during_measurement']
assert bench['engine_source_sha256']['v8'] == engine_hash
assert admission['passed'] and admission['source_sha256']['v8'] == engine_hash
assert admission['v8_acknowledged_undrainable_cases'] == 0
for result in (crash, seq):
assert result['passed'] and result['engine_source_sha256'] == engine_hash
assert engine_hash in compat['source_sha256'].values() and compat['passed']
assert smoke['passed'] and smoke['engine_sha256'] == engine_hash
assert build['engine_sha256'] == engine_hash
for item in build['artifacts']:
assert sha(ROOT / 'dist' / item['name']) == item['sha256']
tests = (ROOT / 'evidence/tests.txt').read_text()
assert tests.rstrip().endswith('OK')
test_count = int(re.search(r'Ran (\d+) tests', tests).group(1))
assert not re.search(r'__[A-Z_]+__', (ROOT / 'NYARION_FS_Manuscript.md').read_text())
provenance = {'release': '8.0.0', 'date': '2026-11-01', 'persistent_format': 5,
'engine_sha256': engine_hash, 'unit_integration_tests': test_count,
'capacity_backend_cases': admission['total_backend_cases'],
'exact_compiler_bound_checks': bound['exact_compiler_bound_checks'],
'weighted_helper_updates': weighted['mixed_updates'], 'unified_offline_audit_passed': True,
'v5_acknowledged_undrainable_cases': admission['v5_acknowledged_undrainable_cases'],
'v8_acknowledged_undrainable_cases': 0,
'actual_crash_image_recovery_checks': crash['recovery_checks'],
'sequence_transactions': seq['transactions'], 'standalone_artifacts_smoke_passed': True,
'native_ntfs_results': False, 'benchmark_runs': len(bench['trials']),
'contract': 'serialized POSIX engine; conditional logical-arena checkpoint feasibility',
'performance': 'weighted paths improve targeted bulk admission; ordinary results mixed; V5 regressions remain'}
(ROOT / 'evidence/release_provenance.json').write_text(json.dumps(provenance, indent=2) + '\n')
suffixes = {'.py', '.md', '.txt', '.pdf', '.json', '.toml', '.in', '.pyz', '.whl', '.gz'}
excluded = {'SHA256SUMS.txt', 'evidence_engine_initial.txt', 'evidence/admission_draft.txt', 'evidence/build.txt', 'evidence/release_smoke.txt'}
files = sorted(p for p in ROOT.rglob('*') if p.is_file() and not p.is_symlink()
and '__pycache__' not in p.parts and not any(x.endswith('.egg-info') for x in p.parts)
and (p.suffix in suffixes or p.name == 'LICENSE')
and p.relative_to(ROOT).as_posix() not in excluded)
hashes = ROOT / 'SHA256SUMS.txt'
hashes.write_text(''.join(f'{sha(p)} {p.relative_to(ROOT).as_posix()}\n' for p in files))
files.append(hashes)
target = ROOT.parent.parent / 'output/NYARION_FS_Research_Package.zip'
target.parent.mkdir(exist_ok=True)
with zipfile.ZipFile(target, 'w', zipfile.ZIP_DEFLATED, compresslevel=9) as archive:
for path in files:
info = zipfile.ZipInfo('NYARION_FS/' + path.relative_to(ROOT).as_posix(), (2026, 11, 1, 18, 0, 0))
info.compress_type = zipfile.ZIP_DEFLATED
info.external_attr = (0o100755 if path.suffix == '.pyz' else 0o100644) << 16
archive.writestr(info, path.read_bytes())
with zipfile.ZipFile(target) as archive:
assert archive.testzip() is None
assert hashlib.sha256(archive.read('NYARION_FS/pagefs.py')).hexdigest() == engine_hash
print(json.dumps({'files': len(files), 'bytes': target.stat().st_size, 'validation': 'passed'}, indent=2))
if __name__ == '__main__':
main()