#!/usr/bin/env bash
# CHECK -- the media-catalog claims check (24 claims in REPORT.md, rc 0 = all hold).
#
# This file is the ONE place this lane names the catalog's path on the host: the
# source lives outside the repository, and Q69's defect is a path typed into a tool
# that then grades one host's copy from any checkout. The tools name no path; the
# pin lives here, in an entry point, and callers override it with $MEDIA_CATALOG_SRC.
#
# rc 0 every claim holds | rc 1 a claim is false | rc 2 could not grade
set -u

ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
SRC="${MEDIA_CATALOG_SRC:-/root/stackchain_catalog_raw.json}"

if [ ! -f "$SRC" ]; then
    echo "no catalog at $SRC; cannot grade (set MEDIA_CATALOG_SRC to name one)" >&2
    exit 2
fi

MEDIA_CATALOG_SRC="$SRC" exec python3 "$ROOT/wizard-work/volt/mcverify.py"
