Implemented. This document is the acceptance-contract and regression reference for the legacy web generate-to-Soundboard workflow; it is not an open implementation plan.
This brief is for an engineer maintaining the implemented S02 product workflow. After reading it, the engineer should preserve and verify the end-to-end path where generated speech is saved into Soundboard and can be reloaded for reuse without reopening discovery.
The implemented R045 and R046 surface is the legacy web main TTS screen plus the legacy web Soundboard. This surface has the text-to-speech API, the save-to-Soundboard API, the browser save modal, Soundboard category loading, pytest coverage, and the storage-provider seam that proves the user-visible workflow.
Native parity, storage-provider migration execution, and additional speech surfaces are downstream work. They should consume the acceptance contract proven here rather than expand this slice into another platform inventory.
Only these tracked files are needed for S02 implementation targeting:
web/python-web-app/src/routes/tts.py exposes POST /api/text-to-speech and delegates generation to the service layer.web/python-web-app/src/services/tts_service.py allocates a generated speech artifact, persists its immutable generation-settings sidecar, and returns artifact_id, audio_path, download_path, and clip_metadata on successful generation.web/python-web-app/src/routes/legacy.py exposes POST /api/soundboard/save-clip; the route delegates through legacy_route_dependencies to soundboard_route_service.save_clip_to_soundboard, which requires text plus an artifact reference, uploads audio/text/metadata assets, persists clip ordering, and invalidates category cache.web/python-web-app/static/js/index_speech.js owns the browser generate-and-save modal flow. It retains the canonical generated artifact and submits artifact_id, artifact_path, audio_path, download_path, text, category, format, bitrate, normalization, and bounded metadata to the save endpoint.web/python-web-app/static/js/index_soundboard.js owns Soundboard category load, clip render, play, download, and reload/reuse behavior.web/python-web-app/tests/api/test_tts_soundboard_workflow_target.py and web/python-web-app/tests/js/tts_soundboard_workflow_runtime_check.mjs prove the API and browser artifact handoff, success path, structured failures, stale-artifact protection, and reload notification contract.POST /api/text-to-speech.audio_path and the immutable metadata snapshot captured when that exact audio was generated.POST /api/soundboard/save-clip.audio_path or artifact_path.Success criteria:
POST /api/text-to-speech returns a structured success payload that includes artifact_id, audio_path, and download_path for the generated audio artifact..metadata.json sidecar and Supabase artifacts use generation_artifacts.metadata.audio_path or equivalent artifact reference is stable enough for a subsequent POST /api/soundboard/save-clip request in the same browser workflow.artifact_path or audio_path and resolves it through the server-side artifact/download path rules.Failure criteria:
SPEECH_ARTIFACT_REFERENCE_REQUIRED.SPEECH_ARTIFACT_NOT_FOUND response.Success criteria:
POST /api/soundboard/save-clip uploads the generated audio to the selected Soundboard category using the configured storage provider path.Failure criteria:
Success criteria:
/api/text-to-speech artifact reference separate from the text input value.audio_path or artifact_path from the latest generated response, plus category, text, format, bitrate, and normalize options.Failure criteria:
audio_path or artifact_path.SPEECH_ARTIFACT_REFERENCE_REQUIRED, SPEECH_ARTIFACT_NOT_FOUND, or another structured error, the UI must show a clear failure toast and reset the Save button state./api/text-to-speech failures./api/soundboard/save-clip failures.SPEECH_RUNTIME_ERROR, SPEECH_ARTIFACT_REFERENCE_REQUIRED, and SPEECH_ARTIFACT_NOT_FOUND.Future agents must be able to inspect the workflow through pytest failures and runtime diagnostics. Preserve these observable fields and signals:
/api/text-to-speech success payload: artifact_id, audio_path, download_path, and clip_metadata./api/soundboard/save-clip request payload: category, text, and audio_path or artifact_path.save-clip-to-soundboard, structured speech error codes, provider upload path, text sidecar path, clip-order update result, and cache invalidation log.