#!/usr/bin/env bash set -euo pipefail ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" cd "$ROOT" SOURCE="$ROOT/vendor/kam_remake" ASSETS="$ROOT/private-assets" FIXTURE_MANIFEST="$ROOT/open_questions/config/fixture_manifest.json" INCLUDE_FALLBACK=() usage() { cat < private-assets/Maps/The Barbarian King/TBK01/TBK01.dat + TBK01.map No recursive fixture discovery is performed. This script does NOT run build-android.sh and does NOT execute Task 1 implementation. EOF2 } while [[ $# -gt 0 ]]; do case "$1" in --source) SOURCE="${2:?missing path after --source}"; shift 2 ;; --assets-root) ASSETS="${2:?missing path after --assets-root}"; shift 2 ;; --include-layer-fallback) INCLUDE_FALLBACK=(--include-fallback layer-map); shift ;; -h|--help) usage; exit 0 ;; *) echo "Unknown argument: $1" >&2; usage >&2; exit 2 ;; esac done if ! python3 tools/source_fetch.py --verify --destination "$SOURCE" >/dev/null 2>&1; then if [[ "$SOURCE" != "$ROOT/vendor/kam_remake" ]]; then echo "Pinned source at $SOURCE is missing or invalid." >&2 exit 2 fi echo "Pinned r16020 source is absent; fetching it with the EXISTING project source_fetch.py..." python3 tools/source_fetch.py --destination "$SOURCE" fi RUN_ID="$(date -u +%Y%m%dT%H%M%SZ)" OUT="$ROOT/reports/open-questions/runs/$RUN_ID" mkdir -p "$OUT" # Fail before any binary probe if an exact whitelisted path is absent or has an unexpected size. python3 open_questions/tools/decision_probe.py verify \ --source "$SOURCE" \ --assets-root "$ASSETS" \ --fixture-manifest "$FIXTURE_MANIFEST" \ "${INCLUDE_FALLBACK[@]}" \ --out "$OUT" python3 open_questions/tools/decision_probe.py all \ --source "$SOURCE" \ --assets-root "$ASSETS" \ --fixture-manifest "$FIXTURE_MANIFEST" \ "${INCLUDE_FALLBACK[@]}" \ --out "$OUT" python3 -m unittest discover -s open_questions/tests -v python3 - "$OUT" "$ROOT/reports/open-questions" <<'PY' import json,sys from pathlib import Path out=Path(sys.argv[1]); root=Path(sys.argv[2]) idx=json.loads((out/'decision_index.json').read_text(encoding='utf-8')) inv=json.loads((out/'fixture_inventory.json').read_text(encoding='utf-8')) branch=json.loads((out/'fixture_branch_coverage.json').read_text(encoding='utf-8')) manifest=json.loads((out/'fixture_manifest_status.json').read_text(encoding='utf-8')) latest={'run':out.name,'directory':str(out),'decision_index':str(out/'decision_index.json'), 'fixture_count':inv['count'],'fixture_status':inv['status'],'branch_status':branch['status'], 'manifest_status':manifest['status'],'included_fallbacks':idx.get('included_fallbacks',[])} root.mkdir(parents=True,exist_ok=True) (root/'LATEST.json').write_text(json.dumps(latest,indent=2,ensure_ascii=False)+'\n',encoding='utf-8') summary = [ '# Task 1 open-question probe — latest run','', f"Run: `{out.name}`", f"Whitelisted files read: **{inv['count']}** ({inv['status']})", f"Exact manifest paths/sizes: **{manifest['status']}**", f"Required format families: **{branch['status']}**", f"Conditional fallbacks enabled: **{', '.join(idx.get('included_fallbacks',[])) or 'none'}**",'', 'No recursive binary fixture discovery is used.', 'This run contains only static/fixture evidence. Android runtime micro-tests are a separate stage.', '',f"Decision index: `{out/'decision_index.json'}`" ] (root/'LATEST-SUMMARY.md').write_text('\n'.join(summary)+'\n',encoding='utf-8') PY echo echo "Open-question static probe completed." echo "Summary: reports/open-questions/LATEST-SUMMARY.md" echo "Index: reports/open-questions/LATEST.json" echo "Binary fixture selection came ONLY from open_questions/config/fixture_manifest.json." echo "This command did NOT run build-android.sh."