From 33146cc7f60eef1316680190589d9f5228e33f1a Mon Sep 17 00:00:00 2001 From: topkoa Date: Mon, 6 Jul 2026 17:24:04 -0400 Subject: [PATCH 1/2] Accept spec lyrics_source values (authored, transcribed) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The feedpak spec (§7.1) defines the lyrics_source vocabulary as {authored, transcribed, user}, but the reader only accepted the legacy {xml, notechart, whisperx, user} set and silently downgraded anything else to "xml". A spec-compliant writer (e.g. the stem_splitter plugin, which emits transcribed for WhisperX-produced lyrics) therefore lost its provenance badge. Widen the allowed set to the union of the spec vocabulary and the legacy values so both validate, and alias the legacy whisperx engine name to the spec transcribed so existing packs normalise to the spec badge. Co-Authored-By: Claude Opus 4.8 (1M context) Signed-off-by: topkoa --- lib/sloppak.py | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/lib/sloppak.py b/lib/sloppak.py index 943d74b..9e543db 100644 --- a/lib/sloppak.py +++ b/lib/sloppak.py @@ -703,20 +703,29 @@ def load_song( and isinstance(e.get("d"), (int, float)) ] if song.lyrics: - # Provenance — populated by the converter (xml/notechart), - # the WhisperX fallback (whisperx), or hand-edits - # (user). Validate against the closed enum so a - # hand-edited (or otherwise malformed) manifest can't - # propagate a YAML dict / list / arbitrary string - # into the highway WS `lyrics.source` field and out - # to plugin badges. Anything outside the enum (or - # the wrong type) falls back to "xml" — the spec's - # back-compat default — instead of being stringified - # and trusted. - _ALLOWED_LYRICS_SOURCES = {"xml", "notechart", "whisperx", "user"} - # Legacy alias: older manifests labelled note-chart-derived - # lyrics with the source format's name; normalise it. - _LYRICS_SOURCE_ALIASES = {"sng": "notechart"} + # Provenance. The feedpak spec (§7.1) vocabulary is + # {authored, transcribed, user}; older manifests + the + # in-tree readers also use the source-format names + # (xml/notechart) and the WhisperX engine name + # (whisperx). Accept the union so both spec-compliant + # writers (e.g. the stem_splitter plugin emitting + # `transcribed`) and legacy packs validate. Validate + # against the closed enum so a hand-edited (or otherwise + # malformed) manifest can't propagate a YAML dict / list / + # arbitrary string into the highway WS `lyrics.source` + # field and out to plugin badges. Anything outside the + # enum (or the wrong type) falls back to "xml" — the + # back-compat default — instead of being stringified and + # trusted. + _ALLOWED_LYRICS_SOURCES = { + "xml", "notechart", "whisperx", "user", + "authored", "transcribed", + } + # Legacy aliases: older manifests labelled note-chart-derived + # lyrics with the source format's name, and the WhisperX + # fallback with the engine name — normalise both to the + # spec vocabulary the badges now expect. + _LYRICS_SOURCE_ALIASES = {"sng": "notechart", "whisperx": "transcribed"} raw_source = manifest.get("lyrics_source") if isinstance(raw_source, str): raw_source = _LYRICS_SOURCE_ALIASES.get(raw_source, raw_source) From 7cbf9824b1a78e0a3bf9f56b6661bfacb4259961 Mon Sep 17 00:00:00 2001 From: topkoa Date: Mon, 6 Jul 2026 17:30:26 -0400 Subject: [PATCH 2/2] Drop dead whisperx entry from allowed lyrics_source set The whisperx->transcribed alias runs before the membership check, so the literal whisperx never reaches _ALLOWED_LYRICS_SOURCES (same reason sng is omitted). Remove the dead entry. Per CodeRabbit review on #799. Co-Authored-By: Claude Opus 4.8 (1M context) Signed-off-by: topkoa --- lib/sloppak.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/sloppak.py b/lib/sloppak.py index 9e543db..798087d 100644 --- a/lib/sloppak.py +++ b/lib/sloppak.py @@ -717,8 +717,11 @@ def load_song( # enum (or the wrong type) falls back to "xml" — the # back-compat default — instead of being stringified and # trusted. + # Post-alias values only: `whisperx` is normalised to + # `transcribed` before the membership check below, so (like + # `sng`) it is intentionally absent from this set. _ALLOWED_LYRICS_SOURCES = { - "xml", "notechart", "whisperx", "user", + "xml", "notechart", "user", "authored", "transcribed", } # Legacy aliases: older manifests labelled note-chart-derived