Skip to content

fix: preprocess music cover lyrics flow#160

Open
RyanLee-Dev wants to merge 1 commit into
mainfrom
fix/music-cover-preprocess
Open

fix: preprocess music cover lyrics flow#160
RyanLee-Dev wants to merge 1 commit into
mainfrom
fix/music-cover-preprocess

Conversation

@RyanLee-Dev
Copy link
Copy Markdown
Collaborator

Summary

  • run the music cover preprocess API before music generation whenever users provide custom lyrics for mmx music cover
  • send the returned cover_feature_id in the follow-up generation request instead of raw reference audio
  • add typed preprocess response support and cover command regression coverage for the two-step flow

Testing

  • bun test test/commands/music/cover.test.ts
  • bun run typecheck

@github-actions
Copy link
Copy Markdown

Summary

Adds a cover preprocess step to music cover — when --lyrics is provided, the CLI now calls /v1/music_cover_preprocess first to obtain a cover_feature_id, then uses it in the main music generation request. This allows lyrics to be passed to the cover flow without requiring manual ASR extraction.


Checks

Command Result Note
bun run typecheck ✅ Pass No TypeScript errors
bun test ✅ Pass 354 tests, 0 failures
bun run lint ⚠️ Warnings + 2 pre-existing errors The 2 errors (test/auth/oauth.test.ts, test/sdk/image.test.ts) are pre-existing on main — confirmed by running lint on ${PR_BASE_SHA} before the PR changes
bun run build:dev ✅ Pass 236KB (mmx) + 54KB (sdk)
Live smoke: music cover --dry-run --lyrics ... ✅ Pass preprocess_request + request body correctly structured
Live smoke: music cover --dry-run (no lyrics) ✅ Pass audio_url included directly, no preprocess call

Changes by file

src/commands/music/cover.ts

  • When --lyrics is supplied, calls musicCoverPreprocessEndpoint before the main music generation request.
  • Sets cover_feature_id from the preprocess response into the main request body.
  • In dry-run mode, prints both preprocess_request and request so the full flow is visible.

One minor observation: audioSource (the audio_url / audio_base64 pick) is computed before the needsPreprocess branch — this is fine, but worth a quick mental verification that readFileSync is only called when audio-file is used (not audio-url). It is — no issue.

src/client/endpoints.ts

  • Added musicCoverPreprocessEndpointPOST /v1/music_cover_preprocess.

src/types/api.ts

  • Added CoverPreprocessRequest and CoverPreprocessResponse types. Looks correct — cover_feature_id is the primary output used downstream.

test/commands/music/cover.test.ts

  • Updated dry-run assertion to verify preprocess body shape, cover_feature_id placeholder, and that audio_url is absent from the main request when lyrics are provided.

Notes / non-blocking

  • The test covers the audio-url + lyrics path. The audio-file + lyrics path (which exercises audio_base64 in preprocess) isn't explicitly tested — but the code path is symmetric and the logic is straightforward.
  • The lint errors in test/auth/oauth.test.ts and test/sdk/image.test.ts are pre-existing on main and unrelated to this PR.

Approve — all required checks green, build succeeds, smoke tests pass, and no blocking issues introduced.

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.

1 participant