Smoke test static Linux CLI model preparation in CI

This commit is contained in:
Pavlo Ratushnyi
2026-10-02 21:33:15 +02:00
parent 2f182575dc
commit a3ec1b27ed
3 changed files with 90 additions and 0 deletions
+6
View File
@@ -42,11 +42,17 @@ jobs:
echo 'ELF has a dynamic interpreter' >&2
exit 1
fi
if readelf -d "$binary" | grep -q NEEDED; then
echo 'ELF has a dynamic library dependency' >&2
exit 1
fi
"$binary" --version
mkdir -p dist
cp "$binary" dist/strata-next-linux-x86_64-musl
cd dist
sha256sum strata-next-linux-x86_64-musl > SHA256SUMS
- name: Static CLI model smoke
run: python3 scripts/smoke-static-cli.py control-plane/target/x86_64-unknown-linux-musl/release/strata-next
- uses: actions/upload-artifact@v4
with:
name: strata-next-linux-x86_64-musl
+1
View File
@@ -95,3 +95,4 @@ The test toolchain was installed into ignored `artifacts/tool-venv/` for this ru
- Added `model prepare-mixed-preview` and `model verify-mixed-preview`, with a separate versioned sidecar carrying each original tensor kind and digest. A four-type synthetic GGUF passed preparation and verification in Rust tests. A separate two-type CLI smoke produced a KAR archive whose virtual F32 SHA-256 was `c407838a4718093d8f2699209c7cac8b998a47b937e5afe59e4c5a0af09033a7`; the verifier matched the source, sidecar, KAR source records, and payload CRCs. All 45 Rust tests, Clippy with warnings denied, and Linux/arm64 musl cross-check pass. The preview remains capped at 64 MiB input and is not approved for serving.
- Added `model derive-sharded-identity` for manifest-pinned GGUF shards. A two-file fixture deliberately listed IQ3_S before F32 in its manifest; native derivation sorted filenames, checked both size/SHA-256 values, and assigned global F32 offsets 0 and 128. Replacing a manifest SHA-256 with the wrong value was rejected. A separate CLI smoke emitted the expected derived stream SHA-256 `e529f5e2f7aac1aa5509fabe728d84ab876c64754635963825e265cd70cb8b05`. All 46 Rust tests, Clippy with warnings denied, and Linux/arm64 musl cross-check pass. No sharded KAR archive or real-model conversion was attempted.
- Extracted the shared one-tensor preview encoder and reconstruction check for future sharded preparation. Existing F32, IQ3_S, and mixed preview tests passed. Rebuilt the CLI and reran the pinned two-type mixed fixture: the derived F32 SHA-256 remained `c407838a4718093d8f2699209c7cac8b998a47b937e5afe59e4c5a0af09033a7` and the full KAR archive SHA-256 remained `4053e787d46b2cf2bca3d67e38d06e1ee96a157e80e3155c8dbdbf36835df88c` byte for byte. This is a non-lossy refactor of the preview implementation, not a quality result for the lossy format.
- Added a CI-only synthetic mixed GGUF/KAR smoke script for the Linux musl release binary. The workflow now rejects an ELF interpreter or `NEEDED` dynamic library, runs the CLI through derivation, preparation, and source/provenance/archive verification, and checks the pinned derived/archive SHA-256 values before uploading. The script passed locally against the current macOS debug CLI; the hosted Linux workflow has not run because this checkout has no project remote. Python is used only to create the CI fixture, not by production serving.
+83
View File
@@ -0,0 +1,83 @@
#!/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("<IQQ", 3, 2, 1))
def string(value: str) -> None:
encoded = value.encode()
header.extend(struct.pack("<Q", len(encoded)))
header.extend(encoded)
string("general.architecture")
header.extend(struct.pack("<I", 8))
string("qwen35")
for name, kind, offset, elements in (
("dense", 0, 128, 32),
("expert", 21, 0, 256),
):
string(name)
header.extend(struct.pack("<IQIQ", 1, elements, kind, offset))
header.extend(bytes((-len(header)) % 32))
payload = bytearray(256)
payload[:2] = struct.pack("<H", 0x3C00)
for index in range(64):
payload[index + 2] = index * 3 % 256
payload[74] = 0x55
for index in range(32):
payload[128 + 4 * index : 132 + 4 * index] = struct.pack(
"<f", (-1.0, -0.25, 0.25, 1.0)[index % 4]
)
return bytes(header + payload)
def main() -> 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
print("static CLI mixed GGUF/KAR smoke passed")
if __name__ == "__main__":
main()