diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index a9995cb3..54dd51d9 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -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 diff --git a/docs/build-validation.md b/docs/build-validation.md index df06b1cb..11df61eb 100644 --- a/docs/build-validation.md +++ b/docs/build-validation.md @@ -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. diff --git a/scripts/smoke-static-cli.py b/scripts/smoke-static-cli.py new file mode 100644 index 00000000..27e25f47 --- /dev/null +++ b/scripts/smoke-static-cli.py @@ -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(" 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 + print("static CLI mixed GGUF/KAR smoke passed") + + +if __name__ == "__main__": + main()