Files
karaoke-gen/frontend/package.json
T
Andrew Beveridge ☄️andClaude Opus 4.7 8c530f5ade feat: syllable-aware custom lyrics with validate-and-repair loop (#741)
## Summary

Enhances the Custom Lyrics LLM mode with syllable-count validation and
per-line repair, plus user-facing settings (`allow_reword`,
`allow_omit`, `fixed_line_count`, `strictness`) and a per-line preview
UI showing target/actual syllables and severity badges.

- **Backend**: New `GenerationSettings` model, validator computing
per-line `min_delta` against the existing `SyllablesMatchHandler`
engine, repair loop (max 3 iterations, plateau-aware on the full
`(violations, total_delta)` score tuple), proportional timing
redistribution for variable-line-count outputs, structured per-iteration
logging with worst-3-line breadcrumbs.
- **Frontend**: Collapsible `CustomLyricsSettings` panel (3 toggles +
5-button strictness segmented control with ARIA group semantics +
contradiction warning), `CustomLyricsPreview` with severity badges +
iterations badge + stop-reason banner, wired into existing
`CustomLyricsMode` modal. Snake-case API response shape
(`line_metadata`, `iterations_used`, `stop_reason`, `settings_applied`,
`new_segment_timing`).
- **i18n**: 33 new keys across 33 locales (auto-translated via Gemini
pipeline).
- **Eval harness**: `backend/eval/custom_lyrics/` with disk-backed
Gemini cache (record-and-replay), per-line + per-fixture + corpus
scorers, CLI runner (`make eval-custom-lyrics`), and 4 fixtures (Year 5
Stars from production + 3 handcrafted public-domain).
- **Production E2E**: Updated existing test for the new preview UI + 3
new tests for settings panel toggles.

## Risk / Deferred Validation

The eval harness is built and ready, but **Phase 8 baseline capture
(v1-ships criteria validation) was deferred** — we ship and test in
prod. If the Year-5-Stars fixture doesn't hit `pct_pass_at_2 >= 75%`
post-merge, the spec lists fallback paths (chunked generation, per-line
repair); the eval can be run anytime via `make eval-custom-lyrics`.

Repair-loop logging is structured and rich so any prod failure is
diagnosable from Cloud Logging without re-running locally — log
breadcrumbs include per-iteration violation count, score deltas, and the
worst 3 failing lines with their target/candidate text + syllable
arrays.

## Test plan

- [x] Backend unit tests: 77 passing
- [x] Frontend unit tests: 32 passing across CustomLyricsSettings,
CustomLyricsPreview, CustomLyricsMode, customLyrics API client,
segmentsFromLines
- [x] TypeScript compiles cleanly for the touched files
- [x] CodeRabbit local review run; real bugs in timing.py (median +
zero-syllable) and validator.py (segment-duration hardening) fixed
inline
- [ ] **Post-merge**: real Gemini run against Year-5-Stars production
job, check Cloud Logging for `custom_lyrics_repair_iter_complete`
events, verify `pct_pass_at_2` matches expectations
- [ ] **Post-merge**: run prod E2E suite once admin token is plumbed in
CI (or manually)

@coderabbitai ignore

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 23:26:09 -04:00

119 lines
4.4 KiB
JSON

{
"name": "karaoke-gen-frontend",
"version": "0.86.0",
"private": true,
"scripts": {
"prebuild": "node scripts/write-version.mjs",
"build": "next build && node scripts/spa-redirect-404.js",
"dev": "next dev",
"dev:with-lyrics": "concurrently -n karaoke,lyrics -c blue,green \"npm run dev\" \"npm run dev:lyrics\"",
"dev:lyrics": "cd ../lyrics_transcriber_temp/lyrics_transcriber/frontend && npm run dev",
"lint": "eslint .",
"start": "next start",
"test": "jest --watch",
"test:unit": "jest --ci --maxWorkers=2",
"test:ci": "jest --ci --coverage --maxWorkers=2",
"test:coverage": "jest --coverage",
"test:e2e": "playwright test",
"test:e2e:ui": "playwright test --ui",
"test:e2e:debug": "playwright test --debug",
"test:e2e:headed": "playwright test --headed",
"test:e2e:ci": "playwright test --reporter=list",
"test:e2e:record": "playwright test --config=playwright.record.config.ts",
"test:e2e:prod": "playwright test --config=playwright.production.config.ts",
"test:e2e:prod:headed": "playwright test --config=playwright.production.config.ts --headed",
"test:e2e:prod:debug": "playwright test --config=playwright.production.config.ts --debug",
"test:e2e:demo": "playwright test --config=playwright.demo.config.ts",
"test:e2e:demo:headed": "playwright test --config=playwright.demo.config.ts --headed",
"demo:create-video": "node scripts/create-demo-video.mjs",
"test:all": "npm run test:unit && npm run test:e2e",
"fixtures:review": "npx ts-node e2e/fixtures/review-cli.ts",
"fixtures:review-ui": "playwright test --config=playwright.review.config.ts --headed"
},
"dependencies": {
"@fingerprintjs/fingerprintjs": "^5.1.0",
"@hookform/resolvers": "^3.10.0",
"@radix-ui/react-accordion": "1.2.2",
"@radix-ui/react-alert-dialog": "1.1.4",
"@radix-ui/react-aspect-ratio": "1.1.1",
"@radix-ui/react-avatar": "1.1.2",
"@radix-ui/react-checkbox": "1.1.3",
"@radix-ui/react-collapsible": "1.1.2",
"@radix-ui/react-context-menu": "2.2.4",
"@radix-ui/react-dialog": "1.1.4",
"@radix-ui/react-dropdown-menu": "2.1.4",
"@radix-ui/react-hover-card": "1.1.4",
"@radix-ui/react-label": "2.1.1",
"@radix-ui/react-menubar": "1.1.4",
"@radix-ui/react-navigation-menu": "1.2.3",
"@radix-ui/react-popover": "1.1.4",
"@radix-ui/react-progress": "1.1.1",
"@radix-ui/react-radio-group": "1.2.2",
"@radix-ui/react-scroll-area": "1.2.2",
"@radix-ui/react-select": "2.1.4",
"@radix-ui/react-separator": "1.1.1",
"@radix-ui/react-slider": "1.2.2",
"@radix-ui/react-slot": "1.1.1",
"@radix-ui/react-switch": "1.1.2",
"@radix-ui/react-tabs": "1.1.2",
"@radix-ui/react-toast": "1.2.4",
"@radix-ui/react-toggle": "1.1.1",
"@radix-ui/react-toggle-group": "1.1.1",
"@radix-ui/react-tooltip": "1.1.6",
"@testing-library/dom": "^10.4.1",
"@vercel/analytics": "latest",
"autoprefixer": "^10.4.20",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cmdk": "1.0.4",
"date-fns": "4.1.0",
"embla-carousel-react": "8.5.1",
"html-to-image": "^1.11.13",
"immer": "latest",
"input-otp": "1.4.1",
"jspdf": "^4.2.1",
"lucide-react": "^0.454.0",
"next": "16.0.7",
"next-intl": "^4.9.0",
"next-themes": "^0.4.6",
"qr-code-styling": "^1.9.2",
"react": "19.2.0",
"react-day-picker": "9.8.0",
"react-dom": "19.2.0",
"react-hook-form": "^7.60.0",
"react-resizable-panels": "^2.1.7",
"recharts": "2.15.4",
"sonner": "^1.7.4",
"tailwind-merge": "^2.5.5",
"tailwindcss-animate": "^1.0.7",
"use-sync-external-store": "latest",
"vaul": "^1.1.2",
"zod": "3.25.76",
"zustand": "latest"
},
"devDependencies": {
"@eslint/eslintrc": "^3",
"@playwright/test": "^1.57.0",
"@tailwindcss/postcss": "^4.1.9",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.1",
"@testing-library/user-event": "^14.5.1",
"@types/jest": "^29.5.11",
"@types/node": "^22",
"@types/react": "^19",
"@types/react-dom": "^19",
"concurrently": "^9.2.1",
"eslint": "^9",
"eslint-config-next": "^15",
"eslint-plugin-react-hooks": "^5",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"playwright": "^1.57.0",
"postcss": "^8.5",
"tailwindcss": "^4.1.9",
"ts-node": "^10.9.2",
"tw-animate-css": "1.3.3",
"typescript": "^5"
}
}