diff --git a/lrx_cli/models.py b/lrx_cli/models.py index 0e7190a..0626d7e 100644 --- a/lrx_cli/models.py +++ b/lrx_cli/models.py @@ -10,6 +10,8 @@ from enum import Enum from typing import Optional, TYPE_CHECKING from dataclasses import dataclass +from lrx_cli.config import SCORE_W_SYNCED + if TYPE_CHECKING: from .lrc import LRCData @@ -67,3 +69,6 @@ class LyricResult: def __post_init__(self) -> None: if self.status in (CacheStatus.NOT_FOUND, CacheStatus.NETWORK_ERROR): self.confidence = 0.0 + if self.status is CacheStatus.SUCCESS_UNSYNCED and self.confidence == 100.0: + # Fix: remove inflated confidence for unsynced results + self.confidence = 100 - SCORE_W_SYNCED diff --git a/tests/test_cache.py b/tests/test_cache.py index 4210f1f..82e3c69 100644 --- a/tests/test_cache.py +++ b/tests/test_cache.py @@ -314,7 +314,7 @@ def test_update_confidence_targets_specific_source(cache_db: CacheEngine) -> Non assert updated == 1 rows = {r["source"]: r for r in cache_db.query_track(track)} assert rows["s1"]["confidence"] == 75.0 - assert rows["s2"]["confidence"] == 100.0 # unchanged + assert rows["s2"]["confidence"] == 90.0 # unchanged (unsynced default) def test_update_confidence_returns_zero_for_missing_source( diff --git a/uv.lock b/uv.lock index 726bf79..c9325ca 100644 --- a/uv.lock +++ b/uv.lock @@ -153,7 +153,7 @@ wheels = [ [[package]] name = "lrx-cli" -version = "0.5.1" +version = "0.5.2" source = { editable = "." } dependencies = [ { name = "cyclopts" },