refactor: DLO-16/17/18/20 — CLI simplification, config Pydantic, planner split, type system unification
DLO-16: Reduce cli.py from 1073 to 83 lines by registering Click commands from commands/*.py modules DLO-17: Migrate Config to Pydantic BaseModel for validation DLO-18: Split planner.py (826 lines) into orchestration, path rendering, and duplicate handling modules DLO-20: Unify type system — convert 14 dataclasses to Pydantic BaseModel, keep TypedDicts as JSON schema hints Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.5
parent
8a60aaf9a9
commit
fe03a31dd4
@@ -38,9 +38,10 @@ def test_enrich_incremental_cache_hit(tmp_path, monkeypatch):
|
||||
config = Config(
|
||||
library_root=tmp_path,
|
||||
enrichment_cache_db=tmp_path / "cache.db",
|
||||
enrichment_providers=["dummy"],
|
||||
enrichment_providers=["tmdb"],
|
||||
translation_fallback_machine=False,
|
||||
)
|
||||
config.enrichment_providers = ["dummy"]
|
||||
|
||||
provider = DummyProvider()
|
||||
monkeypatch.setattr(
|
||||
@@ -104,11 +105,12 @@ def test_enrich_flags_low_reputation_for_review(tmp_path, monkeypatch):
|
||||
config = Config(
|
||||
library_root=tmp_path,
|
||||
enrichment_cache_db=tmp_path / "cache.db",
|
||||
enrichment_providers=["dummy"],
|
||||
enrichment_providers=["tmdb"],
|
||||
translation_fallback_machine=False,
|
||||
reputation_low_score_threshold=6.0,
|
||||
reputation_min_votes=50,
|
||||
)
|
||||
config.enrichment_providers = ["dummy"]
|
||||
|
||||
provider = LowScoreProvider()
|
||||
monkeypatch.setattr(
|
||||
@@ -144,9 +146,10 @@ def test_enrich_refresh_all_bypasses_cache(tmp_path, monkeypatch):
|
||||
config = Config(
|
||||
library_root=tmp_path,
|
||||
enrichment_cache_db=tmp_path / "cache.db",
|
||||
enrichment_providers=["dummy"],
|
||||
enrichment_providers=["tmdb"],
|
||||
translation_fallback_machine=False,
|
||||
)
|
||||
config.enrichment_providers = ["dummy"]
|
||||
|
||||
provider = DummyProvider()
|
||||
monkeypatch.setattr(
|
||||
@@ -184,8 +187,9 @@ def test_build_providers_rejects_unknown_provider(tmp_path):
|
||||
"""Unknown providers should fail fast with a clear error."""
|
||||
config = Config(
|
||||
library_root=tmp_path,
|
||||
enrichment_providers=["tmdb", "tmdb_typo"],
|
||||
enrichment_providers=["tmdb"],
|
||||
)
|
||||
config.enrichment_providers = ["tmdb", "tmdb_typo"]
|
||||
|
||||
with pytest.raises(ValueError, match="Unsupported enrichment providers"):
|
||||
_build_providers(config, request_timeout=3, retries=1, rate_limiter=RequestRateLimiter(0.25))
|
||||
@@ -220,9 +224,10 @@ def test_refresh_all_clears_stale_enrichment_fields(tmp_path, monkeypatch):
|
||||
config = Config(
|
||||
library_root=tmp_path,
|
||||
enrichment_cache_db=tmp_path / "cache.db",
|
||||
enrichment_providers=["dummy"],
|
||||
enrichment_providers=["tmdb"],
|
||||
translation_fallback_machine=False,
|
||||
)
|
||||
config.enrichment_providers = ["dummy"]
|
||||
|
||||
provider = FlakyProvider()
|
||||
monkeypatch.setattr(
|
||||
@@ -361,10 +366,11 @@ def test_enrich_respects_max_concurrency_for_uncached_records(tmp_path, monkeypa
|
||||
config = Config(
|
||||
library_root=tmp_path,
|
||||
enrichment_cache_db=tmp_path / "cache.db",
|
||||
enrichment_providers=["dummy"],
|
||||
enrichment_providers=["tmdb"],
|
||||
translation_fallback_machine=False,
|
||||
enrichment_max_concurrency=4,
|
||||
)
|
||||
config.enrichment_providers = ["dummy"]
|
||||
|
||||
identities = {
|
||||
"metadata": {},
|
||||
|
||||
Reference in New Issue
Block a user