feat(provenance): ArtistService resolves images via artist_id

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-18 21:34:30 -04:00
parent 914cf14d9e
commit aaf5d1ea70
2 changed files with 26 additions and 14 deletions
+22
View File
@@ -82,3 +82,25 @@ async def test_paged_images(db):
async def test_paged_images_unknown_slug_none(db):
svc = ArtistService(db)
assert await svc.images("ghost", cursor=None, limit=10) is None
@pytest.mark.asyncio
async def test_overview_and_images_include_artist_id_only(db):
# FC-2d-vii-c: a folder-style image has artist_id but no provenance.
a = Artist(name="Solo", slug="solo")
db.add(a)
await db.flush()
rec = ImageRecord(
path="/images/s/1.jpg", sha256="s" + "0" * 63,
size_bytes=1, mime="image/jpeg", width=1, height=1,
origin="imported_filesystem", integrity_status="unknown",
artist_id=a.id,
)
db.add(rec)
await db.flush()
svc = ArtistService(db)
ov = await svc.overview("solo")
assert ov["image_count"] == 1
page = await svc.images("solo", cursor=None, limit=10)
assert [i["id"] for i in page.images] == [rec.id]