Files
wehub-resource-sync 26382a7ac6
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
JetBrains Plugin / Actionlint (push) Waiting to run
CodeQL / Analyze (actions) (push) Waiting to run
CodeQL / Analyze (rust) (push) Waiting to run
JetBrains Plugin / Validation (push) Waiting to run
JetBrains Plugin / Build (push) Waiting to run
JetBrains Plugin / Test (push) Blocked by required conditions
Security Check / Security Scan (push) Waiting to run
CI / Clippy (push) Failing after 15m13s
CI / Test (ubuntu-latest) (push) Failing after 16m1s
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Build (no embeddings / no ORT) (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / Cookbook (Node) (push) Has been cancelled
CI / Pi Extension (Node) (push) Has been cancelled
CI / Rust SDK (lean-ctx-client) (push) Has been cancelled
CI / Embed SDK (lean-ctx-sdk) (push) Has been cancelled
CI / Python SDK (leanctx) (push) Has been cancelled
CI / Hermes Plugin (Python) (push) Has been cancelled
CI / SDK Conformance Matrix (push) Has been cancelled
CI / Coverage (push) Has been cancelled
CI / cargo-deny (push) Has been cancelled
CI / Adversarial Safety (push) Has been cancelled
CI / Benchmarks (push) Has been cancelled
CI / Output-Quality Gate (eval A/B) (push) Has been cancelled
CI / Documentation (push) Has been cancelled
CI / CI Green (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:35:30 +08:00

76 lines
2.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# SDK conformance matrix runner (GL #395).
#
# Builds the engine (unless LEAN_CTX_BIN points at one), starts a real
# `lean-ctx serve` on an ephemeral port, then runs the conformance kit of all
# three first-party SDKs against it:
#
# * Python clients/python (pytest tests/test_conformance_live.py)
# * TypeScript cookbook/sdk (vitest src/conformance.e2e.test.ts)
# * Rust clients/rust/lean-ctx-client (cargo test --test conformance_live)
#
# Each suite writes its scorecard into $LEANCTX_MATRIX_DIR; afterwards the
# matrix generator renders docs/reference/sdk-conformance-matrix.md.
#
# Usage: scripts/sdk-conformance.sh [--keep-server]
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"
BIN="${LEAN_CTX_BIN:-$ROOT/rust/target/debug/lean-ctx}"
if [[ ! -x "$BIN" ]]; then
echo "==> building engine (debug, all features)"
(cd rust && cargo build --all-features)
fi
[[ -x "$BIN" ]] || { echo "engine binary missing: $BIN"; exit 1; }
PORT="$(python3 -c 'import socket; s=socket.socket(); s.bind(("127.0.0.1",0)); print(s.getsockname()[1]); s.close()')"
URL="http://127.0.0.1:$PORT"
TOKEN="$(python3 -c 'import secrets; print(secrets.token_hex(24))')"
MATRIX_DIR="$(mktemp -d)"
export LEANCTX_CONFORMANCE_URL="$URL"
export LEANCTX_CONFORMANCE_TOKEN="$TOKEN"
export LEANCTX_MATRIX_DIR="$MATRIX_DIR"
echo "==> starting lean-ctx serve on $URL"
"$BIN" serve --host 127.0.0.1 --port "$PORT" --project-root "$ROOT" --auth-token "$TOKEN" &
SERVER_PID=$!
cleanup() {
if [[ "${1:-}" != "--keep-server" ]]; then
kill "$SERVER_PID" 2>/dev/null || true
fi
}
trap cleanup EXIT
for _ in $(seq 1 100); do
if curl -fsS "$URL/health" >/dev/null 2>&1; then break; fi
sleep 0.1
done
curl -fsS "$URL/health" >/dev/null || { echo "server did not become healthy"; exit 1; }
FAIL=0
echo "==> Python SDK conformance"
(cd clients/python && python3 -m pytest tests/test_conformance_live.py -q) || FAIL=1
echo "==> Python adapter smoke (OpenAI/LangChain/LlamaIndex/CrewAI; frameworks optional)"
(cd clients/python && python3 -m pytest tests/test_adapters_live.py -q) || FAIL=1
echo "==> SDK release gate (versions + contract coupling)"
python3 scripts/check-sdk-versions.py || FAIL=1
echo "==> TypeScript SDK conformance"
(cd cookbook && npm install --no-fund --no-audit >/dev/null \
&& cd sdk && npx vitest run src/conformance.e2e.test.ts) || FAIL=1
echo "==> Rust SDK conformance"
(cd clients/rust/lean-ctx-client && cargo test --test conformance_live) || FAIL=1
echo "==> generating matrix"
python3 scripts/gen-sdk-matrix.py "$MATRIX_DIR" \
--engine-version "$("$BIN" --version | head -1)" \
--out docs/reference/sdk-conformance-matrix.md
exit "$FAIL"