73d7da440f
Two related gaps surfaced from "uploaded a track, nothing changed / no status": - A track could stay stuck on `pending` forever (an unexpected worker error rolled back the run without recording anything), and `failed` carried no reason. Add `tracks.metadata_error` + `tracks.enriched_at` (migration), stamp the outcome in apply_enrichment, add TrackRepository.mark_enrichment_failed, wrap enrich_task to persist crashes as `failed` in a fresh session, and emit a human-readable no-match reason. Expose metadata_error/enriched_at in TrackOut. - The tag-first merge let junk embedded tags (e.g. "Music Track"/"Sound_13958") override even a 0.99-confidence AcoustID match. Add acoustid_trust_score (default 0.85): above it the acoustic identity wins for title/artist/album/ year, tags are fallback; below it, tag-first as before. Add a license-free real-file fixture (Scarlet Fire / Otis McDonald) whose junk tags AcoustID overrides, with an always-on tag-reader test plus fpcalc/AcoustID/ network-gated identity + full-pipeline tests (skip on host, run in the container). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
"""tracks: enrichment outcome (error reason + completion time)
|
|
|
|
Revision ID: 20260613_enrich_outcome
|
|
Revises: 20260608_subsonic_pw
|
|
Create Date: 2026-06-13 13:00:00.000000
|
|
|
|
Adds ``tracks.metadata_error`` and ``tracks.enriched_at`` so a finished
|
|
enrichment run records *why* it failed and *when* it completed. Lets the UI
|
|
distinguish a still-pending/running track from one that is done or failed, and
|
|
surface an actionable reason instead of a silent spinner (plan §6.2).
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from collections.abc import Sequence
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision: str = "20260613_enrich_outcome"
|
|
down_revision: str | None = "20260608_subsonic_pw"
|
|
branch_labels: str | Sequence[str] | None = None
|
|
depends_on: str | Sequence[str] | None = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.add_column(
|
|
"tracks",
|
|
sa.Column("metadata_error", sa.String(length=2048), nullable=True),
|
|
)
|
|
op.add_column(
|
|
"tracks",
|
|
sa.Column("enriched_at", sa.DateTime(timezone=True), nullable=True),
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_column("tracks", "enriched_at")
|
|
op.drop_column("tracks", "metadata_error")
|