feat(dot_alfred/v2): bump SCHEMA_VERSION to 2 — added_at on MovieRelease

Phase 3 prep: Movie aggregate is about to become TMDB-only (no
filesystem fields). added_at is a release-time observation, not a
TMDB-aggregate concern, so it moves to MovieRelease +
MovieReleaseSidecar.

- Add added_at: datetime (required) to MovieRelease with a
  type-check in __post_init__.
- Add added_at: datetime (required) to MovieReleaseSidecar.
- Bump SCHEMA_VERSION 1 → 2 with a version-history note.
- Bridge round-trips added_at via Pydantic mode="json" (datetime
  → ISO 8601 string).
- Tests: update MovieRelease fixtures, add a validator test, add
  an added_at round-trip test, switch hard-coded `1` assertions
  to SCHEMA_VERSION for future-proofing.

No v1 sidecars in the wild yet — no migration code needed.
This commit is contained in:
2026-05-25 19:47:25 +02:00
parent e65c1df229
commit 2f160644da
6 changed files with 57 additions and 3 deletions
+18
View File
@@ -1,6 +1,7 @@
"""Tests for the releases domain entities."""
import dataclasses
from datetime import UTC, datetime
import pytest
@@ -17,6 +18,8 @@ from alfred.domain.shared.media import AudioTrack, SubtitleTrack
from alfred.domain.shared.value_objects import FilePath, ImdbId, TmdbId
from alfred.domain.tv_shows.value_objects import EpisodeNumber, SeasonNumber
_ADDED_AT = datetime(2026, 5, 25, 8, 30, 0, tzinfo=UTC)
# ---------------------------------------------------------------------------
# Helpers
@@ -238,9 +241,11 @@ class TestMovieRelease:
imdb_id=ImdbId("tt1375666"),
folder="Inception.2010.1080p.BluRay.x264-GROUP",
file_path=FilePath("Inception.2010.1080p.BluRay.x264-GROUP.mkv"),
added_at=_ADDED_AT,
)
assert m.tmdb_id == TmdbId(27205)
assert m.imdb_id == ImdbId("tt1375666")
assert m.added_at == _ADDED_AT
def test_optional_imdb(self):
m = MovieRelease(
@@ -248,6 +253,7 @@ class TestMovieRelease:
imdb_id=None,
folder="X",
file_path=FilePath("x.mkv"),
added_at=_ADDED_AT,
)
assert m.imdb_id is None
@@ -258,6 +264,7 @@ class TestMovieRelease:
imdb_id=None,
folder="X",
file_path=FilePath("x.mkv"),
added_at=_ADDED_AT,
)
def test_folder_must_be_non_empty(self):
@@ -267,4 +274,15 @@ class TestMovieRelease:
imdb_id=None,
folder="",
file_path=FilePath("x.mkv"),
added_at=_ADDED_AT,
)
def test_added_at_must_be_datetime(self):
with pytest.raises(ValidationError):
MovieRelease(
tmdb_id=TmdbId(27205),
imdb_id=None,
folder="X",
file_path=FilePath("x.mkv"),
added_at="2026-05-25", # type: ignore[arg-type]
)