#!/usr/bin/env bash # Re-computes the parity-bar hash lock (TESTING_SPEC §12.1). # # Run this only when a justified change to # `crates/simulation/tests/parity-bar/` or `TESTING_SPEC.md` lands. # Commit the resulting `.locked-hashes` change in a separate commit # titled `parity-bar: update lock` per §12.1. set -euo pipefail ROOT="${1:-$(git -C "$(dirname "$0")/.." rev-parse --show-toplevel 2>/dev/null \ || ( cd "$(dirname "$0")/.." && pwd ) )}" PARITY_DIR="$ROOT/crates/simulation/tests/parity-bar" SPEC="$ROOT/crates/simulation/TESTING_SPEC.md" LOCK_FILE="$PARITY_DIR/.locked-hashes" if [[ ! -d "$PARITY_DIR" ]]; then echo "update-parity-lock: parity-bar directory missing: $PARITY_DIR" >&2 exit 1 fi if [[ ! -f "$SPEC" ]]; then echo "update-parity-lock: TESTING_SPEC.md missing: $SPEC" >&2 exit 1 fi DIGEST=$({ find "$PARITY_DIR" -type f ! -name '.locked-hashes' -print0 \ | sort -z \ | xargs -0 sha256sum sha256sum "$SPEC" } | sed -E "s|$ROOT/||" | sha256sum | awk '{print $1}') cat > "$LOCK_FILE" <