feat: add key-free demo mode replaying recorded fixtures

This commit is contained in:
Justin Visser 2026-08-11 09:14:22 +02:00
parent 0664cc2d27
commit 401a0ddea7
21 changed files with 1040 additions and 31 deletions

View file

@ -0,0 +1,28 @@
"""Playlist writer that makes demo saves explicit and network-free."""
import hashlib
import structlog
from app.domain.models import CreatedPlaylist
class DemoPlaylistWriter:
"""Simulate playlist writes with stable Spotify-shaped URLs."""
async def create_playlist(self, name: str, description: str) -> CreatedPlaylist:
"""Return a deterministic fake playlist without an external write."""
digest = hashlib.sha256(f"{name}\n{description}".encode()).hexdigest()[:12]
playlist_id = f"demo-{digest}"
return CreatedPlaylist(
id=playlist_id,
url=f"https://open.spotify.com/playlist/{playlist_id}",
)
async def add_tracks_to_playlist(self, playlist_id: str, track_uris: list[str]) -> None:
"""Log the simulated track addition without writing to Spotify."""
structlog.get_logger().info(
"demo_playlist_simulated",
playlist_id=playlist_id,
track_count=len(track_uris),
)