mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-12-02 18:08:07 +09:00
## Summary Reworks the **artist/title matching, suggestions & auto-correction** on Step 2 of the Create Karaoke Video flow. The confusing green **"Song found in our database"** panel is gone; formatting is now tidied intelligently and (mostly) invisibly. Driven by a new backend **match judge**: a deterministic normalizer + the karaoke-decide catalog run first, and a light Vertex Gemini model (`gemini-3.5-flash`) is consulted **only** when those aren't confident. ### Behaviour (Step 2) - **Cosmetic** fix (casing/punctuation/diacritics, same song) → applied **silently**, with a quiet *"Tidied to X · keep what I typed"* line. **Never** re-runs the audio search. - **Confident content** fix (e.g. `Yesteray → Yesterday`) → applied with a *"Corrected to X · Undo"* line, and re-runs the audio search **only when the original results were weak** (tier 3). - **Ambiguous** → ask-first *"Did you mean…?"* prompt before changing anything. - **None** → no change. Resilient by design: the judge never blocks job creation — on timeout/error it returns `none`. Kill switch: `MATCH_JUDGE_ENABLED=false` (deterministic + catalog still run). ## Why The catalog panel existed only to nudge official formatting (quality bar for published tracks), but read like "we already have this karaoke video." User feedback flagged it as confusing. This preserves the formatting-hygiene benefit while removing the friction/confusion. Design + history review in `docs/archive/2026-06-15-artist-title-matching-rework-plan.md`. ## Preserved (hard-won lessons honoured) - No Step-1 autocomplete; suggestions stay on Step 2. - Cosmetic correction never restarts the audio search (existing `onArtistTitleCorrection` no-restart path reused). - Deferred job-creation / search-session pattern untouched. - `stringSimilarity`/`findFuzzyMatches` kept as pure utils (existing tests green). - No changes to step structure, visibility/customize ordering, or the public-style brand rule. ## Changes - **Backend**: `backend/services/match_judge/` (classifier → AI judge → orchestration), `POST /api/catalog/match-judge`, config (`MATCH_JUDGE_ENABLED`/`MATCH_JUDGE_MODEL`/`MATCH_JUDGE_TIMEOUT_MS`). - **Frontend**: `api.matchJudge`, Step 2 rewired, green panel removed, new `MatchNotice` component; 5 `jobFlow` i18n keys across all 33 locales. - **Docs**: API.md endpoint section + design/plan doc. Version → 0.183.0. ## Testing - Full suite green: backend (unit + integration + emulator, coverage gate passed) + **1008 frontend tests** + e2e. - New: 20 backend tests (classifier, AI mapping, orchestration, endpoint) + updated `AudioSourceStep` tests (cosmetic tidy, ambiguous ask, none, failure-silent) + preserved fuzzy-matching tests. - CodeRabbit: 1 finding fixed (Literal types), 1 false positive. ## Follow-ups (separate PRs) - Title-screen preview perf (4K canvas/bg → low-res + preload + spinner). @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>