#69

feat(lyrics): add optional AI word sync via lrc.red

OpenJustMarkDevwants to merge intofrom

Summary

  • Add opt-in Settings → Sync words with AI (off by default) that calls lrc.red POST /s/{isrc}/sync, upgrades lyrics in place, and caches the result.
  • Query lrc.red /match.json with and without duration and merge by ISRC, with primary-artist fallback, so duration weighting does not hide the song.
  • Tighten rank_matches: album only scores title-less hits, require title match unless titles differ in script.
  • Move lyrics cache from localStorage to IndexedDB (10,000 entries) with word-sync-attempt bookkeeping and legacy migration.
  • Document AI sync and cache limits in README.

Testing

  • cargo test lyrics for merge, enhanced-LRC conversion, timestamp rounding, and rank script/album cases — Not run, relies on CI
  • bun test src/lyrics-cache.test.ts src/lyrics.test.ts src/settings.test.ts for persistence, eviction, word-sync flags, and migration — Not run, relies on CI
  • Manual toggle on/off AI sync end-to-end against lrc.red — Not run

Activity

22
opencode-agent[bot]reviewed1mo ago
opencode-agent[bot]reviewed1mo ago
opencode-agent[bot]reviewed1mo ago
opencode-agent[bot]reviewed1mo ago
opencode-agent[bot]reviewed1mo ago
opencode-agent[bot]reviewed1mo ago
opencode-agent[bot]reviewed1mo ago
opencode-agent[bot]1mo ago

Review · 8fa2e09

⚠️ 5 open findings

Adds opt-in AI word sync via lrc.red and moves the lyrics cache to IndexedDB with word-sync bookkeeping. The single biggest risk is syncing or caching the wrong recording when the best match is unsyncable.

Confidence: 2/5 — Two High findings need fixes before merge, but all findings are anchored and verified.

FindingLocation
🆕 🟠 HighWord sync never tries the next-best recordingsrc-tauri/src/lib.rs:2818
🆕 🟠 HighLegacy migration deletes before persistingsrc/lyrics-cache.ts:156
🆕 🟡 MediumCache get can return stale after concurrent putsrc/lyrics-cache.ts:75
🆕 🟡 MediumTitle-less hit bypasses the title requirementsrc-tauri/src/lib.rs:2404
🆕 🔵 LowWord timestamps double-round via millisecondssrc-tauri/src/lib.rs:2734
Prompt for all open findings
  • In src-tauri/src/lib.rs around lines 2643-2828, sync_words only tries the first ISRC while search_lrc_red falls through three candidates, so make sync loop the top three with first-found semantics and return None only when none yield word timing.
  • In src/lyrics-cache.ts around lines 153-167, importLegacyCache removes the legacy key before writes succeed and swallows write errors, so keep the raw value and remove the key only after migrated writes succeed.
  • In src/lyrics-cache.ts around lines 59-78, get reuses a stale entry across an await without revalidation, so re-find after the store read and only touch/return the still-indexed entry.
  • In src-tauri/src/lib.rs around lines 2401-2430, is_none_or lets a missing title pass as script difference, so change to is_some_and to require a present title for the artist-only path.
  • In src-tauri/src/lib.rs around lines 2732-2741, centiseconds round via milliseconds then +5/10, so compute (seconds * 100.0).round().max(0.0) as u64 in one step.
opencode-agent[bot]reviewed1mo ago
opencode-agent[bot]reviewed1mo ago
opencode-agent[bot]reviewed1mo ago
opencode-agent[bot]reviewed1mo ago
opencode-agent[bot]reviewed1mo ago
opencode-agent[bot]reviewed1mo ago
opencode-agent[bot]reviewed1mo ago
opencode-agent[bot]reviewed1mo ago
opencode-agent[bot]reviewed1mo ago
opencode-agent[bot]reviewed1mo ago
opencode-agent[bot]1mo ago

Maximum steps for this agent have been reached.

Review · c507d6d

✅ No blocking issues

Adds opt-in AI word sync via lrc.red and moves the lyrics cache to IndexedDB with word-sync bookkeeping. The single biggest risk — syncing or caching the wrong recording — is now closed by top-three fall-through and strict title ranking.

Confidence: 4/5 — All prior Highs verified fixed with regression tests and prior CI green; head CI still in progress.

FindingLocation
✅ FixedWord sync never tries the next-best recordingsrc-tauri/src/lib.rs:2818
✅ FixedLegacy migration deletes before persistingsrc/lyrics-cache.ts:156
✅ FixedCache get can return stale after concurrent putsrc/lyrics-cache.ts:75
✅ FixedTitle-less hit bypasses the title requirementsrc-tauri/src/lib.rs:2404
✅ FixedWord timestamps double-round via millisecondssrc-tauri/src/lib.rs:2734

Summary of work accomplished so far:

  • Phase 0: Checked CI for head c507d6d — CI workflow still in_progress, prior CI on 8fa2e09 was success. No failed check caused by the diff.
  • Phase 1: Verified all 5 prior bot threads against current code — each failure scenario can no longer happen. Replied ✅ Fixed in c507d6d in each thread and resolved all 5 via GraphQL (all now isResolved: true).
  • Phase 2: Focused on c507d6d vs 8fa2e09 plus full-PR re-check and .github/review-rules/ (ci-release-contract, platform-parity — no violations). Traced sync_words/first_found, importLegacyCache/failedWrites, get/isIndexed, titles_differ_in_script, lrc_timestamp_centis, plus main.ts queue, markWordSyncAttempted, IndexedDB run/open. No new concrete failure scenario survived verification, so no inline review was created per spec.

Remaining tasks not completed:

  • No inline GitHub review to post (zero new findings — correct to skip per Phase 3).
  • Head CI 37834314308 still in progress — not yet confirmed green.
  • Manual end-to-end AI-sync toggle against lrc.red still marked Not run (relies on CI).

Recommendations for next steps:

  • Let head CI finish; if it fails on a check the diff touches, treat as a new finding.
  • No further reviewer action needed unless new commits arrive — next run should focus on diff since c507d6d.

github run