#!/usr/bin/env bash # Generated by `atlas autoresearch` — the Goodhart guard. # # A candidate may only change the artifact under test. If a run modifies any # OTHER tracked file (e.g. rewrites the evaluator or test data to fake a pass), # this gate fails (exit non-zero) and the candidate is scored worst, so the # Pareto front never elevates a cheat. Relax IGNORE_RE if your run legitimately # rewrites tracked files (checkpoints, logs, and .atlas/ are already ignored). set -uo pipefail WT="${1:-$PWD}" TARGET="${ATLAS_OPTIMIZE_TARGET:-$2}" REL="${TARGET#"$WT"/}" IGNORE_RE='^(outputs/|out/|checkpoints/|runs/|wandb/|\.atlas/|.*\.log$|.*\.ckpt$|.*\.pt$|.*\.bin$|.*\.safetensors$)' CHANGED="$(git -C "$WT" status --porcelain --untracked-files=no 2>/dev/null \ | sed 's/^...//' \ | { [ -n "$REL" ] && grep -vF -- "$REL" || cat; } \ | grep -Ev "$IGNORE_RE" || true)" if [ -n "$CHANGED" ]; then echo "[gate] the run modified tracked files other than the candidate:" >&2 echo "$CHANGED" >&2 exit 1 fi exit 0