Fix source-missing auto-merge and remove Pink Floyd examples from prompts
Auto-merge: when ingest pipeline detects "source file missing", now checks if the track already exists in the library by file_hash. If so, marks the pending entry as 'merged' instead of 'error' — avoiding stale error entries for files that were already successfully ingested in a previous run. Prompts: replaced Pink Floyd/The Wall/Have a Cigar examples in both normalize.txt and merge.txt with Deep Purple examples. The LLM was using these famous artist/album/track names as fallback output when raw metadata was empty or ambiguous, causing hallucinated metadata like "artist: Pink Floyd, title: Have a Cigar" for completely unrelated tracks. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -188,8 +188,20 @@ async fn reprocess_pending(state: &Arc<AppState>) -> anyhow::Result<usize> {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tracing::error!(id = %pt.id, "Source file missing: {:?}", source);
|
||||
db::update_pending_status(&state.pool, pt.id, "error", Some("Source file missing")).await?;
|
||||
// Source file is gone — check if already in library by hash
|
||||
let in_library: (bool,) = sqlx::query_as(
|
||||
"SELECT EXISTS(SELECT 1 FROM tracks WHERE file_hash = $1)"
|
||||
)
|
||||
.bind(&pt.file_hash)
|
||||
.fetch_one(&state.pool).await.unwrap_or((false,));
|
||||
|
||||
if in_library.0 {
|
||||
tracing::info!(id = %pt.id, "Source missing but track already in library — merging");
|
||||
db::update_pending_status(&state.pool, pt.id, "merged", None).await?;
|
||||
} else {
|
||||
tracing::error!(id = %pt.id, "Source file missing: {:?}", source);
|
||||
db::update_pending_status(&state.pool, pt.id, "error", Some("Source file missing")).await?;
|
||||
}
|
||||
continue;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user