Skip to content

Verse4Verse core loop plan (FLT-281)

Revised 2026-11-04 after an Elephant Goldfish review run by hand: Clahadore wrote the spec with full context, then Susie, Jenny, Cedric and Gronktayvius each reviewed it alone. No vetoes. Andrew's words and decisions are in docs/REQUIREMENTS.md (R-143 to R-147); where this differs from them, they win.

The loop

Lyrics on screen, line by line. Verses on lines. A study from a song's verses. A longer study from an album or playlist. Podcasts and sermons linked by shared verse or artist.

Rules the review added

  1. Public routes only read stored rows. No model call or embedding on a request. All generation runs offline on our machines and publishes results.
  2. One publish filter. A public read requires: current version, not taken down, content check passed. Studies use the same filter through their song or collection ID.
  3. Everything public from AI or the web gets the hard-rule check, failing closed. "Jesus is love, love thy neighbor" applies to lyrics found online, AI verse proposals and generated studies, not only sermons. Embedding search on words like fire, blood or wrath will surface harsh verses out of context, so a model check must remove those. An error or timeout leaves the row unpublished.
  4. Lyrics and transcripts are data, never instructions. The generating worker has no tools, returns structured output, and can only cite verses that exist in our Bible tables.
  5. The takedown control ships with lyrics, not later. It's staff-only, audited, beats every source including artist-final, and hides the song's lyrics, annotations and studies. Its state lives outside any database file we swap, so a swap or restore can't bring hidden lyrics back.

Data

  • Two databases. A read-only snapshot, v4v_snapshot.duckdb (songs, lyrics, AI annotations, generated studies), built offline and swapped in. A small mutable live_state.duckdb attached beside it (takedowns, later votes and suggestions). Don't name a file after a schema: DuckDB names a database after its file, so catalog.duckdb fails with an ambiguous reference to the catalog schema.
  • Lyrics: LyricVersion; LyricLine with a lineAnchorId and change state; LineAnchor with last text, last index and last version.
  • Aligning versions: sequence alignment, so repeated choruses keep their own positions. A line that can't be matched confidently gets a new anchor, and its annotations are unpublished until re-approved, so a verse never silently endorses changed words.
  • Separate scores: recording match, lyric provenance (including human vs automatic captions), transcription confidence, verse relevance. A confident transcription of the wrong recording must not read as confident. A similarity score is labelled a ranking score unless calibrated.
  • Trust ladder: artist, found, user, AI. One writer changes the current version, in one transaction with the rank check. Within a level, a new version needs materially higher confidence. Found text from open sources can be poisoned, so it's checked before it goes current, and staff can replace it.
  • Verses: canonical integer IDs BBCCCVVV for start and end, with display text only at presentation.
  • Studies: Study plus StudySection, storing target, source lyric versions, annotation IDs, generation config and collection snapshot. Every study must end in a Live It action.
  • Songs: a canonical songId with an alias table from itunesTrackId, so duplicate releases share one set of lyrics.

Lyrics pipeline, in Andrew's order

  1. APIs and online: LRCLIB first, trying its published database dump if confirmed to exist, since local matching would avoid 88,811 live requests. Then other APIs whose docs and cost check out. Then scraping. Respect rate limits; no bypassing CAPTCHAs or bot detection. The scraper holds no cloud credentials and fetches only allowlisted HTTPS hosts.
  2. TextHarvest: YouTube captions, distinguishing human from automatic, stripping tags like [Music], with confidence scored partly by coverage of the song's duration.
  3. GPUs: transcription on the 4090 and 3080s. Blocked until Andrew decides how audio is obtained.

  4. Job states: HarvestJob with pending, found, instrumental, not found, retryable error, plus attempts and next retry. A transient error is never counted as missing, or the GPU queue fills with songs that already have lyrics online. The 154 errors of 300 in the LRCLIB sample must be diagnosed first.

  5. Publishing: the fleet writes to a local staging store and publishes by snapshot. The VM's database port is never opened to workers.
  6. Priority: songs with a YouTube match first, then by artist size in the catalog.

Build order

  1. Deploy the reader stack (below).
  2. First slice: the keep-list songs we already have lyrics for (about 291 to 364 of the 601 lyric files match the keep list; the rest are dropped unless verified Christian), in the new data model, shown line by line with the takedown control and publish filter. Don't wait for full coverage; refresh snapshots as coverage grows.
  3. AI verse proposals on those lines: precomputed offline, hard-rule checked, labelled AI, with a reviewed evaluation set for relevance.
  4. Generated song studies, then album studies, precomputed. Playlist studies are assembled from existing song studies with no live model call until accounts exist.
  5. Accounts, after a security review: votes, artist portal and lyric sheets, user suggestions.
  6. Podcasts and sermons: first version stores verse references plus an outbound link or embed, with no transcript text in the app. Fail-closed pre-scan.
  7. Coverage grows in the background from step 2 onward.

Deploy

Stage 0: merge PR #21; bring the stack up to date; all checks green, reading logs for any failure; compare the live image with what's going out; merge in order; confirm master is green.

Stage 1 (reader, no data changes): scripts/deploy-app.ps1 -NoTraffic to a tagged candidate. Test both Bibles, a Bible Brain translation, Compare, Discover, studies, the empty song list and CORS. Move traffic, run scripted requests at every feature, remove the tag, and write the ledger entry. Rollback is update-traffic to 00008-hkz.

Stage 2 (songs and lyrics): - Declare v4v-migrate and v4v-import in CDK Terrain first. - Build on a copy, off the VM, with indexes and physical sort order applied there, never over Quack. - Automatic gates refuse the swap unless WEB is 38,029, BSB is 31,086, songs are above zero and unapproved is zero. Measure a representative read through the real provider and Quack before committing. - A rehearsed swap: stop writers, stop database access, validate, replace, reopen, smoke test. Pair each app revision with its compatible snapshot. Keep backups in a private bucket with checksums.

After any cloud change: ledger entry, drift check, and the change in cost per user.

Open decisions for Andrew

  • GPU audio source. Transcription needs audio files, and downloading from YouTube may breach its terms.
  • Branch protection on master. Reviewers want it before the merges. GitHub refuses it on this private repo without a paid plan, so it's a money decision. Until then, checks are enforced by hand.
  • Theology review for anything promoted from AI draft to editorial.

Set aside for now, on purpose

Offline Capacitor caching, virtualized lists, WCAG audit, CSRF proof, mutation testing of the gates, and concurrency load tests. They matter once there are users and writes. None of them should delay a person seeing lyrics with verses on them.