fix: projects saved while the video/audio Load Media nodes existed drop those slots instead of failing to load

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CHWxqHtxwWrq4kEyFTaHds
This commit is contained in:
Claude
2026-10-21 02:37:16 +00:00
parent f4187dc962
commit d03ba50216
2 changed files with 32 additions and 0 deletions
+22
View File
@@ -13,3 +13,25 @@ CATEGORY = "system"
STATUS = "proven"
NODES = [FunPackLoadMedia]
#: Two dev builds briefly shipped a node each for video and audio; Load Media does both now.
_GONE = ("FunPackLoadMediaVideo", "FunPackLoadMediaAudio")
def upgrade(slots, outputs):
"""Pipelines saved while those nodes existed lose their slots (the app wires references per run) and any wire from them."""
dead = {s["id"] for s in slots if s.get("node") in _GONE}
if not dead:
return slots
out = []
for s in slots:
if s["id"] in dead:
continue
inputs = {k: v for k, v in (s.get("inputs") or {}).items()
if not (isinstance(v, (list, tuple)) and v and v[0] in dead)}
out.append({**s, "inputs": inputs})
return out
PROVIDES = {"upgrade_slots": upgrade}
@@ -109,3 +109,13 @@ def test_audio_loads_as_audio(store):
entry = media.save_upload("a.wav", path.read_bytes())
_, _, audio = FunPackLoadMedia.execute(entry["id"], full=True).result
assert audio["sample_rate"] == 8000 and audio["waveform"].shape == (1, 1, 800)
def test_slots_of_the_retired_video_and_audio_nodes_are_dropped_with_their_wires():
from modules.media.load import upgrade
slots = [{"id": "r2v", "node": "X", "inputs": {"a": ["v1", 1], "keep": 3, "b": ["ref", 0]}},
{"id": "v1", "node": "FunPackLoadMediaVideo", "inputs": {}},
{"id": "ref", "node": "FunPackLoadMedia", "inputs": {}}]
out = upgrade(slots, None)
assert [s["id"] for s in out] == ["r2v", "ref"]
assert out[0]["inputs"] == {"keep": 3, "b": ["ref", 0]}