#!/usr/bin/env bash # Oracle solution: three independent repairs -- the shell variable typo and the # missing output directory, the dropped final record, and the truncated mean. set -euo pipefail cd "$TB_WORK" cat > build.sh <<'SHEOF' #!/usr/bin/env bash set -euo pipefail OUT=dist mkdir -p "$OUT" build python src/gen.py data/input.txt | tee build/gen.log > "$OUT/report.txt" python -m pytest tests -q SHEOF python - <<'PYEOF' from pathlib import Path gen = Path("src/gen.py") text = gen.read_text(encoding="utf-8") text = text.replace("for line in lines[:-1]:", "for line in lines:") gen.write_text(text, encoding="utf-8", newline="\n") stats = Path("src/lib/stats.py") text = stats.read_text(encoding="utf-8") text = text.replace("return total // len(values)", "return total / len(values)") stats.write_text(text, encoding="utf-8", newline="\n") PYEOF bash build.sh