Sangeetha-Grantha

Metadata Value
Status Completed
Version 1.0.0
Last Updated 2026-03-15
Author Sangeetha Grantha Team

Goal

Fix the lyric variant persistence pipeline so that krithis imported via the Python extraction worker (CanonicalExtractionDto format) have their lyrics, sections, and lyric sections saved to the database. Backfill the 67 already-approved krithis from TRACK-093 that were approved with zero lyrics persisted.

Root Cause — Pipeline Format Schism

A classic integration seam failure where two pipeline stages each worked correctly in isolation but the handoff between them was never tested end-to-end.

Format Producer Consumer Status
ScrapedKrithiMetadata Legacy Kotlin scraper (WebScrapingService) LyricVariantPersistenceService Only format it understood
CanonicalExtractionDto Python extraction worker (structure_parser.py) ExtractionResultProcessor What’s actually stored in parsed_payload

The Python pipeline was built in TRACK-041+ to produce CanonicalExtractionDto, and ExtractionResultProcessor.enrichExistingImport() stores it in imported_krithis.parsed_payload. But LyricVariantPersistenceService was never updated to read it — it only knew ScrapedKrithiMetadata. The deserialization mismatch was swallowed by a catch(e) { println(...) } block, producing zero user-visible errors while silently skipping all lyric/section persistence.

Why it was invisible

  1. Silent catch: catch (e: Exception) { println("Error processing scraped metadata: ${e.message}") } — no logger, no API error, no status change
  2. No assertion at approval time: The approval endpoint returns success regardless of whether lyrics were persisted
  3. No integration test: Each component (extraction, enrichment, approval, persistence) was tested in isolation but never as a connected pipeline
  4. UI showed success: The Curator Review page showed “Approved” status with no indication that lyrics were missing

Implementation Plan

Files Changed

File Change
modules/backend/api/.../services/LyricVariantPersistenceService.kt Dual-format detection, persistFromCanonical(), proper logging
modules/backend/api/.../routes/ImportRoutes.kt Backfill endpoint (pending)

Notes

Ref: application_documentation/10-implementations/track-094-lyric-persistence-fix-backfill.md