Commit 99f8466f by PLN (Algolia)

fix(check-tracks): the pre-gig gate could not run — it read a setlist that never existed

check-tracks.sh is THE empirical gate: it boots every track in the set and proves
each declared orbit makes sound, which is also the only compile check a .tidal file
can have (there is no static typechecker for a GHCi fragment). The comment at the
top says to run it the day before the gig.

It read `setlist_opal2026.txt` from the repo ROOT. That file has never existed. So
the gate has been unrunnable since it was written — and it failed in the least
helpful way possible, printing "no such file" per track from an empty list rather
than saying the setlist was missing.

Now points at `armada/setlist_opal2026.txt`, the file added for #68, so ONE list
drives both questions: "does every orbit sound" (this) and "which orbits ghost
across each transition" (orphan-orbits.py). Reorder the gig, re-answer both.

Two fixes it needed to actually read that file:
  * strip TRAILING comments, not just full-line ones — the setlist annotates each
    path with its codename and BPM (`live/…/wap.tidal   # WAP [133]`), and leaving
    that on the line makes every track report "no such file";
  * fail loudly when the setlist is absent, instead of silently iterating nothing.

Also: `--help` was taken as a track name, so asking for help answered
"FAIL — no such file", which reads like the rig is broken.

Verified: all 13 tracks resolve through the shell reader. Pinned by two tests —
one asserts check-tracks.sh and orphan-orbits.py name the SAME setlist file (a
broken gate is invisible until the day you need it), the other runs the actual sed
pipeline and asserts no comment text leaks into a path.

Suite 435 -> 437, all green. NOT run end-to-end: it needs audio, and it is ~45 s
per track by design (a tight loop lands evals on a half-loaded interpreter and
reports false failures). It is the natural companion to tomorrow's run-through.
parent b3dddedb
...@@ -43,13 +43,34 @@ ...@@ -43,13 +43,34 @@
set -u set -u
cd "${0:A:h}/.." || exit 2 cd "${0:A:h}/.." || exit 2
SETLIST=${SETLIST:-setlist_opal2026.txt} # The set list is DATA, shared with tools/orphan-orbits.py (#68) so reordering the
# gig re-answers both "does every orbit sound" and "which orbits ghost" from one
# file. This used to point at a bare `setlist_opal2026.txt` in the repo ROOT, which
# has never existed — so the pre-gig gate could not run at all, and said only
# "no such file" per track if you tried.
SETLIST=${SETLIST:-armada/setlist_opal2026.txt}
LOG=$(mktemp -t check-tracks-XXXXXX.log) LOG=$(mktemp -t check-tracks-XXXXXX.log)
# Without this, `--help` is taken as a track name and the tool answers a request for
# help with "FAIL — no such file", which reads like the rig is broken.
if [[ ${1:-} == (-h|--help) ]]; then
sed -n '2,44p' "${0:A}" | sed 's/^# \?//'
exit 0
fi
if [[ ! -f $SETLIST ]]; then
print -u2 "check-tracks: FAIL — no setlist at $SETLIST"
print -u2 " (override with SETLIST=path, or pass tracks as arguments)"
exit 2
fi
if (( $# )); then if (( $# )); then
TRACKS=("$@") TRACKS=("$@")
else else
TRACKS=(${(f)"$(grep -vE '^[[:space:]]*(#|$)' $SETLIST)"}) # Strip full-line AND trailing comments: the setlist annotates each path with its
# codename and BPM (`live/…/wap.tidal # WAP [133]`), and leaving that on the line
# makes every track report "no such file".
TRACKS=(${(f)"$(sed -e 's/#.*//' -e 's/[[:space:]]*$//' $SETLIST | grep -vE '^$')"})
fi fi
print "check-tracks: ${#TRACKS} track(s), one at a time — this takes ~45s each\n" print "check-tracks: ${#TRACKS} track(s), one at a time — this takes ~45s each\n"
......
...@@ -259,6 +259,36 @@ def test_pair_exits_nonzero_when_there_are_ghosts(capsys): ...@@ -259,6 +259,36 @@ def test_pair_exits_nonzero_when_there_are_ghosts(capsys):
assert oo.cmd_pair("bombe_dj", "wap") == 0 assert oo.cmd_pair("bombe_dj", "wap") == 0
def test_check_tracks_reads_the_SAME_setlist_file():
"""Two tools consume this list — orphan-orbits (which orbits ghost) and
check-tracks.sh (does every orbit sound). They must not drift.
check-tracks.sh pointed at a bare `setlist_opal2026.txt` in the repo ROOT, which
has never existed, so the pre-gig gate could not run at all — it would just say
"no such file" for every track. Pinned here because a broken gate is invisible
until the day you need it.
"""
sh = (oo.REPO / "tools" / "check-tracks.sh").read_text()
assert "armada/setlist_opal2026.txt" in sh
assert oo.SETLIST.exists()
def test_the_setlist_survives_the_shell_parse_too():
"""The setlist annotates each path with codename + BPM after a '#'. The shell
reader has to strip TRAILING comments, not just full-line ones, or every track
reports "no such file"."""
import re as _re
import subprocess
out = subprocess.run(
["sed", "-e", "s/#.*//", "-e", "s/[[:space:]]*$//", str(oo.SETLIST)],
capture_output=True, text=True, check=True).stdout
rows = [ln for ln in out.splitlines() if ln.strip()]
assert len(rows) == 13
for r in rows:
assert not _re.search(r"[#\[]", r), f"comment leaked into {r!r}"
assert (oo.REPO / r).exists(), r
def test_resolve_finds_a_track_by_bare_name(): def test_resolve_finds_a_track_by_bare_name():
assert oo.resolve("gimme_acid").name == "gimme_acid.tidal" assert oo.resolve("gimme_acid").name == "gimme_acid.tidal"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment