Skip to content

fix(story): no rechazar el MP3 custom transcodificado ni fallar el cover del catálogo - #248

Merged
IAnMove merged 1 commit into
developmentfrom
cursor/bc-149fb19b-3bd8-4800-8db9-413db435343d-cb75
Sep 7, 2026
Merged

fix(story): no rechazar el MP3 custom transcodificado ni fallar el cover del catálogo#248
IAnMove merged 1 commit into
developmentfrom
cursor/bc-149fb19b-3bd8-4800-8db9-413db435343d-cb75

Conversation

@cursor

@cursor cursor Bot commented Sep 7, 2026

Copy link
Copy Markdown

Resumen ejecutivo

Qué cambia

El import de MP3 custom desde el disco acepta el WAV que deja /upload-audio. La generación de cover también resuelve un tema del workspace/catálogo, no solo uploads/audio/.

Para qué sirve

En #245, Import custom MP3 desde el dispositivo sube el archivo, el servidor transcodifica mp3→wav y commitStoryAudioChoice(..., requireMp3) rechazaba ese artefacto. El cover del picker compartido guardaba solo el basename; si el tema vivía en el workspace, MiniMax respondía 400.

Impacto para el usuario

Volver a poder importar un MP3 desde el disco como candidato de cue. Poder generar un cover usando un audio ya generado en la biblioteca.

Riesgo

  • Bajo
  • Medio
  • Alto

Estado

  • Listo para revisión

Summary

isCustomMp3Output now treats /api/v1/uploads/audio/ (and uploads/audio/ paths) as a valid custom-MP3 choice, because /upload-audio transcodes mp3/m4a/aac to wav before onChoose. Catalog non-mp3 rows stay rejected. Cover jobs resolve uploads/audio/{basename} first, then the workspace-confined media path, so a catalog track bound as coverReferenceFilename is found.

Overview

PR #245 routes cover / Lyria / custom MP3 through StoryAudioPicker. Device files upload via AssetInputuploadAudio. That endpoint always transcodes mp3 to {uuid}.wav and deletes the original. The new requireMp3 guard then saw .wav and returned reject, so every from-device custom import failed after a successful upload.

Cover generation still joined uploads/audio/ + basename only. A library song stored in the workspace (typical MiniMax output) produced a success notice in the UI and then Upload a valid reference song before generating a cover.

Detailed changes

Backend

resolve_story_cover_audio in media_paths.py. Both MiniMax music candidate endpoints use _story_cover_reference_path instead of _safe_join(uploads/audio, basename) only.

UI and Wizard

isUploadedAudioOutput + isCustomMp3Output accept the post-transcode upload artifact. Catalog wav/flac via /api/v1/file/ still reject.

Data, provenance and compatibility

No sidecar change. Custom candidates keep model: custom-audio-upload. Cover still stores basename; the server now finds that name in uploads/audio or the workspace.

Files and ownership

  • ui/src/features/stories/storyAudioPick.ts — accept transcoded uploads as custom MP3
  • ui/tests/storyAudioPick.test.mjs — device wav upload still applies; catalog wav still rejected
  • app/services/media_paths.py — cover resolver
  • app/_launch_runtime.py — both music-candidate endpoints
  • tests/test_media_path_security.py — upload-then-workspace cover resolution + AST check

Validation

  • Date (UTC): 2026-09-07

  • Base SHA: 12b07db (grok/agente2-story-audio-06ffec07)

  • Head SHA: 2a50c15

  • Validation scope: focused

  • python scripts/verify_clean_repo.py

  • python -m compileall -q app/services/media_paths.py

  • Focused Python tests: python3 -m pytest tests/test_media_path_security.py tests/test_story_lab_audio_ui.py -q — 11 + 17 passed

  • cd ui && npm run i18n:check

  • UI tests: npx tsx --tsconfig tsconfig.app.json --test tests/storyAudioPick.test.mjs — 5/5 pass

  • cd ui && npm run lint -- --max-warnings=0

  • cd ui && npm run build

  • git diff --check

  • E2E/smoke checks: N/A (picker commit + path resolver; no GPU)

Code quality

  • Score: pending CI
  • Complexity trend: pending CI
  • Production LOC trend: pending CI
  • Regression versus main: pending CI
  • Ratchet: pending CI

CI and review

  • CI of this HEAD: pending
  • Independent agent review of this HEAD: pending
  • Human merge click (operational, not code review): pending
  • Pending

Coste de la tarea

  • Tests simulados: 0 tokens externos
  • Tests reales: N/A
  • Llamadas LLM externas: 0
  • Tokens de prompt: N/A
  • Tokens de respuesta: N/A
  • Tokens totales: N/A
  • Generaciones de imágenes/audio/vídeo: 0
  • Tiempo transcurrido: N/A
  • Proveedores/modelos: N/A

Notes and limitations

Fix PR for #245. Merge this into grok/agente2-story-audio-06ffec07 before landing the picker work. Catalog non-mp3 rows remain rejected. Cover still prefers uploads/audio/ when the same basename exists there and in the workspace.

Follow-up work

None.

Checklist

  • The executive summary is understandable without reading the code.
  • The detailed Summary/Overview has not been removed or shortened.
  • Tests and their actual results are recorded.
  • Generated assets, secrets and local-only files are not committed.
  • Required CI and Cursor/Bugbot review are complete, or the PR is clearly marked as waiting for them.
Open in Web View Automation 

Note

Low Risk
Narrow UI guard and confined media-path resolution reuse existing security patterns; no auth or data-model changes.

Overview
Fixes two Story audio picker regressions: custom MP3 from disk and cover generation from catalog/workspace tracks.

On the UI, isCustomMp3Output now treats artifacts under uploads/audio (including the WAV returned after /upload-audio transcodes mp3/m4a/aac) as valid custom imports when requireMp3 is set, while catalog rows served via /api/v1/file/ still must look like MP3.

On the backend, cover jobs no longer join only uploads/audio/{basename}. New resolve_story_cover_audio prefers a confined file in uploads/audio, then falls back to resolve_permitted_media_path in the active workspace. Both start_story_music_candidates_job and generate_story_music_candidates use _story_cover_reference_path for that logic. Tests cover upload-vs-workspace precedence and AST checks that both endpoints call the shared helper.

Reviewed by Cursor Bugbot for commit 2a50c15. Configure here.

…covers

Device custom-MP3 picks go through /upload-audio, which transcodes mp3 to wav.
Require-mp3 after that upload rejected every from-disk import. Cover generation
also looked only in uploads/audio/, so a catalog workspace track bound as a
cover failed at generate time.

Co-authored-by: ignaciodelcano+dcl <ignaciodelcano+dcl@gmail.com>
@IAnMove
IAnMove changed the base branch from grok/agente2-story-audio-06ffec07 to development September 7, 2026 20:53
@IAnMove
IAnMove marked this pull request as ready for review September 7, 2026 20:54
@cursor

cursor Bot commented Sep 7, 2026

Copy link
Copy Markdown
Author

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_e25bafd4-a0e9-4797-ac35-9beba4a7f77e)

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

PR Review — Loreframe Studio

Risk: low
Scope: 5 file(s); +141/-10; React UI, backend services

Automated review from scripts/analyze_pr.py. This is a heuristic pass (no LLM) so humans still own the merge decision.

Findings

  • low — UI changed — rebuild before merge
    Run cd ui && npm run build (CI already does this). Pinokio Update rebuilds for end users; keep ui/dist untracked.

Changed files

  • modified: app/_launch_runtime.py, app/services/media_paths.py, tests/test_media_path_security.py, ui/src/features/stories/storyAudioPick.ts, ui/tests/storyAudioPick.test.mjs

CONTRIBUTING checklist

  • python scripts/verify_clean_repo.py
  • python -m compileall -q app/services app/launch.py scripts
  • cd ui && npm run build if the UI changed
  • No weights, CivitAI sidecars, or generated guides
  • Stays local-first (no required accounts / telemetry)

Posted by the repo PR review workflow. Re-runs on each push to the PR.

@IAnMove
IAnMove merged commit 5e08edb into development Sep 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants