ODS V3 Pre-Release: Public testing and refinement ahead of the official V3 launch. Turn your PC, Mac, or Linux box into a private AI server.
Python ai-agentsamdcomfyuidockerllama-cppllmlocal-ain8nnvidiaopen-webuiragself-hostedspeech-to-textstrix-halotext-to-speechworkflow-automation
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
cd "$ROOT_DIR"
command -v jq >/dev/null 2>&1 || {
echo "[FAIL] jq is required"
exit 1
}
echo "[contract] n8n nonstandard-UID home and cookie policy"
bash tests/test-n8n-cookie-policy.sh
echo "[contract] installed preflight model route"
bash tests/test-ods-preflight-llm-route.sh
echo "[contract] backend contract files"
for f in config/backends/amd.json config/backends/nvidia.json config/backends/cpu.json config/backends/apple.json; do
test -f "$f" || { echo "[FAIL] missing $f"; exit 1; }
jq -e '.id and .llm_engine and .service_name and .public_api_port and .public_health_url and .provider_name and .provider_url' "$f" >/dev/null \
|| { echo "[FAIL] invalid backend contract: $f"; exit 1; }
done
echo "[contract] hardware class mapping"
test -f config/hardware-classes.json || { echo "[FAIL] missing config/hardware-classes.json"; exit 1; }
jq -e '.version and (.classes | type=="array" and length>0)' config/hardware-classes.json >/dev/null \
|| { echo "[FAIL] invalid hardware-classes root structure"; exit 1; }
for class_id in strix_unified nvidia_pro apple_silicon cpu_fallback; do
jq -e --arg id "$class_id" '.classes[] | select(.id==$id) | .recommended.backend and .recommended.tier and .recommended.compose_overlays' config/hardware-classes.json >/dev/null \
|| { echo "[FAIL] missing/invalid class: $class_id"; exit 1; }
done
echo "[contract] capability profile schema has hardware_class"
jq -e '.properties.hardware_class and (.required | index("hardware_class"))' config/capability-profile.schema.json >/dev/null \
|| { echo "[FAIL] capability profile schema missing hardware_class"; exit 1; }
echo "[contract] cross-platform installed footprint"
python3 tests/test-install-footprint-contract.py
bash tests/contracts/test-install-footprint-macos.sh
echo "[contract] retired Lemonade-era AMD keys still validate, as deprecated, for one release"
for key in HSA_XNACK AMDGPU_TARGET LLAMA_CPP_REF; do
jq -e --arg key "$key" '.properties[$key].deprecated == true' .env.schema.json >/dev/null \
|| { echo "[FAIL] .env.schema.json must keep the retired AMD key $key as deprecated"; exit 1; }
done
echo "[contract] canonical port contract parity"
test -x tests/contracts/test-port-contracts.sh || { echo "[FAIL] script not executable: tests/contracts/test-port-contracts.sh"; exit 1; }
bash tests/contracts/test-port-contracts.sh
echo "[contract] Windows AMD local compose readiness"
bash tests/contracts/test-windows-amd-local-compose.sh
echo "[contract] Windows restart recreates env-backed containers"
bash tests/test-windows-restart-recreate-env.sh
echo "[contract] host-native llama-server compose overlay readiness"
bash tests/contracts/test-host-native-llm-contracts.sh
bash tests/contracts/test-host-native-llm-cpu-fallback.sh
echo "[contract] bootstrap hot-swap force-recreate"
bash tests/test-bootstrap-upgrade-hotswap-contract.sh
bash tests/contracts/test-windows-lemonade-swap-wait.sh
echo "[contract] bootstrap Docker hot-swap rollback"
bash tests/test-bootstrap-upgrade-docker-rollback.sh
echo "[contract] ODS rename migration guardrails"
grep -qF 'ODS_ALLOW_LEGACY_PARALLEL' get-ods.sh \
|| { echo "[FAIL] get-ods.sh must require an explicit override before parallel pre-ODS installs"; exit 1; }
grep -qF 'ODS_LEGACY_INSTALL_DIR' get-ods.sh \
|| { echo "[FAIL] get-ods.sh must allow an explicit pre-ODS install path"; exit 1; }
grep -qF 'PRE_ODS_INSTALL_DIR="${ODS_LEGACY_INSTALL_DIR:-}"' get-ods.sh \
|| { echo "[FAIL] get-ods.sh must use only the canonical pre-ODS install-dir control"; exit 1; }
grep -qF 'ODS_INSTALL_DIR' get-ods.sh \
|| { echo "[FAIL] get-ods.sh must allow an explicit ODS install dir for isolated parallel testing"; exit 1; }
grep -qF 'ODS_ALLOW_LEGACY_PARALLEL' installers/phases/01-preflight.sh \
|| { echo "[FAIL] Linux installer preflight must gate pre-ODS coexistence"; exit 1; }
grep -qF '_pre_ods_install_dir="${ODS_LEGACY_INSTALL_DIR:-}"' installers/phases/01-preflight.sh \
|| { echo "[FAIL] Linux installer preflight must use only the canonical pre-ODS install-dir control"; exit 1; }
grep -qF '_ods_is_related_install_dir' installers/phases/01-preflight.sh \
|| { echo "[FAIL] Linux installer preflight must auto-detect dormant related installs"; exit 1; }
grep -qF '_ods_related_compose_containers' installers/phases/01-preflight.sh \
|| { echo "[FAIL] Linux installer preflight must auto-detect related Compose projects"; exit 1; }
for _pre_ods_scan_file in get-ods.sh installers/phases/01-preflight.sh; do
grep -qF '\( -type d -o -type l \)' "$_pre_ods_scan_file" \
|| { echo "[FAIL] $_pre_ods_scan_file must include symlinked sibling install directories"; exit 1; }
done
unset _pre_ods_scan_file
grep -qF 'ods/ods-cli text eol=lf' ../.gitattributes \
|| { echo "[FAIL] .gitattributes must force LF checkout for extensionless ods/ods-cli"; exit 1; }
_pre_ods_guard_tmp="$(mktemp -d)"
_pre_ods_guard_harness="$_pre_ods_guard_tmp/bootstrap-guard.sh"
for _pre_ods_helper in _ods_is_install_backup_dir _ods_is_related_install_dir _ods_related_compose_containers; do
sed -n "/^${_pre_ods_helper}() {/,/^}/p" get-ods.sh \
> "$_pre_ods_guard_tmp/bootstrap-${_pre_ods_helper}.sh"
sed -n "/^${_pre_ods_helper}() {/,/^}/p" installers/phases/01-preflight.sh \
> "$_pre_ods_guard_tmp/preflight-${_pre_ods_helper}.sh"
cmp -s \
"$_pre_ods_guard_tmp/bootstrap-${_pre_ods_helper}.sh" \
"$_pre_ods_guard_tmp/preflight-${_pre_ods_helper}.sh" \
|| { echo "[FAIL] Bootstrap and Linux preflight must share ${_pre_ods_helper} behavior"; rm -rf "$_pre_ods_guard_tmp"; exit 1; }
done
unset _pre_ods_helper
{
printf '%s\n' '#!/usr/bin/env bash' 'set -euo pipefail'
printf '%s\n' 'warn() { printf "[warn] %s\n" "$*"; }'
sed -n '/^is_truthy() {/,/^# ── Banner/p' get-ods.sh | sed '$d'
cat <<'HARNESS_DOCKER'
docker() {
if [[ -n "${ODS_TEST_DOCKER_ROWS_FILE:-}" && -f "$ODS_TEST_DOCKER_ROWS_FILE" ]]; then
cat "$ODS_TEST_DOCKER_ROWS_FILE"
fi
}
HARNESS_DOCKER
printf '%s\n' 'refuse_legacy_install'
} > "$_pre_ods_guard_harness"
chmod +x "$_pre_ods_guard_harness"
mkdir -p "$_pre_ods_guard_tmp/home/unrelated"
touch "$_pre_ods_guard_tmp/home/unrelated/.env"
if ! PRE_ODS_INSTALL_DIR="" ODS_ALLOW_LEGACY_PARALLEL="" \
ODS_BOOTSTRAP_ROOT="$_pre_ods_guard_tmp/home" \
INSTALL_DIR="$_pre_ods_guard_tmp/new-install" \
bash "$_pre_ods_guard_harness" >/dev/null 2>&1; then
echo "[FAIL] bootstrap guard must ignore directories without the full stack signature"
rm -rf "$_pre_ods_guard_tmp"
exit 1
fi
mkdir -p "$_pre_ods_guard_tmp/older-install"
touch "$_pre_ods_guard_tmp/older-install/.env"
if PRE_ODS_INSTALL_DIR="$_pre_ods_guard_tmp/older-install" \
ODS_ALLOW_LEGACY_PARALLEL="" \
ODS_BOOTSTRAP_ROOT="$_pre_ods_guard_tmp/home" \
INSTALL_DIR="$_pre_ods_guard_tmp/new-install" \
bash "$_pre_ods_guard_harness" >"$_pre_ods_guard_tmp/blocked.log" 2>&1; then
echo "[FAIL] bootstrap guard must reject a configured older install path"
rm -rf "$_pre_ods_guard_tmp"
exit 1
fi
grep -qF 'Existing related install detected' "$_pre_ods_guard_tmp/blocked.log" \
|| { echo "[FAIL] bootstrap guard rejection must explain the detected older install"; rm -rf "$_pre_ods_guard_tmp"; exit 1; }
if ! PRE_ODS_INSTALL_DIR="$_pre_ods_guard_tmp/older-install" \
ODS_ALLOW_LEGACY_PARALLEL=1 \
ODS_BOOTSTRAP_ROOT="$_pre_ods_guard_tmp/home" \
INSTALL_DIR="$_pre_ods_guard_tmp/new-install" \
bash "$_pre_ods_guard_harness" >/dev/null 2>&1; then
echo "[FAIL] bootstrap guard must honor the explicit parallel-install override"
rm -rf "$_pre_ods_guard_tmp"
exit 1
fi
mkdir -p "$_pre_ods_guard_tmp/home/related/data"
touch "$_pre_ods_guard_tmp/home/related/.env"
cat > "$_pre_ods_guard_tmp/home/related/docker-compose.base.yml" <<'COMPOSE'
services:
llama-server:
open-webui:
dashboard-api:
COMPOSE
if PRE_ODS_INSTALL_DIR="" ODS_ALLOW_LEGACY_PARALLEL="" \
ODS_BOOTSTRAP_ROOT="$_pre_ods_guard_tmp/home" \
INSTALL_DIR="$_pre_ods_guard_tmp/new-install" \
bash "$_pre_ods_guard_harness" >"$_pre_ods_guard_tmp/auto-path.log" 2>&1; then
echo "[FAIL] bootstrap guard must auto-detect a dormant related install"
rm -rf "$_pre_ods_guard_tmp"
exit 1
fi
grep -qF 'related install directory' "$_pre_ods_guard_tmp/auto-path.log" \
|| { echo "[FAIL] dormant related-install rejection must identify the directory"; rm -rf "$_pre_ods_guard_tmp"; exit 1; }
rm -rf "$_pre_ods_guard_tmp/home/related"
mkdir -p "$_pre_ods_guard_tmp/home/older-stack.backup-20260518-195646/data"
touch "$_pre_ods_guard_tmp/home/older-stack.backup-20260518-195646/.env"
cat > "$_pre_ods_guard_tmp/home/older-stack.backup-20260518-195646/docker-compose.base.yml" <<'COMPOSE'
services:
llama-server:
open-webui:
dashboard-api:
COMPOSE
if ! PRE_ODS_INSTALL_DIR="" ODS_ALLOW_LEGACY_PARALLEL="" \
ODS_BOOTSTRAP_ROOT="$_pre_ods_guard_tmp/home" \
INSTALL_DIR="$_pre_ods_guard_tmp/new-install" \
bash "$_pre_ods_guard_harness" >"$_pre_ods_guard_tmp/backup-path.log" 2>&1; then
cat "$_pre_ods_guard_tmp/backup-path.log"
echo "[FAIL] bootstrap guard must ignore timestamped dormant backup directories"
rm -rf "$_pre_ods_guard_tmp"
exit 1
fi
rm -rf "$_pre_ods_guard_tmp/home/older-stack.backup-20260518-195646"
mkdir -p "$_pre_ods_guard_tmp/relocated/data"
touch "$_pre_ods_guard_tmp/relocated/.env"
cat > "$_pre_ods_guard_tmp/relocated/docker-compose.yml" <<'COMPOSE'
services:
litellm:
open-webui:
dashboard-api:
COMPOSE
ln -s "$_pre_ods_guard_tmp/relocated" "$_pre_ods_guard_tmp/home/related-link"
if PRE_ODS_INSTALL_DIR="" ODS_ALLOW_LEGACY_PARALLEL="" \
ODS_BOOTSTRAP_ROOT="$_pre_ods_guard_tmp/home" \
INSTALL_DIR="$_pre_ods_guard_tmp/new-install" \
bash "$_pre_ods_guard_harness" >"$_pre_ods_guard_tmp/auto-symlink.log" 2>&1; then
echo "[FAIL] bootstrap guard must auto-detect a symlinked related install"
rm -rf "$_pre_ods_guard_tmp"
exit 1
fi
grep -qF 'related install directory' "$_pre_ods_guard_tmp/auto-symlink.log" \
|| { echo "[FAIL] symlinked related-install rejection must identify the directory"; rm -rf "$_pre_ods_guard_tmp"; exit 1; }
rm -rf "$_pre_ods_guard_tmp/home/related-link"
cat > "$_pre_ods_guard_tmp/docker-rows" <<'ROWS'
stack-llm|stack|llama-server
stack-web|stack|open-webui
stack-api|stack|dashboard-api
ROWS
if PRE_ODS_INSTALL_DIR="" ODS_ALLOW_LEGACY_PARALLEL="" \
ODS_BOOTSTRAP_ROOT="$_pre_ods_guard_tmp/home" \
ODS_TEST_DOCKER_ROWS_FILE="$_pre_ods_guard_tmp/docker-rows" \
INSTALL_DIR="$_pre_ods_guard_tmp/new-install" \
bash "$_pre_ods_guard_harness" >"$_pre_ods_guard_tmp/auto-docker.log" 2>&1; then
echo "[FAIL] bootstrap guard must auto-detect a related Compose project"
rm -rf "$_pre_ods_guard_tmp"
exit 1
fi
grep -qF 'related Compose containers' "$_pre_ods_guard_tmp/auto-docker.log" \
|| { echo "[FAIL] related Compose rejection must identify the containers"; rm -rf "$_pre_ods_guard_tmp"; exit 1; }
cat > "$_pre_ods_guard_tmp/docker-rows" <<'ROWS'
stack-gateway|stack|litellm
stack-web|stack|open-webui
stack-api|stack|dashboard-api
ROWS
if PRE_ODS_INSTALL_DIR="" ODS_ALLOW_LEGACY_PARALLEL="" \
ODS_BOOTSTRAP_ROOT="$_pre_ods_guard_tmp/home" \
ODS_TEST_DOCKER_ROWS_FILE="$_pre_ods_guard_tmp/docker-rows" \
INSTALL_DIR="$_pre_ods_guard_tmp/new-install" \
bash "$_pre_ods_guard_harness" >"$_pre_ods_guard_tmp/auto-gateway.log" 2>&1; then
echo "[FAIL] bootstrap guard must auto-detect a related Compose project using the gateway service"
rm -rf "$_pre_ods_guard_tmp"
exit 1
fi
cat > "$_pre_ods_guard_tmp/docker-rows" <<'ROWS'
other-web|other-a|open-webui
other-api|other-a|dashboard-api
other-llm|other-b|llama-server
ROWS
if ! PRE_ODS_INSTALL_DIR="" ODS_ALLOW_LEGACY_PARALLEL="" \
ODS_BOOTSTRAP_ROOT="$_pre_ods_guard_tmp/home" \
ODS_TEST_DOCKER_ROWS_FILE="$_pre_ods_guard_tmp/docker-rows" \
INSTALL_DIR="$_pre_ods_guard_tmp/new-install" \
bash "$_pre_ods_guard_harness" >/dev/null 2>&1; then
echo "[FAIL] bootstrap guard must require the complete core signature within one Compose project"
rm -rf "$_pre_ods_guard_tmp"
exit 1
fi
rm -rf "$_pre_ods_guard_tmp"
echo "[contract] forced bootstrap reinstall distinguishes owned and foreign Compose stacks"
bash tests/test-bootstrap-force-own-compose.sh
echo "[contract] existing-install start advice works from any directory"
bash tests/test-bootstrap-recovery-guidance.sh
echo "[contract] bootstrap download finalization is non-destructive"
bash tests/test-bootstrap-upgrade-download-finalization.sh
echo "[contract] bootstrap download failures preserve resume state"
bash tests/test-bootstrap-upgrade-resume-status.sh
echo "[contract] bootstrap failed upgrades are start/restart-resumable"
grep -q 'bootstrap-upgrade.args' installers/phases/11-services.sh \
|| { echo "[FAIL] Phase 11 must persist bootstrap-upgrade retry metadata"; exit 1; }
# Read each function whole before matching. Under pipefail, `awk | grep -q`
# fails when grep exits at its match and awk's next buffered write gets
# SIGPIPE: mawk writes 4 KiB at a time, so cmd_start passing 4 KiB tripped it.
cmd_restart_body="$(awk '/cmd_restart\(\)/,/^}/' ods-cli)"
cmd_start_body="$(awk '/cmd_start\(\)/,/^}/' ods-cli)"
grep -q '_ods_cli_maybe_resume_bootstrap_upgrade' <<< "$cmd_restart_body" \
|| { echo "[FAIL] ods restart must retry failed bootstrap upgrades"; exit 1; }
grep -q '_ods_cli_maybe_resume_bootstrap_upgrade' <<< "$cmd_start_body" \
|| { echo "[FAIL] ods start must retry failed bootstrap upgrades"; exit 1; }
grep -q '_ods_cli_wait_for_bootstrap_compose_safe' <<< "$cmd_restart_body" \
|| { echo "[FAIL] ods restart must wait for active bootstrap hot-swaps before compose"; exit 1; }
grep -q '_ods_cli_reload_model_env' <<< "$cmd_restart_body" \
|| { echo "[FAIL] ods restart must reload model env after bootstrap hot-swap wait"; exit 1; }
grep -q '_ods_cli_wait_for_bootstrap_compose_safe' <<< "$cmd_start_body" \
|| { echo "[FAIL] ods start must wait for active bootstrap hot-swaps before compose"; exit 1; }
grep -q '_ods_cli_reload_model_env' <<< "$cmd_start_body" \
|| { echo "[FAIL] ods start must reload model env after bootstrap hot-swap wait"; exit 1; }
grep -q '_macos_persist_bootstrap_upgrade_args' installers/macos/install-macos.sh \
|| { echo "[FAIL] macOS installer must persist bootstrap-upgrade retry metadata"; exit 1; }
grep -q '"$BOOTSTRAP_GGUF_FILE"' installers/macos/install-macos.sh \
|| { echo "[FAIL] macOS installer must pass the bootstrap GGUF into bootstrap-upgrade"; exit 1; }
grep -q '\$script:BOOTSTRAP_GGUF_FILE' installers/windows/install-windows.ps1 \
|| { echo "[FAIL] Windows installer must pass the bootstrap GGUF into bootstrap-upgrade"; exit 1; }
awk '/cmd_restart\(\)/,/^}/' installers/macos/ods-macos.sh | grep -q 'macos_maybe_resume_bootstrap_upgrade' \
|| { echo "[FAIL] macOS ods restart must retry failed bootstrap upgrades"; exit 1; }
awk '/cmd_start\(\)/,/^}/' installers/macos/ods-macos.sh | grep -q 'macos_maybe_resume_bootstrap_upgrade' \
|| { echo "[FAIL] macOS ods start must retry failed bootstrap upgrades"; exit 1; }
awk '/cmd_restart\(\)/,/^}/' installers/macos/ods-macos.sh | grep -q 'macos_wait_for_bootstrap_compose_safe' \
|| { echo "[FAIL] macOS ods restart must wait for active bootstrap hot-swaps"; exit 1; }
awk '/cmd_start\(\)/,/^}/' installers/macos/ods-macos.sh | grep -q 'macos_wait_for_bootstrap_compose_safe' \
|| { echo "[FAIL] macOS ods start must wait for active bootstrap hot-swaps"; exit 1; }
awk '/cmd_update\(\)/,/^}/' installers/macos/ods-macos.sh | grep -q 'macos_maybe_resume_bootstrap_upgrade' \
|| { echo "[FAIL] macOS ods update must retry failed bootstrap upgrades after compose is back"; exit 1; }
grep -q 'starting|verifying|swapping' ods-cli \
|| { echo "[FAIL] ods-cli bootstrap compose guard must include swapping"; exit 1; }
echo "[contract] macOS host-agent LaunchAgent install-dir"
bash tests/test-macos-host-agent-verification.sh
echo "[contract] macOS CLI reports Compose start failures"
bash tests/test-macos-cli-compose-failure.sh
echo "[contract] macOS Core omits optional Open WebUI"
bash tests/test-macos-webui-optional.sh
python3 tests/test_macos_webui_optional_contract.py
echo "[contract] macOS .env upsert preserves secrets and recovers from write failure"
bash tests/test-macos-env-upsert.sh
echo "[contract] macOS direct binds replace conflicting Colima bridges"
bash tests/test-macos-direct-bind-bridge.sh
python3 tests/test_macos_native_service.py
python3 extensions/services/pixel-agent/tests/test_unix_peer.py
bash tests/test-macos-native-llama-launch-cwd.sh
python3 tests/test_macos_runtime_download.py
echo "[contract] macOS CLI preserves cloud/local model routing"
bash tests/test-macos-cli-mode-routing.sh
echo "[contract] macOS cloud resolver preserves selected extension state"
bash tests/test-macos-cloud-resolver.sh
echo "[contract] macOS installer preserves authenticated local/cloud transitions"
bash tests/test-macos-installer-transitions.sh
echo "[contract] macOS Compose pre-pull reuses matching platform caches"
bash tests/test-macos-compose-image-cache.sh
echo "[contract] macOS private networking preserves the active Colima profile"
bash tests/test-macos-colima-profile.sh
echo "[contract] macOS port conflicts include root-hidden listeners"
bash tests/test-macos-port-detection.sh
echo "[contract] AMD reassign sets an HSA override only for ROCm on a target the image lacks"
grep -qF 'ods_amd_hsa_override_for_target "${AMD_INFERENCE_BACKEND:-vulkan}" "$gfx_ver"' ods-cli \
|| { echo "[FAIL] ods-cli must derive the HSA override from installers/lib/amd-runtime.sh"; exit 1; }
grep -q '_env_unset "HSA_OVERRIDE_GFX_VERSION"' ods-cli \
|| { echo "[FAIL] ods-cli must remove the HSA override when none applies"; exit 1; }
if grep -q '_env_set "HSA_OVERRIDE_GFX_VERSION" "\$gfx_ver"' ods-cli; then
echo "[FAIL] ods-cli must not write raw gfx ids such as gfx942 to HSA_OVERRIDE_GFX_VERSION"
exit 1
fi
hsa_cases="$(
source installers/lib/amd-runtime.sh
printf '%s|' "$(ods_amd_hsa_override_for_target vulkan gfx1031)" \
"$(ods_amd_hsa_override_for_target rocm gfx1151)" \
"$(ods_amd_hsa_override_for_target rocm gfx1100)" \
"$(ods_amd_hsa_override_for_target rocm gfx1031)" \
"$(ods_amd_hsa_override_for_target rocm gfx1103)"
)"
[[ "$hsa_cases" == "|||10.3.0|11.0.0|" ]] \
|| { echo "[FAIL] HSA override must be ROCm-only and only for targets the image lacks, got: $hsa_cases"; exit 1; }
echo "[contract] AMD ComfyUI uses native gfx architecture"
bash tests/contracts/test-amd-comfyui-architecture.sh
echo "[contract] dashboard diagnostics route through docker network URLs"
if command -v docker >/dev/null 2>&1 && docker compose version >/dev/null 2>&1; then
tmp_env="$(mktemp)"
trap 'rm -f "$tmp_env"' EXIT
cat > "$tmp_env" <<'ENV_EOF'
WEBUI_SECRET=ci-placeholder
LLM_API_URL=http://litellm:4000
ENV_EOF
rendered="$(docker compose --env-file "$tmp_env" -f docker-compose.base.yml config dashboard-api)"
grep -q 'LLM_URL: http://litellm:4000' <<<"$rendered" \
|| { echo "[FAIL] dashboard-api diagnostics LLM_URL must follow LLM_API_URL when LLM_URL is unset"; exit 1; }
grep -q 'OLLAMA_URL: http://litellm:4000' <<<"$rendered" \
|| { echo "[FAIL] dashboard-api OLLAMA_URL lost LLM_API_URL routing"; exit 1; }
grep -q 'TTS_URL: http://tts:8880' <<<"$rendered" \
|| { echo "[FAIL] dashboard-api diagnostics TTS_URL must use docker network hostname"; exit 1; }
grep -q 'EMBEDDING_URL: http://embeddings:80' <<<"$rendered" \
|| { echo "[FAIL] dashboard-api diagnostics EMBEDDING_URL must use docker network hostname"; exit 1; }
grep -q 'WHISPER_URL: http://whisper:8000' <<<"$rendered" \
|| { echo "[FAIL] dashboard-api diagnostics WHISPER_URL must use docker network hostname"; exit 1; }
else
echo "[SKIP] docker compose unavailable"
fi
echo "[contract] dashboard nginx re-resolves dashboard-api after lifecycle churn"
dashboard_nginx="extensions/services/dashboard/nginx.conf"
grep -qF 'resolver 127.0.0.11' "$dashboard_nginx" \
|| { echo "[FAIL] dashboard nginx must use Docker DNS resolver"; exit 1; }
grep -qF 'set $dashboard_api_upstream dashboard-api:3002;' "$dashboard_nginx" \
|| { echo "[FAIL] dashboard nginx must proxy through a variable upstream"; exit 1; }
grep -qF 'proxy_pass http://$dashboard_api_upstream;' "$dashboard_nginx" \
|| { echo "[FAIL] dashboard nginx /api locations must use the dynamic upstream"; exit 1; }
if grep -qF 'proxy_pass http://dashboard-api:3002;' "$dashboard_nginx"; then
echo "[FAIL] dashboard nginx must not pin dashboard-api at config-load time"
exit 1
fi
grep -A16 -F 'location ~ ^/api/models/.+/load$ {' "$dashboard_nginx" | grep -qF 'proxy_read_timeout 2700s;' \
|| { echo "[FAIL] dashboard nginx model activation route must cover the host-agent activation budget"; exit 1; }
echo "[contract] bundled service CPU limits are env-driven"
grep -qF "cpus: '\${TTS_CPU_LIMIT:-1.0}'" extensions/services/tts/compose.yaml \
|| { echo "[FAIL] Kokoro TTS CPU limit must be env-driven with safe fallback"; exit 1; }
grep -qF 'UVICORN_WORKERS=${TTS_WORKERS:-1}' extensions/services/tts/compose.yaml \
|| { echo "[FAIL] Kokoro TTS must default to one worker and allow an override"; exit 1; }
for runtime_key in OMP_NUM_THREADS MKL_NUM_THREADS; do
grep -qF "${runtime_key}=\${TTS_THREADS:-1}" extensions/services/tts/compose.yaml \
|| { echo "[FAIL] Kokoro TTS must bound ${runtime_key} through TTS_THREADS"; exit 1; }
done
jq -e '.properties.TTS_WORKERS.type == "integer" and .properties.TTS_WORKERS.minimum == 1' .env.schema.json >/dev/null \
|| { echo "[FAIL] TTS_WORKERS must be a positive integer in the env schema"; exit 1; }
jq -e '.properties.TTS_THREADS.type == "integer" and .properties.TTS_THREADS.minimum == 1' .env.schema.json >/dev/null \
|| { echo "[FAIL] TTS_THREADS must be a positive integer in the env schema"; exit 1; }
grep -qF 'TTS_WORKERS=1' installers/macos/lib/env-generator.sh \
|| { echo "[FAIL] macOS installs must conserve VM memory with one TTS worker"; exit 1; }
grep -qF 'upsert_env_value "$env_path" "TTS_WORKERS" "$tts_workers"' installers/macos/lib/env-generator.sh \
|| { echo "[FAIL] macOS reinstalls must preserve an explicit TTS worker override"; exit 1; }
grep -qF "cpus: '\${WHISPER_CPU_LIMIT:-1.0}'" extensions/services/whisper/compose.yaml \
|| { echo "[FAIL] Whisper CPU limit must be env-driven with safe fallback"; exit 1; }
grep -qF "cpus: '\${WHISPER_CPU_LIMIT:-1.0}'" extensions/services/whisper/compose.nvidia.yaml \
|| { echo "[FAIL] Whisper NVIDIA CPU limit must be env-driven with safe fallback"; exit 1; }
grep -qF "cpus: '\${HERMES_CPU_LIMIT:-1.0}'" extensions/services/hermes/compose.yaml \
|| { echo "[FAIL] Hermes CPU limit must be env-driven with safe fallback"; exit 1; }
grep -qF "cpus: '\${COMFYUI_CPU_LIMIT:-1.0}'" extensions/services/comfyui/compose.nvidia.yaml \
|| { echo "[FAIL] ComfyUI NVIDIA CPU limit must be env-driven with safe fallback"; exit 1; }
grep -qF "cpus: '\${COMFYUI_CPU_LIMIT:-1.0}'" extensions/services/comfyui/compose.amd.yaml \
|| { echo "[FAIL] ComfyUI AMD CPU limit must be env-driven with safe fallback"; exit 1; }
for key in TTS_CPU_LIMIT TTS_CPU_RESERVATION WHISPER_CPU_LIMIT WHISPER_CPU_RESERVATION HERMES_CPU_LIMIT HERMES_CPU_RESERVATION COMFYUI_CPU_LIMIT COMFYUI_CPU_RESERVATION; do
jq -e --arg key "$key" '.properties[$key]' .env.schema.json >/dev/null \
|| { echo "[FAIL] .env.schema.json missing bundled service CPU key: $key"; exit 1; }
done
echo "[contract] resolver scripts executable"
for s in scripts/build-capability-profile.sh scripts/classify-hardware.sh scripts/load-backend-contract.sh scripts/resolve-compose-stack.sh scripts/preflight-engine.sh scripts/ods-doctor.sh scripts/simulate-installers.sh; do
test -x "$s" || { echo "[FAIL] script not executable: $s"; exit 1; }
done
echo "[contract] Langfuse telemetry suppression"
grep -q 'TELEMETRY_ENABLED.*false' extensions/services/langfuse/compose.yaml.disabled 2>/dev/null || \
grep -q 'TELEMETRY_ENABLED.*false' extensions/services/langfuse/compose.yaml 2>/dev/null || \
{ echo "[FAIL] Langfuse app telemetry not disabled"; exit 1; }
grep -q 'NEXT_TELEMETRY_DISABLED.*1' extensions/services/langfuse/compose.yaml.disabled 2>/dev/null || \
grep -q 'NEXT_TELEMETRY_DISABLED.*1' extensions/services/langfuse/compose.yaml 2>/dev/null || \
{ echo "[FAIL] Next.js telemetry not disabled"; exit 1; }
grep -q 'MINIO_TELEMETRY_DISABLED.*1' extensions/services/langfuse/compose.yaml.disabled 2>/dev/null || \
grep -q 'MINIO_TELEMETRY_DISABLED.*1' extensions/services/langfuse/compose.yaml 2>/dev/null || \
{ echo "[FAIL] MinIO telemetry not disabled"; exit 1; }
echo "[contract] RAG service flags gate qdrant and embeddings"
# RAG = qdrant (vector store) + embeddings (TEI). Both default from
# ENABLE_RAG, then host-specific guards can disable the concrete service
# when an upstream image cannot run on that machine.
features_phase="ods/installers/phases/03-features.sh"
test -f "$features_phase" || features_phase="installers/phases/03-features.sh"
test -f "$features_phase" || { echo "[FAIL] cannot locate 03-features.sh"; exit 1; }
grep -q 'ENABLE_QDRANT="${ENABLE_QDRANT:-${ENABLE_RAG:-false}}"' "$features_phase" \
|| { echo "[FAIL] ENABLE_QDRANT does not default from ENABLE_RAG in $features_phase"; exit 1; }
grep -q 'ENABLE_EMBEDDINGS="${ENABLE_EMBEDDINGS:-${ENABLE_RAG:-false}}"' "$features_phase" \
|| { echo "[FAIL] ENABLE_EMBEDDINGS does not default from ENABLE_RAG in $features_phase"; exit 1; }
grep -qE '_sync_extension_compose +"\$\{ENABLE_QDRANT:-\$\{ENABLE_RAG:-false\}\}" +qdrant\b' "$features_phase" \
|| { echo "[FAIL] Qdrant compose is not gated by ENABLE_QDRANT in $features_phase"; exit 1; }
grep -qE '_sync_extension_compose +"\$\{ENABLE_EMBEDDINGS:-\$\{ENABLE_RAG:-false\}\}" +embeddings\b' "$features_phase" \
|| { echo "[FAIL] Embeddings compose is not gated by ENABLE_EMBEDDINGS in $features_phase"; exit 1; }
grep -q 'HOST_PAGE_SIZE:-$(getconf PAGE_SIZE' "$features_phase" \
|| { echo "[FAIL] Qdrant arm64 page-size guard missing from $features_phase"; exit 1; }
for f in installers/phases/04-requirements.sh installers/phases/08-images.sh installers/phases/12-health.sh installers/phases/13-summary.sh; do
test -f "$f" || { echo "[FAIL] missing installer phase: $f"; exit 1; }
grep -q 'ENABLE_QDRANT:-${ENABLE_RAG:-false}' "$f" \
|| { echo "[FAIL] $f still gates Qdrant on ENABLE_RAG directly"; exit 1; }
done
run_phase03_rag_guard() {
local arch="$1" page_size="$2" tmpdir
tmpdir="$(mktemp -d)"
mkdir -p "$tmpdir/extensions/services/qdrant" "$tmpdir/extensions/services/embeddings"
printf 'services: {}\n' >"$tmpdir/extensions/services/qdrant/compose.yaml"
printf 'services: {}\n' >"$tmpdir/extensions/services/embeddings/compose.yaml"
(
set -euo pipefail
INTERACTIVE=false
DRY_RUN=false
INSTALL_CHOICE=1
TIER=1
ODS_MODE=local
ENABLE_PIXEL=false
ENABLE_RAG=true
ENABLE_HERMES=false
ENABLE_COMFYUI=false
ENABLE_WORKFLOWS=false
ENABLE_VOICE=false
GPU_COUNT=1
GPU_BACKEND=cpu
HOST_ARCH="$arch"
HOST_PAGE_SIZE="$page_size"
SCRIPT_DIR="$tmpdir"
INSTALL_DIR="$tmpdir/install"
MAX_CONTEXT=4096
LLM_MODEL_SIZE_MB=0
ods_progress() { :; }
ai_warn() { :; }
log() { :; }
warn() { :; }
success() { :; }
chapter() { :; }
bootline() { :; }
signal() { :; }
show_phase() { :; }
show_install_menu() { :; }
# Phase 03 asks this library whether Portal replaces Open WebUI as chat;
# install-core sources it before the phase.
# shellcheck source=/dev/null
source "${features_phase%/phases/03-features.sh}/lib/installed-feature-state.sh"
# shellcheck source=/dev/null
source "$features_phase" >/dev/null
printf 'ENABLE_QDRANT=%s\n' "${ENABLE_QDRANT:-}"
printf 'ENABLE_EMBEDDINGS=%s\n' "${ENABLE_EMBEDDINGS:-}"
if [[ -f "$tmpdir/extensions/services/qdrant/compose.yaml" ]]; then
printf 'QDRANT_COMPOSE=enabled\n'
elif [[ -f "$tmpdir/extensions/services/qdrant/compose.yaml.disabled" ]]; then
printf 'QDRANT_COMPOSE=disabled\n'
else
printf 'QDRANT_COMPOSE=missing\n'
fi
if [[ -f "$tmpdir/extensions/services/embeddings/compose.yaml" ]]; then
printf 'EMBEDDINGS_COMPOSE=enabled\n'
elif [[ -f "$tmpdir/extensions/services/embeddings/compose.yaml.disabled" ]]; then
printf 'EMBEDDINGS_COMPOSE=disabled\n'
else
printf 'EMBEDDINGS_COMPOSE=missing\n'
fi
)
rm -rf "$tmpdir"
}
guard_64k="$(run_phase03_rag_guard aarch64 65536)"
echo "$guard_64k" | grep -q '^ENABLE_QDRANT=false$' \
|| { echo "[FAIL] 64K-page aarch64 must disable ENABLE_QDRANT"; echo "$guard_64k"; exit 1; }
echo "$guard_64k" | grep -q '^QDRANT_COMPOSE=disabled$' \
|| { echo "[FAIL] 64K-page aarch64 must disable Qdrant compose"; echo "$guard_64k"; exit 1; }
guard_4k="$(run_phase03_rag_guard aarch64 4096)"
echo "$guard_4k" | grep -q '^ENABLE_QDRANT=true$' \
|| { echo "[FAIL] 4K-page aarch64 must keep ENABLE_QDRANT enabled"; echo "$guard_4k"; exit 1; }
echo "$guard_4k" | grep -q '^QDRANT_COMPOSE=enabled$' \
|| { echo "[FAIL] 4K-page aarch64 must keep Qdrant compose enabled"; echo "$guard_4k"; exit 1; }
# TEI runs on arm64 from compose.arm64.yaml, with 4K and 64K pages alike.
for guard in "$guard_4k" "$guard_64k"; do
echo "$guard" | grep -q '^ENABLE_EMBEDDINGS=true$' \
|| { echo "[FAIL] aarch64 must keep embeddings enabled (arm64 TEI pin)"; echo "$guard"; exit 1; }
echo "$guard" | grep -q '^EMBEDDINGS_COMPOSE=enabled$' \
|| { echo "[FAIL] aarch64 must keep embeddings compose enabled"; echo "$guard"; exit 1; }
done
echo "[contract] non-interactive reinstall reuses valid GPU assignment"
grep -q '_load_existing_gpu_assignment_json' "$features_phase" \
|| { echo "[FAIL] multi-GPU reinstall must load existing GPU assignment"; exit 1; }
grep -q 'GPU_ASSIGNMENT_JSON_B64' "$features_phase" \
|| { echo "[FAIL] multi-GPU reinstall must read persisted GPU_ASSIGNMENT_JSON_B64"; exit 1; }
grep -q 'Reusing existing GPU assignment from .env' "$features_phase" \
|| { echo "[FAIL] multi-GPU reinstall must log assignment reuse"; exit 1; }
echo "[contract] every resolve-compose-stack.sh invocation passes --gpu-count"
# The resolver's --gpu-count flag gates the multigpu-{backend}.yml overlay.
# A caller that omits it silently resolves to a single-GPU stack on multi-GPU
# hardware. 11-services.sh persists its result into .compose-flags, so the
# bug propagates to every subsequent ods-cli invocation.
#
# Strategy: pair each line invoking the resolver with the next 3 lines (to
# catch backslash-continued invocations) and assert that segment contains
# --gpu-count. Existence guards like [[ -x ... ]] are excluded — they don't
# launch the script.
_resolver_callers=(
"ods-cli"
"ods-update.sh"
"bin/ods-host-agent.py"
"scripts/ods-preflight.sh"
"scripts/validate.sh"
"installers/lib/compose-select.sh"
"installers/macos/ods-macos.sh"
"installers/phases/03-features.sh"
"installers/phases/11-services.sh"
)
for f in "${_resolver_callers[@]}"; do
test -f "$f" || { echo "[FAIL] missing resolver caller: $f"; exit 1; }
# Match lines that actually launch the script: $(...resolve-compose-stack.sh...
# or "...resolve-compose-stack.sh" \ or bash ...resolve-compose-stack.sh...
# Skip lines whose 'resolve-compose-stack.sh' is a [[ -x|-f ]] existence test.
while IFS=: read -r lineno line; do
# Skip existence guards ([[ -x ... ]], [[ -f ... ]]) and comments/docstrings.
[[ "$line" =~ \[\[[[:space:]]+-[xfre][[:space:]] ]] && continue
[[ "$line" =~ ^[[:space:]]*\# ]] && continue
[[ "$line" =~ ^[[:space:]]*(\"|\') ]] && continue
end=$((lineno + 8))
segment=$(sed -n "${lineno},${end}p" "$f")
if ! grep -q -- "--gpu-count" <<<"$segment"; then
echo "[FAIL] $f:$lineno invokes resolver without --gpu-count nearby"
exit 1
fi
done < <(grep -nE 'resolve-compose-stack\.sh' "$f" || true)
done
unset _resolver_callers
echo "[contract] dry-run does not install a missing jq prerequisite"
bash tests/test-installer-dry-run-jq.sh
echo "[contract] optional extension compose files are installer-gated"
bash tests/test-installer-feature-state-sync.sh
# Bundled optional/recommended services that ship compose.yaml must not enter
# a Core Only install just because their compose file exists in the source tree.
for spec in \
'ENABLE_SEARXNG:searxng' \
'ENABLE_RECOMMENDED:token-spy' \
'ENABLE_HERMES:hermes' \
'ENABLE_HERMES:hermes-proxy' \
'ENABLE_APE:ape' \
'ENABLE_PERPLEXICA:perplexica' \
'ENABLE_PRIVACY_SHIELD:privacy-shield' \
'ENABLE_ODS_PROXY:ods-proxy' \
'ENABLE_TAILSCALE:tailscale' \
'ENABLE_BRAVE_SEARCH:brave-search'
do
flag="${spec%%:*}"
svc="${spec##*:}"
grep -qE "_sync_extension_compose +\"\\\$\\{${flag}:-[^}]*\\}\" +$svc\\b|_sync_extension_compose +\"\\\$\\{${flag}:-\\}\" +$svc\\b" "$features_phase" \
|| { echo "[FAIL] $svc compose is not gated by $flag in $features_phase"; exit 1; }
done
# Pixel is installed as the default agent independently of the Recommended
# preset, but it requires LiteLLM. Search is shared with other consumers below.
# An install with neither Pixel nor Recommended services excludes LiteLLM.
grep -Fq '_pixel_support_services="${ENABLE_RECOMMENDED:-false}"' "$features_phase" \
|| { echo "[FAIL] Pixel support gate must inherit ENABLE_RECOMMENDED"; exit 1; }
grep -Fq '[[ "${ENABLE_PIXEL_RUNTIME:-false}" == "true" ]] && _pixel_support_services=true' "$features_phase" \
|| { echo "[FAIL] Pixel support gate must include ENABLE_PIXEL_RUNTIME"; exit 1; }
for svc in litellm; do
grep -qE "_sync_extension_compose +\"\\\$_pixel_support_services\" +$svc\\b" "$features_phase" \
|| { echo "[FAIL] $svc compose is not gated by Pixel or Recommended services in $features_phase"; exit 1; }
done
echo "[contract] SearXNG follows web search consumers, not only --recommended"
bash tests/test-pixel-support-services.sh
bash tests/test-pixel-search-provider-resolution.sh
bash tests/test-pixel-model-relay-compose.sh
grep -qE 'ENABLE_RECOMMENDED:-false' "$features_phase" \
|| { echo "[FAIL] ENABLE_SEARXNG derivation must consult ENABLE_RECOMMENDED"; exit 1; }
grep -Fq '"$PIXEL_RESOLVED_WEB_SEARCH_PROVIDER" == "searxng"' "$features_phase" \
|| { echo "[FAIL] ENABLE_SEARXNG derivation must consult Pixel's selected provider"; exit 1; }
grep -qE 'ENABLE_PERPLEXICA:-false' "$features_phase" \
|| { echo "[FAIL] ENABLE_SEARXNG derivation must consult ENABLE_PERPLEXICA"; exit 1; }
grep -qE 'ENABLE_HERMES:-false' "$features_phase" \
|| { echo "[FAIL] ENABLE_SEARXNG derivation must consult ENABLE_HERMES"; exit 1; }
if grep -q 'ENABLE_OPENCLAW' "$features_phase"; then
echo "[FAIL] feature selection must not consult the removed legacy OpenClaw flag"
exit 1
fi
grep -Fq 'ENABLE_WEB_SEARCH="$ENABLE_SEARXNG"' "$features_phase" \
|| { echo "[FAIL] ENABLE_WEB_SEARCH must track ENABLE_SEARXNG"; exit 1; }
grep -Fq 'ENABLE_WEB_SEARCH: "${ENABLE_WEB_SEARCH:-false}"' docker-compose.base.yml \
|| { echo "[FAIL] docker-compose.base.yml must interpolate ENABLE_WEB_SEARCH"; exit 1; }
if grep -qE 'ENABLE_WEB_SEARCH: "true"' docker-compose.base.yml; then
echo "[FAIL] docker-compose.base.yml must not hardcode ENABLE_WEB_SEARCH=true"
exit 1
fi
grep -Fq 'ENABLE_WEB_SEARCH=${ENABLE_WEB_SEARCH:-true}' installers/phases/06-directories.sh \
|| { echo "[FAIL] Linux .env generator must interpolate ENABLE_WEB_SEARCH"; exit 1; }
grep -Fq '_macos_set_builtin_compose_state searxng "$ENABLE_SEARXNG"' installers/macos/install-macos.sh \
|| { echo "[FAIL] macOS installer must gate SearXNG with ENABLE_SEARXNG"; exit 1; }
grep -Fq 'ENABLE_WEB_SEARCH=${ENABLE_WEB_SEARCH:-true}' installers/macos/lib/env-generator.sh \
|| { echo "[FAIL] macOS .env generator must interpolate ENABLE_WEB_SEARCH"; exit 1; }
windows_plan="installers/windows/lib/service-plan.ps1"
test -f "$windows_plan" || { echo "[FAIL] missing $windows_plan"; exit 1; }
for svc in litellm searxng token-spy hermes hermes-proxy ape pixel-edge perplexica privacy-shield ods-proxy tailscale brave-search; do
grep -q "\"$svc\"" "$windows_plan" \
|| { echo "[FAIL] Windows service plan missing '$svc'"; exit 1; }
done
echo "[contract] Linux local rebuilds respect selected compose services"
grep -q 'config --services' installers/phases/11-services.sh \
|| { echo "[FAIL] Linux installer must inspect selected compose services before local rebuilds"; exit 1; }
grep -q 'Skipping local image build for disabled service' installers/phases/11-services.sh \
|| { echo "[FAIL] Linux installer must skip disabled local-build services"; exit 1; }
if grep -q '^[[:space:]]*_build_services=(dashboard dashboard-api ape token-spy privacy-shield)' installers/phases/11-services.sh; then
echo "[FAIL] Linux installer must not build every local service unconditionally"
exit 1
fi
echo "[contract] Windows local rebuilds respect selected compose services"
grep -q 'config --services' installers/windows/install-windows.ps1 \
|| { echo "[FAIL] Windows installer must inspect selected compose services before local rebuilds"; exit 1; }
grep -q 'Could not resolve Windows compose services before local image rebuilds' installers/windows/install-windows.ps1 \
|| { echo "[FAIL] Windows installer must fail clearly if compose service resolution fails"; exit 1; }
grep -q 'Skipping local image build for disabled service' installers/windows/install-windows.ps1 \
|| { echo "[FAIL] Windows installer must skip disabled local-build services"; exit 1; }
grep -q '\$_buildServices = \$_selectedBuildServices' installers/windows/install-windows.ps1 \
|| { echo "[FAIL] Windows installer must build only services selected from the resolved compose stack"; exit 1; }
echo "[contract] failed requested local builds cannot reuse stale images"
bash tests/test-phase11-local-build-failure.sh
bash tests/test-phase11-litellm-reload.sh
echo "[contract] legacy OpenClaw removal: flags are no-ops and upgrades prune its service files"
bash tests/test-legacy-openclaw-removal.sh
for installer in install-core.sh installers/macos/install-macos.sh; do
# Upgrades must not re-enable the removed extension from an old container
# or from retained data/openclaw.
if grep -Eq 'ENABLE_OPENCLAW=|ods-openclaw\$' "$installer"; then
echo "[FAIL] $installer must not select the removed legacy OpenClaw extension"
exit 1
fi
done
echo "[contract] Token Spy dashboard ships offline chart assets"
test -f extensions/services/token-spy/dashboard_charts.js || { echo "[FAIL] missing extensions/services/token-spy/dashboard_charts.js"; exit 1; }
grep -q '/dashboard-assets/charts.js' extensions/services/token-spy/main.py || \
{ echo "[FAIL] Token Spy dashboard missing local chart asset reference"; exit 1; }
if grep -q 'cdn.jsdelivr.net/npm/chart.js\|cdn.jsdelivr.net/npm/chartjs-adapter-date-fns' extensions/services/token-spy/main.py; then
echo "[FAIL] Token Spy dashboard still depends on CDN chart assets"
exit 1
fi
echo "[contract] installers pre-mark setup wizard complete"
# All three installers must write data/config/setup-complete.json at install time
# so the dashboard wizard doesn't reappear on every visit after a fresh install.
# dashboard-api reads this file (container path /data/config/setup-complete.json,
# mounted from ${INSTALL_DIR}/data) to decide first_run state.
grep -q 'data/config/setup-complete.json' installers/phases/13-summary.sh \
|| { echo "[FAIL] Linux phase 13 does not write data/config/setup-complete.json"; exit 1; }
grep -q 'data/config/setup-complete.json' installers/macos/install-macos.sh \
|| { echo "[FAIL] macOS installer does not write data/config/setup-complete.json"; exit 1; }
grep -q 'data\\\\config\\\\setup-complete.json\|setup-complete.json' installers/windows/install-windows.ps1 \
|| { echo "[FAIL] Windows installer does not write setup-complete.json"; exit 1; }
echo "[contract] Linux dry run never claims live runtime evidence"
grep -Fq 'Dry-run simulation complete; runtime health was not tested.' installers/phases/12-health.sh \
|| { echo "[FAIL] Linux dry-run health summary is not explicit about untested runtime health"; exit 1; }
grep -Fq 'DRY RUN PLAN COMPLETE — NOTHING WAS INSTALLED' installers/phases/13-summary.sh \
|| { echo "[FAIL] Linux dry-run summary does not state that nothing was installed"; exit 1; }
grep -Fq 'DRY RUN COMPLETE — ODS IS NOT RUNNING' installers/phases/13-summary.sh \
|| { echo "[FAIL] Linux dry-run summary can still imply that ODS is live"; exit 1; }
grep -Fq '[DRY RUN] Live preflight and extension runtime checks were not run.' installers/phases/13-summary.sh \
|| { echo "[FAIL] Linux dry run does not distinguish skipped live checks"; exit 1; }
grep -Fq 'if ! $DRY_RUN && command -v ods_readiness_summary' installers/phases/13-summary.sh \
|| { echo "[FAIL] Linux dry run can still execute the live readiness summary"; exit 1; }
# --- classify-hardware: shared device_id disambiguation ---
echo "[contract] classify-hardware shared device_id"
_classify() {
bash scripts/classify-hardware.sh --device-id "$1" --gpu-name "$2" --gpu-vendor "${3:-amd}" --vram-mb "${4:-0}" --memory-type "${5:-discrete}" 2>/dev/null
}
_classify_id() { _classify "$@" | jq -r '.id'; }
_classify_tier() { _classify "$@" | jq -r '.recommended.tier'; }
_classify_backend() { _classify "$@" | jq -r '.recommended.backend'; }
_classify_bw() { _classify "$@" | jq -r '.bandwidth_gbps'; }
# --- Low-VRAM NVIDIA cards must not be routed to CUDA by default ---
[[ "$(_classify_id "" "NVIDIA GeForce 940MX" nvidia 2048)" == "nvidia_low_vram_cpu_fallback" ]] \
|| { echo "[FAIL] 2GB NVIDIA must match low-VRAM CPU fallback"; exit 1; }
[[ "$(_classify_backend "" "NVIDIA GeForce 940MX" nvidia 2048)" == "cpu" ]] \
|| { echo "[FAIL] 2GB NVIDIA must use CPU backend"; exit 1; }
[[ "$(_classify_tier "" "NVIDIA GeForce 940MX" nvidia 2048)" == "T0" ]] \
|| { echo "[FAIL] 2GB NVIDIA must use T0"; exit 1; }
[[ "$(_classify_id "" "NVIDIA GeForce GTX 1650" nvidia 4096)" == "nvidia_entry" ]] \
|| { echo "[FAIL] 4GB NVIDIA should remain entry CUDA"; exit 1; }
[[ "$(_classify_backend "" "NVIDIA GeForce GTX 1650" nvidia 4096)" == "nvidia" ]] \
|| { echo "[FAIL] 4GB NVIDIA should keep NVIDIA backend"; exit 1; }
# --- 0x744c: XTX / XT / GRE (same die, different SKUs) ---
# Happy path: device_id + name → exact match
[[ "$(_classify_id 0x744c "AMD Radeon RX 7900 XTX" amd 24576)" == "rx_7900_xtx" ]] \
|| { echo "[FAIL] XTX with name"; exit 1; }
[[ "$(_classify_id 0x744c "AMD Radeon RX 7900 XT" amd 20480)" == "rx_7900_xt" ]] \
|| { echo "[FAIL] XT with name"; exit 1; }
[[ "$(_classify_id 0x744c "AMD Radeon RX 7900 GRE" amd 16384)" == "rx_7900_gre" ]] \
|| { echo "[FAIL] GRE with name"; exit 1; }
# Substring safety: "RX 7900 XT" is a substring of "RX 7900 XTX"
# XT name must NOT match XTX entry (longest pattern wins)
[[ "$(_classify_id 0x744c "AMD Radeon RX 7900 XT" amd 20480)" != "rx_7900_xtx" ]] \
|| { echo "[FAIL] XT matched XTX (substring collision)"; exit 1; }
# XTX name must NOT match XT entry
[[ "$(_classify_id 0x744c "AMD Radeon RX 7900 XTX" amd 24576)" != "rx_7900_xt" ]] \
|| { echo "[FAIL] XTX matched XT"; exit 1; }
# Tier correctness: GRE is T2, the others are T3
[[ "$(_classify_tier 0x744c "AMD Radeon RX 7900 XTX" amd 24576)" == "T3" ]] \
|| { echo "[FAIL] XTX tier"; exit 1; }
[[ "$(_classify_tier 0x744c "AMD Radeon RX 7900 GRE" amd 16384)" == "T2" ]] \
|| { echo "[FAIL] GRE tier"; exit 1; }
# Bandwidth correctness: each SKU has a different value
[[ "$(_classify_bw 0x744c "AMD Radeon RX 7900 XTX" amd 24576)" == "960" ]] \
|| { echo "[FAIL] XTX bandwidth"; exit 1; }
[[ "$(_classify_bw 0x744c "AMD Radeon RX 7900 XT" amd 20480)" == "800" ]] \
|| { echo "[FAIL] XT bandwidth"; exit 1; }
[[ "$(_classify_bw 0x744c "AMD Radeon RX 7900 GRE" amd 16384)" == "576" ]] \
|| { echo "[FAIL] GRE bandwidth"; exit 1; }
# Empty name: VRAM tiebreaker picks closest match
[[ "$(_classify_id 0x744c "" amd 24576)" == "rx_7900_xtx" ]] \
|| { echo "[FAIL] empty name + 24GB → XTX"; exit 1; }
[[ "$(_classify_id 0x744c "" amd 20480)" == "rx_7900_xt" ]] \
|| { echo "[FAIL] empty name + 20GB → XT"; exit 1; }
[[ "$(_classify_id 0x744c "" amd 16384)" == "rx_7900_gre" ]] \
|| { echo "[FAIL] empty name + 16GB → GRE"; exit 1; }
# Empty name + zero VRAM: picks smallest card (under-provision is safe,
# over-provision would crash the model loader)
[[ "$(_classify_id 0x744c "" amd 0)" == "rx_7900_gre" ]] \
|| { echo "[FAIL] empty name + 0 VRAM → should be GRE (smallest)"; exit 1; }
# Empty name + close-but-not-exact VRAM: picks nearest
# 22000 MB is closer to XT (20480, diff=1520) than XTX (24576, diff=2576)
[[ "$(_classify_id 0x744c "" amd 22000)" == "rx_7900_xt" ]] \
|| { echo "[FAIL] empty name + 22GB → should be XT (nearest)"; exit 1; }
# 18000 MB is closer to GRE (16384, diff=1616) than XT (20480, diff=2480)
[[ "$(_classify_id 0x744c "" amd 18000)" == "rx_7900_gre" ]] \
|| { echo "[FAIL] empty name + 18GB → should be GRE (nearest)"; exit 1; }
# --- 0x7480: RX 7800 XT / RX 7700 XT (second shared device_id pair) ---
[[ "$(_classify_id 0x7480 "AMD Radeon RX 7800 XT" amd 16384)" == "rx_7800_xt" ]] \
|| { echo "[FAIL] 7800 XT with name"; exit 1; }
[[ "$(_classify_id 0x7480 "AMD Radeon RX 7700 XT" amd 12288)" == "rx_7700_xt" ]] \
|| { echo "[FAIL] 7700 XT with name"; exit 1; }
[[ "$(_classify_id 0x7480 "" amd 16384)" == "rx_7800_xt" ]] \
|| { echo "[FAIL] 0x7480 empty name + 16GB → 7800 XT"; exit 1; }
[[ "$(_classify_id 0x7480 "" amd 12288)" == "rx_7700_xt" ]] \
|| { echo "[FAIL] 0x7480 empty name + 12GB → 7700 XT"; exit 1; }
# --- Name-only match (no device_id) ---
[[ "$(_classify_id "" "RYZEN AI MAX+ 395" amd 0)" == "strix_halo_395" ]] \
|| { echo "[FAIL] Strix Halo name-only match"; exit 1; }
[[ "$(_classify_id "" "RX 9070 XT" amd 16384)" == "rx_9070_xt" ]] \
|| { echo "[FAIL] RX 9070 XT name-only match"; exit 1; }
# --- NVIDIA RTX Spark N1X (Windows on Arm) ---
# Its name also says "Blackwell", which once matched the RTX PRO 6000 entry.
# Name, PCI id and the 98240 MiB split are the owner's probe
# (tests/fixtures/rtx-spark); 63936 MiB is the factory split's figure.
_spark_name="NVIDIA RTX Spark N1X (6144-core Blackwell RTX GPU)"
for _split_mb in 98240 63936; do
[[ "$(_classify_id 0x2E03 "$_spark_name" nvidia "$_split_mb")" == "nvidia_rtx_spark_n1x" ]] \
|| { echo "[FAIL] RTX Spark ($_split_mb MiB) with its device id is not the N1X"; exit 1; }
[[ "$(_classify_id "" "$_spark_name" nvidia "$_split_mb")" == "nvidia_rtx_spark_n1x" ]] \
|| { echo "[FAIL] RTX Spark ($_split_mb MiB) by name alone is not the N1X"; exit 1; }
[[ "$(_classify_tier 0x2E03 "$_spark_name" nvidia "$_split_mb")" == "NV_ULTRA" ]] \
|| { echo "[FAIL] RTX Spark ($_split_mb MiB) tier"; exit 1; }
[[ "$(_classify_backend 0x2E03 "$_spark_name" nvidia "$_split_mb")" == "nvidia" ]] \
|| { echo "[FAIL] RTX Spark ($_split_mb MiB) backend"; exit 1; }
[[ "$(_classify_bw 0x2E03 "$_spark_name" nvidia "$_split_mb")" == "281" ]] \
|| { echo "[FAIL] RTX Spark ($_split_mb MiB) bandwidth must be the N1X's, not the RTX PRO 6000's"; exit 1; }
[[ "$(_classify "" "$_spark_name" nvidia "$_split_mb" | jq -r '.memory_source')" == "vram" ]] \
|| { echo "[FAIL] RTX Spark ($_split_mb MiB) is sized from its GPU memory, not WSL RAM"; exit 1; }
done
[[ "$(_classify_id 0x2e03 "" nvidia 98240)" == "nvidia_rtx_spark_n1x" ]] \
|| { echo "[FAIL] RTX Spark by device id alone"; exit 1; }
# The NVIDIA NPU row (no memory, no device id) is never a GPU class.
[[ "$(_classify_id "" "NVIDIA NPU" nvidia 0)" == "nvidia_low_vram_cpu_fallback" ]] \
|| { echo "[FAIL] the NVIDIA NPU row classified as a GPU"; exit 1; }
# --- RTX PRO 6000 names keep their entry (Workstation is the fleet's card) ---
for _pro_name in \
"NVIDIA RTX PRO 6000 Blackwell Workstation Edition" \
"NVIDIA RTX PRO 6000 Blackwell Max-Q Workstation Edition" \
"NVIDIA RTX PRO 6000 Blackwell Server Edition" \
"NVIDIA RTX PRO 6000"; do
[[ "$(_classify_id "" "$_pro_name" nvidia 97887)" == "rtx_pro_6000_blackwell" ]] \
|| { echo "[FAIL] $_pro_name is no longer the RTX PRO 6000"; exit 1; }
[[ "$(_classify_tier "" "$_pro_name" nvidia 97887)" == "NV_ULTRA" ]] \
|| { echo "[FAIL] $_pro_name tier"; exit 1; }
done
# Other Blackwell cards are sized by their own memory, not as a 96 GB card.
[[ "$(_classify_id "" "NVIDIA RTX PRO 5000 Blackwell" nvidia 49152)" == "nvidia_enterprise" ]] \
|| { echo "[FAIL] RTX PRO 5000 Blackwell must use the VRAM classes"; exit 1; }
[[ "$(_classify_id "" "NVIDIA RTX PRO 4500 Blackwell" nvidia 32768)" == "nvidia_pro" ]] \
|| { echo "[FAIL] RTX PRO 4500 Blackwell must use the VRAM classes"; exit 1; }
[[ "$(_classify_id "" "NVIDIA RTX PRO 4000 Blackwell" nvidia 24576)" == "nvidia_pro" ]] \
|| { echo "[FAIL] RTX PRO 4000 Blackwell must use the VRAM classes"; exit 1; }
# --- DGX Spark (GB10) is unchanged ---
[[ "$(_classify_id "" "NVIDIA GB10" nvidia 122880 unified)" == "nvidia_grace_blackwell_gb10" ]] \
|| { echo "[FAIL] GB10 name-only match"; exit 1; }
[[ "$(_classify_tier "" "NVIDIA GB10" nvidia 122880 unified)" == "NV_ULTRA" ]] \
|| { echo "[FAIL] GB10 tier"; exit 1; }
[[ "$(_classify "" "NVIDIA GB10" nvidia 122880 unified | jq -r '.memory_source')" == "ram" ]] \
|| { echo "[FAIL] GB10 must stay sized from system RAM"; exit 1; }
# --- No match → heuristic fallback (should not crash) ---
result=$(_classify_id "0xFFFF" "Unknown GPU" amd 8192)
[[ -n "$result" && "$result" != "null" ]] \
|| { echo "[FAIL] unknown GPU crashed"; exit 1; }
echo "[contract] macOS compose resolver installs PyYAML into an isolated selected-Python venv"
grep -q '_ensure_macos_pyyaml' installers/macos/install-macos.sh \
|| { echo "[FAIL] macOS installer does not use the PyYAML readiness helper"; exit 1; }
grep -q 'python-cmd.sh' installers/macos/install-macos.sh \
|| { echo "[FAIL] macOS installer does not load the shared Python resolver"; exit 1; }
grep -q '_macos_python_imports_yaml "$pycmd"' installers/macos/install-macos.sh \
|| { echo "[FAIL] macOS installer does not verify PyYAML with the selected Python"; exit 1; }
grep -q '"$pycmd" -m venv "$venv_dir"' installers/macos/install-macos.sh \
|| { echo "[FAIL] macOS installer must create the PyYAML venv with the selected Python"; exit 1; }
grep -q '_set_installer_python_cmd "$venv_python"' installers/macos/install-macos.sh \
|| { echo "[FAIL] macOS installer must route compose resolver to the venv Python"; exit 1; }
if grep -q 'pip install --user .*pyyaml\|pip install .*--user .*pyyaml' installers/macos/install-macos.sh; then
echo "[FAIL] macOS installer must not use pip --user for PyYAML; Homebrew Python rejects it under PEP 668"
exit 1
fi
grep -q 'export ODS_PYTHON_CMD' installers/macos/install-macos.sh \
|| { echo "[FAIL] macOS installer does not export the selected Python for resolver scripts"; exit 1; }
echo "[contract] macOS OpenCode uses discoverable binary path"
grep -q 'type -P opencode' installers/macos/lib/post-pixel-install.sh \
|| { echo "[FAIL] macOS installer must resolve an executable OpenCode file, not a shell function/alias"; exit 1; }
grep -q 'brew --prefix' installers/macos/lib/post-pixel-install.sh \
|| { echo "[FAIL] macOS installer must check the Homebrew prefix for OpenCode"; exit 1; }
grep -q '_opencode_candidate_is_file' installers/macos/lib/post-pixel-install.sh \
|| { echo "[FAIL] macOS installer must validate resolved OpenCode as an absolute executable file"; exit 1; }
grep -q 'ods_install_opencode' installers/macos/lib/post-pixel-install.sh \
|| { echo "[FAIL] macOS installer must install the reviewed OpenCode release"; exit 1; }
grep -q '<string>${OPENCODE_BIN}</string>' installers/macos/lib/post-pixel-install.sh \
|| { echo "[FAIL] macOS OpenCode LaunchAgent must use resolved OPENCODE_BIN"; exit 1; }
grep -q '_compute_launchd_path "$(dirname "$OPENCODE_BIN")"' installers/macos/lib/post-pixel-install.sh \
|| { echo "[FAIL] macOS OpenCode LaunchAgent PATH must include resolved binary directory"; exit 1; }
echo "[contract] macOS local rebuilds respect selected compose services"
grep -q 'config --services' installers/macos/install-macos.sh \
|| { echo "[FAIL] macOS installer must inspect selected compose services before local rebuilds"; exit 1; }
grep -q 'Could not resolve macOS compose services for local image rebuilds' installers/macos/install-macos.sh \
|| { echo "[FAIL] macOS installer must fail clearly if compose service resolution fails"; exit 1; }
grep -q 'Skipping local image rebuild for disabled service' installers/macos/install-macos.sh \
|| { echo "[FAIL] macOS installer must skip disabled local-build services"; exit 1; }
if grep -q '_macos_build_services=(dashboard dashboard-api ape token-spy privacy-shield)' installers/macos/install-macos.sh; then
echo "[FAIL] macOS installer must not rebuild every local service unconditionally"
exit 1
fi
echo "[contract] Hermes context defaults are installer-wide"
bash tests/test-installer-context-parity.sh
bash tests/test-linux-opencode-opt-in.sh
bash tests/test-systemctl-user-env.sh
echo "[contract] Linux installer/background model lifecycle serialization"
bash tests/test-linux-installer-model-lifecycle-lock.sh
echo "[contract] Podman and no-sudo rootless lifecycle"
bash tests/test-podman-rootless-contracts.sh
echo "[contract] Token Spy rootful install ownership"
bash tests/test-token-spy-install-owner.sh
bash tests/test-installer-noninteractive-sudo.sh
echo "[PASS] installer contracts"