Repository Public License
1#!/bin/bash2# ORIX Convert — Scripts/matrix.sh3# Description: Generates docs/compatibility/conversion-matrix.md and matrix.json from the live engine registry, and4# (with --verify) runs the cross-engine end-to-end sweep that writes docs/reports/e2e-matrix.{md,json}.5# Author: Simon-Pierre Boucher — contact@spboucher.ai6#7# Usage: Scripts/matrix.sh generate the matrix8# Scripts/matrix.sh --verify [...] also run the sweep; extra arguments go to `orix-convert matrix --verify`9# (--fresh, --retry-failed, --jobs N, --timeout S, --engine ID …)10# Scripts/matrix.sh --stress also run the mixed-batch robustness run (docs/reports/mixed-batch.md)11# Environment: ORIX_SKIP_BUILD=1 reuses the existing build; ORIX_E2E_WORK sets the sweep's work folder.12set -euo pipefail13export LC_ALL=C14ROOT="$(cd "$(dirname "$0")/.." && pwd)"15source "$ROOT/Scripts/cli-build.sh"1617orix_build_cli18# The tool runs with a minimal environment: nothing inherited, no Homebrew directory in PATH.19CLEAN=(env -i "PATH=/usr/bin:/bin" "HOME=$HOME" "TMPDIR=${TMPDIR:-/tmp}")20mkdir -p "$ROOT/docs/compatibility" "$ROOT/docs/reports"21"${CLEAN[@]}" "$ORIX_CLI" matrix --markdown --output "$ROOT/docs/compatibility/conversion-matrix.md"22"${CLEAN[@]}" "$ORIX_CLI" matrix --json --output "$ROOT/docs/compatibility/matrix.json"2324MODE="${1:-}"25if [ "$MODE" = "--verify" ]; then26 shift27 WORK="${ORIX_E2E_WORK:-${TMPDIR:-/tmp}/orix-convert-e2e}"28 # An engine that crashes takes the process down with it. The sweep journals what was running; the next invocation29 # re-runs those paths alone in child processes and carries on. Give up after 25 such restarts.30 attempt=031 while :; do32 attempt=$((attempt + 1))33 set +e34 "${CLEAN[@]}" "$ORIX_CLI" matrix --verify --work-dir "$WORK" --report-dir "$ROOT/docs/reports" "$@"35 status=$?36 set -e37 if [ "$status" -le 128 ] || [ "$status" -eq 130 ] || [ "$attempt" -ge 25 ]; then break; fi38 echo "matrix.sh: the sweep process died with status $status (attempt $attempt); resuming." >&239 # --fresh must not be repeated on a resume.40 set -- $(printf '%s\n' "$@" | grep -v -- '^--fresh$' || true)41 done42 echo "matrix.sh: sweep ended with status $status after $attempt invocation(s)." >&243 exit "$status"44elif [ "$MODE" = "--stress" ]; then45 "${CLEAN[@]}" "$ORIX_CLI" dev stress --report-dir "$ROOT/docs/reports"46fi47