feat(short): la paleta de audio viva — GET /audio en el contrato, el prompt y el bucle de edición
Build & Deploy ResearchOwl / build-and-push (push) Successful in 9s

shortsmith ya compone la banda sonora (sonar); ahora publica una paleta
(pulse, static) y este repo la consume en vivo: el prompt la ofrece con sus
notas de mood, validate_spec la usa como fuente de verdad para audio.preset,
y editar el preset en /short_spec es la manera gratis de escucharlas. Sin
/audio (404 o caída) todo cae a la paleta base y nada deja de renderizar.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
ChemaVX
2026-08-06 14:41:27 +00:00
co-authored by Claude Fable 5
parent 1fd0c1b3d6
commit 93a506b636
11 changed files with 259 additions and 34 deletions
+26 -2
View File
@@ -10,8 +10,8 @@ from pathlib import Path
import pytest
from src.generator.shortsmith import (
JobResult, ShortsmithClient, ShortsmithError, ShortsmithRejected,
ShortsmithUnavailable, _templates_cache,
BASELINE_PRESETS, JobResult, ShortsmithClient, ShortsmithError,
ShortsmithRejected, ShortsmithUnavailable, _presets_cache, _templates_cache,
)
EXAMPLE = Path(__file__).resolve().parents[1] / "src/generator/examples/jal1628.json"
@@ -100,6 +100,30 @@ async def test_templates_cached_per_process():
_templates_cache.clear()
@pytest.mark.asyncio
async def test_audio_presets_come_from_the_service():
_presets_cache.clear()
client = ShortsmithClient("http://fake:8080")
palette = {"sonar": "drone", "pulse": "heartbeat"}
session = patch_session(client, {"/audio": FakeResp(200, {"presets": palette})})
assert await client.audio_presets() == palette
await client.audio_presets()
assert len(session.calls) == 1, "la segunda llamada debe salir de la caché"
_presets_cache.clear()
@pytest.mark.asyncio
async def test_a_shortsmith_without_audio_endpoint_yields_the_baseline():
"""404 = shortsmith anterior a la paleta. Fallback, no error."""
_presets_cache.clear()
client = ShortsmithClient("http://fake:8080")
patch_session(client, {"/audio": FakeResp(404, body="not found")})
assert await client.audio_presets() == BASELINE_PRESETS
_presets_cache.clear()
@pytest.mark.asyncio
async def test_render_returns_job_id(spec):
client = ShortsmithClient("http://fake:8080")