Commit 7e966a5b by PLN (Algolia)

test(tide-table): the OPAL title join needs the page to be as-performed

Audited what could have consumed the phantom SOUNDCHECK entry positionally.
Answer: nothing did. The two real consumers of setlist.entries() are safe --
take-segments.py builds a dict keyed by path stem (a phantom adds one unused
key) and migrate-columns.py calls tracks(), not entries(). No shipped artifact
was off by one.

But the audit found a different positional coupling, live and undocumented.
opal_title_map() joins tracks.json's 1..N performance order against
segments_v4.json's perf_track. OPAL was played as 15 tracks; the release cut
Desire, and segments_v4 renumbered around the hole -- its perf_track keys are
1..13 and 15, with no 14. So the join lines up only while Desire still holds
performance slot 14.

Measured both ways rather than argued: as-performed yields 14 mappings
including REVOLUTION; drop Desire to make the page match the release and it
falls to 13. REVOLUTION's title is LOST -- silently, with nothing mislabelled,
which is what would have made it hard to notice. PLN chose as-performed today
as a documentary call about the page; this join quietly depended on the same
answer, and nobody knew the two were connected.

So: the assumption is written down where the join lives, and three tests hold
it -- every released track gets a title, the encore by name, Desire maps to
nothing rather than borrowing a neighbour's, and the hole at perf_track 14 is
still really there. That last one matters: if segments_v4 is ever renumbered
densely the reasoning stops holding, and the right outcome is a red test
rather than a quietly missing track.
parent 46709b26
...@@ -48,6 +48,21 @@ def opal_title_map() -> dict[str, str]: ...@@ -48,6 +48,21 @@ def opal_title_map() -> dict[str, str]:
The join key is performance order: `tracks.json` lists score paths 1..N in The join key is performance order: `tracks.json` lists score paths 1..N in
the order played, and `segments_v4.json` carries `perf_track` alongside the the order played, and `segments_v4.json` carries `perf_track` alongside the
title that actually shipped on the file. Neither file alone has both halves. title that actually shipped on the file. Neither file alone has both halves.
THIS DEPENDS ON tracks.json BEING THE SET AS PERFORMED, and nothing in
either file used to say so. OPAL was played as 15 tracks; the release cut
Desire, and `segments_v4.json` renumbered around the hole -- its
`perf_track` keys are 1..13 and 15, with no 14. So the enumerate() below
only lines up while Desire still occupies performance slot 14 in
tracks.json.
Measured 2026-09-05, both ways: as-performed yields 14 mappings including
REVOLUTION. Drop Desire to make the page match the release and the count
falls to 13 -- REVOLUTION's title is LOST, silently, because i=14 then
points at a perf_track that does not exist. Nothing mislabels, which is
what would have made it hard to notice. PLN chose as-performed for the
page on 2026-09-05 (a documentary call, not a technical one); this join
quietly needs that same choice, and test_opal_title_map guards it.
""" """
tj = Path("/home/pln/Work/Web/www/content/lives/2026/opal-festival-2026/tracks.json") tj = Path("/home/pln/Work/Web/www/content/lives/2026/opal-festival-2026/tracks.json")
sv = Path("/home/pln/Work/Sound/Prod/Opal26_master/segments_v4.json") sv = Path("/home/pln/Work/Sound/Prod/Opal26_master/segments_v4.json")
......
"""The OPAL title join, and the assumption it silently rests on.
`opal_title_map()` joins tracks.json's 1..N performance order against
segments_v4.json's `perf_track`. It is correct today, and it is correct only
because the gig page documents the set AS PERFORMED: OPAL was played as 15
tracks, the release cut Desire, and segments_v4's perf_track keys are 1..13
and 15 with a hole at 14. Re-cut the page to the 14 released tracks and the
enumerate() slides -- REVOLUTION's title vanishes with no error and no
mislabel, which is the hard kind of wrong to see.
So this asserts the OUTCOME (every released track gets its title) rather than
the mechanism, and it asserts the hole is really there -- because if
segments_v4 is ever renumbered densely, the reasoning above stops holding and
somebody should be told by a red test rather than by a missing track.
"""
import json
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
import pytest # noqa: E402
import setlist_to_segments as sts # noqa: E402
TRACKS_JSON = Path("/home/pln/Work/Web/www/content/lives/2026/"
"opal-festival-2026/tracks.json")
SEGMENTS_V4 = Path("/home/pln/Work/Sound/Prod/Opal26_master/segments_v4.json")
needs_files = pytest.mark.skipif(
not (TRACKS_JSON.exists() and SEGMENTS_V4.exists()),
reason="OPAL release artifacts not on this box")
@needs_files
def test_every_released_track_gets_its_title():
m = sts.opal_title_map()
segments = json.loads(SEGMENTS_V4.read_text())
assert len(m) == len(segments), (
f"{len(segments)} tracks shipped but only {len(m)} got a title -- the "
f"positional join has slipped. Missing titles: "
f"{sorted(set(r['title'] for r in segments) - set(m.values()))}")
# The encore is the one the slip would drop first, so name it explicitly.
assert "the_revolution_will_be_sampled" in m, \
"REVOLUTION lost its title: tracks.json is probably no longer the " \
"set as performed (Desire must keep performance slot 14)"
assert m["the_revolution_will_be_sampled"] == "REVOLUTION"
@needs_files
def test_the_assumption_is_still_true():
"""tracks.json is as-performed, and segments_v4 has the hole."""
scores = [t.get("file") or "" for t in
json.loads(TRACKS_JSON.read_text())["tracks"]]
perf = sorted(r["perf_track"] for r in
json.loads(SEGMENTS_V4.read_text()))
assert any("desire" in s.lower() for s in scores), (
"Desire is gone from tracks.json, so the page is the RELEASE, not the "
"performance -- opal_title_map()'s enumerate() no longer lines up with "
"perf_track and REVOLUTION will silently lose its title")
assert len(scores) == len(perf) + 1, (
f"{len(scores)} performed vs {len(perf)} released: expected exactly "
f"one performed-but-unreleased track (Desire)")
assert 14 not in perf and 15 in perf, (
f"segments_v4 perf_track = {perf}. The hole at 14 is what makes the "
f"positional join work; if these were renumbered densely, "
f"opal_title_map() needs rewriting, not this test relaxing")
@needs_files
def test_desire_is_deliberately_unmapped():
"""It has no v4 segment, so it must map to nothing -- not to a neighbour."""
m = sts.opal_title_map()
assert "desire" not in m, \
"Desire was cut from the release; a title here means the join " \
"borrowed one from an adjacent track"
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