Commit Graph
3 Commits
Author SHA1 Message Date
NixReaperandClaude Sonnet 5 0a50e0ffb6 Fix two more test bugs surfaced by the full integration run
CI / lint (push) Canceled after 0s
CI / typecheck (push) Canceled after 0s
CI / unit-tests (push) Canceled after 0s
CI / integration-tests (push) Canceled after 0s
CI / container-build (push) Canceled after 0s
CI / dependency-audit (push) Canceled after 0s
1. test_ingestion_cache_invalidation.py: the job was created through
   the test's db_session fixture, whose commit() only ends a savepoint
   that gets rolled back at teardown (see tests/conftest.py) -- it's
   never a real commit. _run_ingestion looks the job up through its
   own session_scope() (a genuinely separate connection), which could
   never see it, so the very first _require_job call raised "job
   vanished mid-run" every time. Worse, test_failed_ingestion_does_not_
   invalidate_the_cache still passed, coincidentally -- it expected a
   RuntimeError and got one, just the wrong one, masking the bug.
   Fixed by having _make_job create the job through session_scope()
   itself, matching test_ingestion_retry.py's existing pattern.

2. Same class of bug as the video-collision fix in the last commit:
   FAKE_MOVIE's fixed imdb_id ("tt0133093"), not just its video, also
   collides across two different fake movies sharing it unmodified --
   uq_external_id_source is a real unique constraint on
   (provider_id, entity_type, external_id). Fixed by also overriding
   imdb_id on the second movie in both affected tests.

All caught by running the actual integration suite against Postgres --
these paths were previously only collect-only'd locally (no local DB).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-05 20:17:02 -05:00
NixReaperandClaude Sonnet 5 29fffc8919 Fix test fixtures: two movies can't share FAKE_MOVIE's embedded video
CI / lint (push) Canceled after 0s
CI / typecheck (push) Canceled after 0s
CI / unit-tests (push) Canceled after 0s
CI / integration-tests (push) Canceled after 0s
CI / container-build (push) Canceled after 0s
CI / dependency-audit (push) Canceled after 0s
FAKE_MOVIE carries a fixed provider_video_id ("abc123"); two different
fake movies both spreading it unmodified and getting ingested in the
same test collide on the real uq_video_provider_source unique
constraint (a video id belongs to exactly one entity). Found by
actually running the tests against Postgres on the devbox -- these
paths were only ever collect-only'd locally before now (no local DB).

Affected: test_movie_recommendations_only_include_already_ingested_movies
and test_ingest_collection_only_links_already_ingested_movies, both of
which ingest two FAKE_MOVIE-derived movies in one test. Fixed by
overriding videos to empty on the second movie in each.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-05 20:12:03 -05:00
NixReaperandClaude Sonnet 5 892f78016c Add collection/franchise ingestion
CI / lint (push) Canceled after 0s
CI / typecheck (push) Canceled after 0s
CI / unit-tests (push) Canceled after 0s
CI / integration-tests (push) Canceled after 0s
CI / container-build (push) Canceled after 0s
CI / dependency-audit (push) Canceled after 0s
Collections were bare stubs (name only) lazily created the moment a
movie's belongs_to_collection reference was seen. Adds a real
ingest_collection pipeline: TMDb's /collection/{id} for overview and
poster/backdrop artwork, plus ordered CollectionMovie membership --
linking only movies already ingested into Aurora, the same
never-fabricate-a-stub rule movie recommendations already follow.

get_or_create_collection now refreshes name/overview on an existing
stub instead of only creating, guarded so a bare movie-stub call
(overview=None) never clobbers real data a full ingestion already
filled in.

New POST /api/v1/admin/ingest/collection endpoint and
ingest_collection_task; GET /api/v1/collections/{id} needed no changes
since its read path (collection_service.py) already assembled the full
detail shape.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-05 08:37:27 -05:00