The vendored Strata tree engine/strata is removed for good (owner decision 2026-11-23): Leleka never builds or runs it, the vanilla
benchmark builds from its own checkout, the comparison measurements are finished and the CUDA ports are frozen. Everything below
compiled or read that tree, so it cannot run without it and is retired (the tree stays in git history, see third_party/strata/UPSTREAM.md).
Checked-in fixtures, golden JSON, sealed PTX, seal plans and MANIFEST hashes are untouched and keep being replayed by the cargo tests.
Drift guard
- crates/experimental-ref/tests/literal_port.rs: include_str! of the Original .cu files compared with the checked-in experimental ports.
Oracle generators and builders (they compile or extract from the Strata C++/Python sources; their outputs are the checked-in goldens)
- crates/experimental-ref/oracle/gen_{cvec,kv,remote,stream}_golden.{cpp,sh}, gen_seal_additions.py and the cuda_runtime stub they used
- crates/sampler-ref/oracle/build_oracle.sh, gen_fixtures.cpp, gen_sampling_keys.py, stub/ (run_port_host_tests.sh and the fixtures stay)
- crates/serving-policy/oracle/ (build_oracle.sh, gen_{host,cvec,vision}_fixtures.cpp)
- crates/context/tests/rope_plan_golden/gen_* (plan, rope, kv pool)
- crates/engine-core/src/conversation/golden/gen*.{sh,cpp} and stub/
- crates/cuda-driver/oracle/gen_prefill_ring_trace.py and drivers/prefill_ring_trace.cpp (extracted prefill.cpp), check_cu_syntax.sh
- crates/engine-qwen35-cuda/tests/stra161_reference/reference.py (fixtures.json and the Rust constants stay)
- control-plane/tests/golden/gen_goldens.py, scripts/offline/ (Python differentials and golden generators against the Strata Python tools)
Source-compiling CUDA oracles and builders
- scripts/build-cuda-{projection-family,q5,q6,qsa}-oracle.sh with scripts/cuda-{projection-family,q5,q6,qsa}-oracle/ (include the Original .cu; sha256 pins of them)
- scripts/build-original-verify-ptx.sh, scripts/q8/rebuild_quantizer_ptx.sh, scripts/decode-sm120/make_iq_prefix.py (needs engine/strata/include)
- scripts/cuda-stubs/ (check-cu.py and literal_diff.py need the strata headers and the Original sources; the stub headers served only them)
- tools/chain-probe/build.sh, tools/kernel-ab/{cpp,aa.sh,smoke.sh,time_smoke.sh} (the C++ comparator is built from the Strata CPU kernels; verify_manifest.py stays)
- scripts/e2e/codex/speed/verify-hc-down-kernel-microbench-vs-upstream/ (compiles the upstream kernel from the tree)
Engine builds and Python smokes that need the tree
- scripts/build-cpu.sh, scripts/build-static-cuda.sh, scripts/check-keyless-gpu.sh, scripts/test-static-cuda-profile.py (CMake of engine/strata)
- scripts/compare-real-tokenizer.py, scripts/smoke-mtp-pack.py (reads src/core/mtp.cpp and a bench manifest), scripts/prepare-keyless-routing.py and its test
- scripts/smoke-native-pack.py became scripts/native-pack-fixture.py: the synthetic GGUF fixtures the four other smokes import stay, the iq_pack.py oracle comparison goes
Gates and CI
- scripts/check-local.sh: no live Python oracle differentials, no literal_port note, no check-cu, no build-cpu, no retired test scripts
- .github/workflows/linux.yml: the keyless-cuda, static-cuda-package and hosted-cuda-package jobs (they built the engine from the tree) and their dispatch
inputs, and the two oracle smoke steps; .github/workflows/port.yml: the Python oracle environment and the llama.cpp fetch of port-oracles
(the sampler host shim still runs)
- limits.json and scripts/check_limits_test.py exclude third_party/strata/ instead of engine/strata/
Documentation and comments: README.md names third_party/strata and the pin; deploy/README.md marks the retired build and smoke commands; comments
in Rust, Python and Markdown that named engine/strata/... now name "Strata 41cf05a0, ..."; the gpu-bringup scratch-copy test no longer copies the
removed include directories. Stale engine/strata paths in sealed .cu, .ptx, seal-plan and MANIFEST files are left as they are (hashes may depend on the bytes).
224 lines
15 KiB
Bash
Executable File
224 lines
15 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Local and CI gate.
|
|
#
|
|
# scripts/check-local.sh fast path, Linux type-check, port oracles, then the full legacy suite
|
|
# scripts/check-local.sh --fast only the fast path (seconds to a few minutes, works on macOS)
|
|
# scripts/check-local.sh --port fast path, Linux type-check and the CPU oracle differentials of the Rust port
|
|
# scripts/check-local.sh --product what ships: the CI coverage gate, a build of every default-member,
|
|
# the release build of the six product binaries (leleka, leleka-api, leleka-inference,
|
|
# leleka-daemon, leleka-cli, leleka-seal-exec), the tests of the product crates, the
|
|
# type-check of the CUDA-feature crates, Clippy and rustfmt (known debt is reported)
|
|
# scripts/check-local.sh --clippy-limits opt-in, slow: ratchet of the Clippy length/complexity/argument lints (STRA-367,
|
|
# scripts/check-clippy-limits.sh); alone it runs only that, next to a mode it runs last
|
|
#
|
|
# Environment:
|
|
# STRICT_DEBT=1 fail on the known format/Clippy debt listed below instead of warning
|
|
# SKIP_LINUX_TYPECHECK=1 skip the x86_64-unknown-linux-gnu type-check (needs `rustup target add` otherwise)
|
|
# LELEKA_LINUX_TESTS=1 also run scripts/linux-tests/run.sh (Docker Linux harness, branch claude/port-linux-tests)
|
|
#
|
|
# No model weights, tokens or network access to model hosts are used by any step.
|
|
set -euo pipefail
|
|
|
|
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
|
|
mode=""
|
|
clippy_limits=0
|
|
for arg in "$@"; do
|
|
case "${arg}" in
|
|
""|--full) mode=full ;;
|
|
--fast) mode=fast ;;
|
|
--port) mode=port ;;
|
|
--product) mode=product ;;
|
|
--clippy-limits) clippy_limits=1 ;;
|
|
-h|--help) sed -n '2,22p' "${BASH_SOURCE[0]}"; exit 0 ;;
|
|
*) echo "usage: $0 [--fast|--port|--product|--full] [--clippy-limits]" >&2; exit 2 ;;
|
|
esac
|
|
done
|
|
if [[ -z "${mode}" ]]; then
|
|
if ((clippy_limits)); then mode=clippy-limits; else mode=full; fi
|
|
fi
|
|
|
|
# Known debt on the port branch: these crates are not rustfmt/Clippy clean (other agents own the sources, so the gate
|
|
# reports them instead of reformatting). New debt-free crates must be added to strict_crates below, not here.
|
|
debt() {
|
|
if "$@"; then return 0; fi
|
|
if [[ "${STRICT_DEBT:-0}" == 1 ]]; then
|
|
echo "FAILED (STRICT_DEBT=1): $*" >&2
|
|
return 1
|
|
fi
|
|
echo "WARNING: known debt, not failing: $*" >&2
|
|
}
|
|
|
|
host_os="$(uname -s)"
|
|
|
|
# Crates that build natively on macOS and Linux and are fmt-, Clippy- and test-clean.
|
|
strict_crates=(leleka-backend-api leleka-tokenizer leleka-quant-core leleka-context leleka-sampler-ref leleka-serving-policy leleka-offline-tools)
|
|
strict_args=(); for c in "${strict_crates[@]}"; do strict_args+=(-p "$c"); done
|
|
|
|
fast_path() {
|
|
echo "== fast path: fmt, Clippy, tests on ${strict_crates[*]}"
|
|
cargo fmt "${strict_args[@]}" --check
|
|
cargo clippy --manifest-path "${repo_root}/Cargo.toml" --locked "${strict_args[@]}" --all-targets --no-deps -- -D warnings
|
|
cargo test --manifest-path "${repo_root}/Cargo.toml" --locked "${strict_args[@]}"
|
|
# Host-buildable crates with known debt: tests and Clippy still run; formatting is reported only.
|
|
debt cargo fmt -p leleka-model-format -p leleka-experimental-ref --check
|
|
cargo clippy --manifest-path "${repo_root}/Cargo.toml" --locked -p leleka-experimental-ref --all-targets --no-deps -- -D warnings
|
|
debt cargo clippy --manifest-path "${repo_root}/Cargo.toml" --locked -p leleka-model-format --all-targets --no-deps -- -D warnings
|
|
cargo test --manifest-path "${repo_root}/Cargo.toml" --locked -p leleka-experimental-ref -p leleka-model-format
|
|
}
|
|
|
|
linux_typecheck() {
|
|
if [[ "${SKIP_LINUX_TYPECHECK:-0}" == 1 ]]; then
|
|
echo "== linux type-check skipped (SKIP_LINUX_TYPECHECK=1)"
|
|
return 0
|
|
fi
|
|
echo "== type-check for x86_64-unknown-linux-gnu (leleka-cuda-driver with cuda-driver, leleka-runtime)"
|
|
if [[ "${host_os}" != Linux ]] && ! rustup target list --installed 2>/dev/null | grep -qx x86_64-unknown-linux-gnu; then
|
|
echo "missing target: run 'rustup target add x86_64-unknown-linux-gnu' or set SKIP_LINUX_TYPECHECK=1" >&2
|
|
return 1
|
|
fi
|
|
cargo check --manifest-path "${repo_root}/Cargo.toml" --locked --target x86_64-unknown-linux-gnu --all-targets \
|
|
-p leleka-cuda-model -p leleka-cuda-driver --features cuda-driver -p leleka-engine-qwen35-cuda -p leleka-runtime
|
|
}
|
|
|
|
port_oracles() {
|
|
echo "== port CPU oracles that need no Python: sampler host shim"
|
|
# Pure-host tests of the Linux-only sampler files, against fixtures built from the unmodified Original host code.
|
|
"${repo_root}/crates/sampler-ref/oracle/run_port_host_tests.sh"
|
|
# Golden fixtures built from the Original C++/Python (rope, memory plan, serving policy, conversation, experimental
|
|
# references, offline tools, tokenizer) are checked in and replayed by the cargo tests above. The generators and the live
|
|
# Python differentials needed the vendored Strata tree, which was removed (third_party/strata/UPSTREAM.md, STRA-406).
|
|
}
|
|
|
|
linux_harness() {
|
|
if [[ "${LELEKA_LINUX_TESTS:-0}" == 1 ]]; then
|
|
if [[ -x "${repo_root}/scripts/linux-tests/run.sh" ]]; then
|
|
echo "== Docker Linux test harness"
|
|
"${repo_root}/scripts/linux-tests/run.sh"
|
|
else
|
|
echo "scripts/linux-tests/run.sh is not present (it lives on branch claude/port-linux-tests until merged)" >&2
|
|
return 1
|
|
fi
|
|
fi
|
|
}
|
|
|
|
# What ships. Everything here runs without a GPU, model weights or network access to model hosts; the CUDA crates are built and
|
|
# their Linux-gated tests run, but no kernel is executed (lists what this cannot prove).
|
|
product_path() {
|
|
# A failing step is recorded and the rest still runs, so one red run lists everything that is broken.
|
|
local failed=()
|
|
gate() { if "$@"; then return 0; fi; failed+=("$*"); echo "PRODUCT STEP FAILED: $*" >&2; return 0; }
|
|
echo "== product: coverage gate"
|
|
gate python3 "${repo_root}/scripts/check-ci-coverage.py"
|
|
echo "== product: architecture gate (layers, adapter edges, size and source ratchets; STRA-338)"
|
|
gate python3 "${repo_root}/scripts/check_architecture_test.py"
|
|
gate python3 "${repo_root}/scripts/check-architecture.py"
|
|
echo "== product: limits gate (function 30 lines, complexity 10, nesting 4, width 120 on new and changed code; legacy census only falls; STRA-367)"
|
|
gate python3 "${repo_root}/scripts/check_limits_test.py"
|
|
gate python3 "${repo_root}/scripts/check-limits.py"
|
|
echo "== product: sealed PTX are byte-exact LF (a CRLF checkout makes the engine refuse to start)"
|
|
if grep -rl --include='*.ptx' $'\r' "${repo_root}/crates/cuda-driver" >&2; then
|
|
echo "CR found in the sealed PTX listed above: check out with core.autocrlf=false (.gitattributes marks them -text)" >&2
|
|
failed+=("sealed PTX contain CR")
|
|
fi
|
|
local manifest=(--manifest-path "${repo_root}/Cargo.toml" --locked)
|
|
echo "== product: build every default-member"
|
|
gate cargo build "${manifest[@]}"
|
|
echo "== product: release build of the six shipped binaries (spec node deploy.md section 8)"
|
|
gate cargo build "${manifest[@]}" --release -p leleka-deploy --bin leleka
|
|
gate cargo build "${manifest[@]}" --release -p leleka-control-plane --bin leleka-api
|
|
gate cargo build "${manifest[@]}" --release -p leleka-engine-host --features sm86 \
|
|
--bin leleka-inference --bin leleka-daemon --bin leleka-cli --bin leleka-seal-exec
|
|
local out="${CARGO_TARGET_DIR:-${repo_root}/target}/release" exe="" bin
|
|
[[ "${host_os}" == Linux ]] || exe=".exe"
|
|
for bin in leleka leleka-api leleka-inference leleka-daemon leleka-cli leleka-seal-exec; do
|
|
[[ -x "${out}/${bin}${exe}" ]] || { echo "missing release binary: ${out}/${bin}${exe}" >&2; failed+=("missing release binary ${bin}"); }
|
|
done
|
|
echo "== product: type-check the CUDA-feature crates (nothing is executed on a GPU)"
|
|
gate cargo check "${manifest[@]}" --all-targets -p leleka-cuda-model -p leleka-cuda-driver --features cuda-driver -p leleka-engine-qwen35-cuda -p leleka-runtime -p leleka-native-parity-bench
|
|
echo "== product: tests of the crates that ship"
|
|
# The deploy end-to-end tests read the host GPU through nvidia-smi and the default loopback ports; the stand-in makes them
|
|
# independent of the machine (a CI host has no GPU, a workstation has a busy one). LELEKA_REAL_NVIDIA_SMI=1 keeps the real tool.
|
|
local smi_path="${PATH}"
|
|
[[ "${LELEKA_REAL_NVIDIA_SMI:-0}" == 1 ]] || smi_path="${repo_root}/scripts/ci:${PATH}"
|
|
# Two end-to-end tests depend on the class of the host GPU, on >= 142 GiB free disk and on the default loopback ports, and expect
|
|
# opposite GPUs (dry_run wants a 5090-class host, a_failing_preflight wants one that cannot hold the 5090 profile): they cannot both
|
|
# pass on one stand-in. They are reported as debt until the tests carry their own nvidia-smi.
|
|
local host_tests=(dry_run_prints_the_plan_and_changes_nothing a_failing_preflight_stops_before_any_change_and_says_how_to_fix_it)
|
|
PATH="${smi_path}" gate cargo test "${manifest[@]}" --no-fail-fast -p leleka-deploy --features test-fakes -- --skip "${host_tests[0]}" --skip "${host_tests[1]}"
|
|
PATH="${smi_path}" gate debt cargo test "${manifest[@]}" -p leleka-deploy --features test-fakes --test e2e -- "${host_tests[@]}"
|
|
gate cargo test "${manifest[@]}" --no-fail-fast -p leleka-memory -p leleka-memory-os -p leleka-runtime-client -p leleka-gateway-text -p leleka-gateway-domain -p leleka-worker-protocol -p leleka-engine-core -p leleka-engine-fake -p leleka-control-plane -p leleka-engine-host
|
|
gate cargo test "${manifest[@]}" --no-fail-fast -p leleka-cuda-model
|
|
gate cargo test "${manifest[@]}" --no-fail-fast -p leleka-cuda-driver --features cuda-driver
|
|
gate cargo test "${manifest[@]}" --no-fail-fast -p leleka-engine-qwen35-cuda -p leleka-native-cpu-expert
|
|
# the remaining default-members (CPU, iGPU and NPU runtime, formats); the strict crates and experimental-ref run in the fast path
|
|
gate cargo test "${manifest[@]}" --no-fail-fast -p leleka-cpu-kernels -p leleka-cpu-sys -p leleka-cpu-worker -p leleka-gguf \
|
|
-p leleka-gptoss -p leleka-gptoss-igpu -p leleka-harmony -p leleka-igpu -p leleka-kar-codec -p leleka-igpu-worker \
|
|
-p leleka-shm -p leleka-openvino -p leleka-npu-service -p leleka-gptoss-npu -p leleka-npu-worker \
|
|
-p leleka-gpu-npu-worker -p leleka-model-format -p leleka-obs
|
|
echo "== product: rustfmt and Clippy on the shipped crates"
|
|
# Clean today, so they are hard gates: the control plane, the desktop-core binaries and the runtime client for rustfmt; these plus the
|
|
# memory governor and the deploy tool for Clippy (-D warnings).
|
|
gate cargo fmt -p leleka-control-plane -p leleka-engine-host -p leleka-runtime-client --check
|
|
local crate
|
|
for crate in leleka-memory leleka-memory-os leleka-runtime-client leleka-control-plane leleka-engine-host leleka-deploy; do
|
|
gate cargo clippy "${manifest[@]}" -p "${crate}" --all-targets --no-deps -- -D warnings
|
|
done
|
|
# Known debt (lists the counts); STRICT_DEBT=1 makes it fatal. Other agents own these sources.
|
|
gate debt cargo fmt -p leleka-deploy -p leleka-memory -p leleka-cuda-model -p leleka-cuda-driver -p leleka-engine-qwen35-cuda -p leleka-native-cpu-expert --check
|
|
gate debt cargo clippy "${manifest[@]}" -p leleka-cuda-driver --all-targets --all-features --no-deps -- -D warnings
|
|
gate debt cargo clippy "${manifest[@]}" -p leleka-engine-qwen35-cuda --all-targets --no-deps -- -D warnings
|
|
if ((clippy_limits)); then
|
|
echo "== product: Clippy limits ratchet (opt-in, slow; STRA-367)"
|
|
gate "${repo_root}/scripts/check-clippy-limits.sh"
|
|
fi
|
|
if ((${#failed[@]})); then
|
|
echo "== product: ${#failed[@]} step(s) failed:" >&2
|
|
printf ' %s\n' "${failed[@]}" >&2
|
|
return 1
|
|
fi
|
|
echo "== product: all steps passed"
|
|
}
|
|
|
|
if [[ "${mode}" == clippy-limits ]]; then exec "${repo_root}/scripts/check-clippy-limits.sh"; fi
|
|
if [[ "${mode}" == product ]]; then product_path; exit 0; fi
|
|
if ((clippy_limits)); then echo "--clippy-limits runs alone or together with --product" >&2; exit 2; fi
|
|
fast_path
|
|
[[ "${mode}" == fast ]] && exit 0
|
|
linux_typecheck
|
|
port_oracles
|
|
linux_harness
|
|
[[ "${mode}" == port ]] && exit 0
|
|
|
|
python3 -m py_compile "${repo_root}/scripts/calibrate-keyless-routing.py" "${repo_root}/scripts/bench-chat-paired.py" "${repo_root}/scripts/compare-chat-reports.py" "${repo_root}/scripts/bench-chat-sequential-server.py" "${repo_root}/scripts/check-kar-cuda-records.py" "${repo_root}/scripts/strata-agent-profile.py" "${repo_root}/scripts/strata-dual-256-experiment.py" "${repo_root}/scripts/strata-dual-request-proxy.py" "${repo_root}/scripts/kv-keyless-feasibility.py" "${repo_root}/scripts/kv-keyless-attention.py" "${repo_root}/scripts/bench-expert-reserve.py" "${repo_root}/scripts/ple-cache-reuse.py" "${repo_root}/scripts/split-ple-row-trace.py" "${repo_root}/scripts/bench-kar-ple-device.py" "${repo_root}/scripts/bench-kar-ple-serve.py"
|
|
python3 "${repo_root}/scripts/test-benchmark-harness.py"
|
|
python3 "${repo_root}/scripts/test-native-service.py"
|
|
python3 "${repo_root}/scripts/test-native-api.py"
|
|
python3 "${repo_root}/scripts/test-native-menu.py"
|
|
python3 "${repo_root}/scripts/test-model-switch.py"
|
|
python3 "${repo_root}/scripts/test-cuda-bootstrap.py"
|
|
python3 "${repo_root}/scripts/test-static-cuda-elf.py"
|
|
python3 "${repo_root}/scripts/test-linux-package.py"
|
|
python3 "${repo_root}/scripts/test-runtime-image.py"
|
|
python3 "${repo_root}/scripts/test-ple-config-parity.py"
|
|
python3 "${repo_root}/scripts/test-gitea-release.py"
|
|
|
|
# leleka-cuda-driver and leleka-runtime build only for Linux; on other hosts the type-check above is the check.
|
|
if [[ "${host_os}" == Linux ]]; then
|
|
debt cargo fmt -p leleka-cuda-model -p leleka-cuda-driver -p leleka-engine-qwen35-cuda -p leleka-native-cpu-expert --check
|
|
debt cargo clippy --manifest-path "${repo_root}/Cargo.toml" --locked -p leleka-cuda-driver --all-targets --all-features -- -D warnings
|
|
# the crate does not compile without its `cuda-driver` feature (lib.rs gates only part of the modules); leleka-runtime always enables it
|
|
cargo test --manifest-path "${repo_root}/Cargo.toml" --locked -p leleka-cuda-model -p leleka-cuda-driver --features cuda-driver
|
|
# Stale since leleka-cuda-driver gained path dependencies (leleka-context, -model-format, -experimental-ref): the script builds a
|
|
# synthetic workspace of the crate alone (cargo metadata fails) and also runs `cargo fmt --check` / Clippy `-D warnings` on it, which
|
|
# carry the debt of finding 9. scripts/linux-tests/run.sh --mocks runs the same mock-ELF gates on the real tree.
|
|
debt "${repo_root}/scripts/test-cuda-driver-bootstrap.sh"
|
|
else
|
|
echo "== Linux-only crate tests skipped on ${host_os}"
|
|
fi
|
|
cargo fmt --manifest-path "${repo_root}/control-plane/Cargo.toml" --check
|
|
cargo clippy --manifest-path "${repo_root}/control-plane/Cargo.toml" --locked --all-targets --no-deps -- -D warnings
|
|
cargo test --manifest-path "${repo_root}/control-plane/Cargo.toml" --locked
|
|
replay="$(cargo run --quiet --manifest-path "${repo_root}/control-plane/Cargo.toml" --locked --bin replay-responses -- --sse "${repo_root}/benchmarks/fixtures/responses/structured-tool.json")"
|
|
[[ "${replay}" == *"event: response.completed"* ]]
|