diff --git a/tests/test_importer.py b/tests/test_importer.py index 63f57cf..a72f522 100644 --- a/tests/test_importer.py +++ b/tests/test_importer.py @@ -11,7 +11,7 @@ import pytest from PIL import Image from sqlalchemy import select -from backend.app.models import Artist, ImageRecord, ImportSettings, Tag, TagKind +from backend.app.models import Artist, ImageRecord, ImportSettings from backend.app.services.importer import Importer, SkipReason from backend.app.services.thumbnailer import Thumbnailer @@ -62,21 +62,22 @@ def test_import_one_happy_path(importer, import_layout): assert record.path.endswith(".jpg") -def test_folder_creates_artist_and_tag(importer, import_layout): +def test_folder_creates_artist_and_links_artist_id(importer, import_layout): + # FC-2d-vii-c: folder import creates the Artist and sets the canonical + # image_record.artist_id — no artist-kind Tag (that path was retired; + # the no-tag invariant is covered by test_importer_artist_id.py). import_root, _ = import_layout src = import_root / "Alice" / "first.jpg" _make_jpeg(src) - importer.import_one(src) + result = importer.import_one(src) artist = importer.session.execute( select(Artist).where(Artist.slug == "alice") ).scalar_one() assert artist.name == "Alice" - tag = importer.session.execute( - select(Tag).where(Tag.name == "Alice").where(Tag.kind == TagKind.artist) - ).scalar_one() - assert tag.id is not None + record = importer.session.get(ImageRecord, result.image_id) + assert record.artist_id == artist.id def test_dedup_by_hash(importer, import_layout): diff --git a/tests/test_ml_tagger.py b/tests/test_ml_tagger.py index e60237d..79cfe51 100644 --- a/tests/test_ml_tagger.py +++ b/tests/test_ml_tagger.py @@ -17,7 +17,10 @@ from backend.app.services.ml.tagger import ( def test_surfaced_categories(): - assert SURFACED_CATEGORIES == {"artist", "character", "copyright", "general"} + # FC-2d-vii-c: 'artist' retired — artist identity is acquisition-derived + # (image_record.artist_id), never ML-inferred. + assert SURFACED_CATEGORIES == {"character", "copyright", "general"} + assert "artist" not in SURFACED_CATEGORIES def test_store_floor_is_low():