Download audit_release.py from PureOne/NYARION-FS-8.0-Transactional-Storage-Engine: direct link, hf CLI and curl.
- Browser
- Download file 3.4 kB
-
https://huggingface.co/datasets/PureOne/NYARION-FS-8.0-Transactional-Storage-Engine/resolve/main/audit_release.py
- Command line
-
hf download hf://datasets/PureOne/NYARION-FS-8.0-Transactional-Storage-Engine/audit_release.py
-
curl -L -o audit_release.py https://huggingface.co/datasets/PureOne/NYARION-FS-8.0-Transactional-Storage-Engine/resolve/main/audit_release.py
3.4 kB
| #!/usr/bin/env python3 | |
| """One-command functional audit, offline build, smoke and artifact verification. | |
| Frozen performance measurements are deliberately not rerun or overwritten. | |
| The audit uses only local Python tools, temporary files and an offline wheel | |
| installation into a temporary virtual environment seeded by the local runtime. | |
| """ | |
| from __future__ import annotations | |
| import hashlib | |
| import json | |
| from pathlib import Path | |
| import subprocess | |
| import sys | |
| import tarfile | |
| import tempfile | |
| ROOT = Path(__file__).resolve().parent | |
| def sha(path): | |
| return hashlib.sha256(path.read_bytes()).hexdigest() | |
| def main(): | |
| before = sha(ROOT / 'pagefs.py') | |
| evidence = ROOT / 'evidence' | |
| evidence.mkdir(exist_ok=True) | |
| jobs = [('functional', ['run_checks.py']), | |
| ('offline_build', ['build_release.py']), | |
| ('standalone_smoke', ['release_smoke.py'])] | |
| checks = [] | |
| for label, command in jobs: | |
| process = subprocess.run([sys.executable, *command], cwd=ROOT, | |
| stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) | |
| (evidence / f'audit_{label}.txt').write_text(process.stdout) | |
| print(f'{label}: {"passed" if process.returncode == 0 else "FAILED"}', flush=True) | |
| if process.returncode: | |
| print(process.stdout) | |
| raise SystemExit(process.returncode) | |
| checks.append(label) | |
| manifest = json.loads((ROOT / 'dist/build_artifacts.json').read_text()) | |
| assert manifest['engine_sha256'] == before | |
| for artifact in manifest['artifacts']: | |
| assert sha(ROOT / 'dist' / artifact['name']) == artifact['sha256'] | |
| source = next((ROOT / 'dist').glob('nyarion_fs-*.tar.gz')) | |
| with tempfile.TemporaryDirectory(prefix='nyarion-source-audit-') as folder: | |
| target = Path(folder) | |
| with tarfile.open(source, 'r:gz') as archive: | |
| for member in archive.getmembers(): | |
| destination = (target / member.name).resolve() | |
| if not member.isfile() or not destination.is_relative_to(target.resolve()): | |
| raise AssertionError('invalid source archive member') | |
| destination.parent.mkdir(parents=True, exist_ok=True) | |
| destination.write_bytes(archive.extractfile(member).read()) | |
| checkout = next(target.iterdir()) | |
| assert sha(checkout / 'pagefs.py') == before | |
| isolated = subprocess.run([sys.executable, 'run_checks.py'], cwd=checkout, | |
| stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) | |
| (evidence / 'audit_isolated_source.txt').write_text(isolated.stdout) | |
| if isolated.returncode: | |
| print(isolated.stdout) | |
| raise SystemExit(isolated.returncode) | |
| checks.append('isolated_source_full_functional_suite') | |
| assert sha(ROOT / 'pagefs.py') == before, 'engine changed during audit' | |
| result = {'passed': True, 'version': manifest['version'], 'engine_sha256': before, | |
| 'checks': checks, 'artifact_hashes_checked': len(manifest['artifacts']), | |
| 'performance_rerun': False, 'mandatory_network': False, | |
| 'scope': 'local functional/release audit; no native NTFS or hardware qualification'} | |
| (evidence / 'audit_release.json').write_text(json.dumps(result, indent=2) + '\n') | |
| print(json.dumps(result, indent=2)) | |
| if __name__ == '__main__': | |
| main() | |