#!/usr/bin/env python3 """CI-only fixture for the standalone Linux CLI; no model assets are retained.""" import hashlib import json import pathlib import struct import subprocess import sys import tempfile def fixture() -> bytes: header = bytearray(b"GGUF" + struct.pack(" None: encoded = value.encode() header.extend(struct.pack(" bytes: header = bytearray(b"GGUF" + struct.pack(" None: encoded = value.encode() header.extend(struct.pack(" None: binary = pathlib.Path(sys.argv[1]).resolve() with tempfile.TemporaryDirectory(prefix="strata-static-smoke-") as temporary: root = pathlib.Path(temporary) source = root / "mixed.gguf" archive = root / "mixed.kar" source.write_bytes(fixture()) derive = subprocess.run( [binary, "model", "derive-mixed-identity", source], capture_output=True, text=True, check=True, ) identity = json.loads(derive.stdout) expected_source = "c407838a4718093d8f2699209c7cac8b998a47b937e5afe59e4c5a0af09033a7" assert identity["derived_f32_sha256"] == expected_source prepare = subprocess.run( [binary, "model", "prepare-mixed-preview", source, "--output", archive, "--levels", "2"], capture_output=True, text=True, check=True, ) assert "not eligible for serving" in prepare.stdout expected_archive = "4053e787d46b2cf2bca3d67e38d06e1ee96a157e80e3155c8dbdbf36835df88c" assert hashlib.sha256(archive.read_bytes()).hexdigest() == expected_archive provenance = json.loads((root / "mixed.kar.provenance.json").read_text()) assert provenance["original_gguf_sha256"] == hashlib.sha256(source.read_bytes()).hexdigest() assert provenance["derived_f32_sha256"] == expected_source assert provenance["archive_sha256"] == expected_archive verify = subprocess.run( [binary, "model", "verify-mixed-preview", archive, "--source", source], capture_output=True, text=True, check=True, ) assert "payload CRCs match" in verify.stdout # Projection conversion must preserve every F32 bit and refuse overwrite. export = root / "dense.f32" result = subprocess.run([binary, "model", "export-tensor-f32", source, "dense", "--output", export], capture_output=True, text=True, check=True) metadata = json.loads(result.stdout) expected = b"".join(struct.pack("