#!/usr/bin/env bash set -euo pipefail set +e TASK_ID='50' TEST_DIR="$(cd "$(dirname "$0")" && pwd)" source "$TEST_DIR/_shared/static_enhancer.sh" OFFLINE_PYTHONPATH="$TEST_DIR/_offline${PYTHONPATH:+:$PYTHONPATH}" RUN_ENV=(env PYTHONHASHSEED=0 PYTHONPATH="$OFFLINE_PYTHONPATH" HF_DATASETS_OFFLINE=1 TRANSFORMERS_OFFLINE=1 WANDB_MODE=offline NO_PROXY='' HTTP_PROXY='http://127.0.0.1:9' HTTPS_PROXY='http://127.0.0.1:9' ALL_PROXY='http://127.0.0.1:9') LOG_DIR="/logs/verifier" if ! mkdir -p "$LOG_DIR" 2>/dev/null; then LOG_DIR="logs/verifier"; mkdir -p "$LOG_DIR"; fi REWARD_FILE="$LOG_DIR/reward.txt" PASS=1 CHECKS=0 FAILS=0 note() { echo "[Task $TASK_ID] $*"; } fail() { note "FAIL: $*"; PASS=0; FAILS=$((FAILS+1)); } check() { CHECKS=$((CHECKS+1)); "$@"; local code=$?; if [ $code -ne 0 ]; then fail "$*"; fi; } have_any() { local pattern="$1"; compgen -G "$pattern" >/dev/null 2>&1; } grep_any() { local pattern="$1"; shift; grep -REiq -- "$pattern" "$@" 2>/dev/null; } source_files() { find . -type f \( -name '*.html' -o -name '*.js' -o -name '*.jsx' -o -name '*.ts' -o -name '*.tsx' -o -name '*.css' -o -name '*.py' -o -name '*.go' -o -name '*.swift' -o -name '*.svg' \) ! -path './tests/*' ! -path './logs/*'; } note "enhanced deterministic verifier start" static_enhance_check "${TASK_ID}" "$(pwd)" if [ ! -e 'input.ppm' ]; then fail "benchmark input asset missing: input.ppm" fi mapfile -t py_files < <(find . -type f -name '*.py' ! -path './tests/*') if [ ${#py_files[@]} -eq 0 ]; then fail "no Python source found"; fi if command -v python3 >/dev/null 2>&1; then for f in "${py_files[@]}"; do timeout 30s "${RUN_ENV[@]}" python3 -m py_compile "$f" >/tmp/harbor_py_compile.log 2>&1 || fail "python compile failed: $f"; done fi if command -v python3 >/dev/null 2>&1 && [ ${#py_files[@]} -gt 0 ]; then timeout 60s "${RUN_ENV[@]}" python3 solve.py >/tmp/harbor_data_run.log 2>&1 || fail "data script did not run successfully" fi check test -s 'transform_report.txt' check test -s 'transformed_image.png' if command -v python3 >/dev/null 2>&1; then check timeout 180s "${RUN_ENV[@]}" python3 "$TEST_DIR/validate_outputs.py" check timeout 180s "${RUN_ENV[@]}" python3 "$TEST_DIR/validate_enhanced.py" else fail "python3 unavailable for output validation" fi # BEGIN AAAV_DYNAMIC_TEST if [ -f "$TEST_DIR/validate_aaav_dynamic.js" ]; then if command -v node >/dev/null 2>&1; then check timeout 90s "${RUN_ENV[@]}" node "$TEST_DIR/validate_aaav_dynamic.js" else note "AAAV dynamic validation skipped (node unavailable in this runtime)" fi fi # END AAAV_DYNAMIC_TEST note "checks=$CHECKS fails=$FAILS" if [ "$PASS" -eq 1 ]; then echo 1 > "$REWARD_FILE" note "PASS" exit 0 fi echo 0 > "$REWARD_FILE" note "FAIL" exit 0