fix(rec): preserve enriched metadata + enrich source & library rows #14

Merged
aureus merged 2 commits from fix/tmdb-metadata-enrichment into main 2026-05-26 05:08:33 +00:00
Owner

Three bugs in TMDB metadata population were causing cards to render with
NULL director/cast/genres/runtime in production:

  1. upsertRecsAndMetadata wiped already-enriched recs to NULL on every
    30-day refresh. The merge() upserted every rec with details=undefined
    for ones it had skipped fetching. Now split into "full" rows (merge
    all columns) and "thin" rows (merge only the columns we always have
    from the recommendations payload).

  2. Source rows (the rated item itself) only ever got a sparse stub from
    library data and were never enriched. New enrichSourceRow helper
    fetches details for the source and upgrades pre-existing sparse rows.

  3. Unrated library items had no enrichment path at all — they only got
    rich metadata if they happened to be recommended from someone else's
    rating. Added a second work type to the TMDB worker that finds
    library.tmdb_ids whose media_metadata is missing or has genres NULL,
    and enriches them via the new enrichLibraryItem.

202 tests passing (was 184). New integration tests cover all three
paths plus the worker loader filter.

Three bugs in TMDB metadata population were causing cards to render with NULL director/cast/genres/runtime in production: 1. upsertRecsAndMetadata wiped already-enriched recs to NULL on every 30-day refresh. The merge() upserted every rec with details=undefined for ones it had skipped fetching. Now split into "full" rows (merge all columns) and "thin" rows (merge only the columns we always have from the recommendations payload). 2. Source rows (the rated item itself) only ever got a sparse stub from library data and were never enriched. New enrichSourceRow helper fetches details for the source and upgrades pre-existing sparse rows. 3. Unrated library items had no enrichment path at all — they only got rich metadata if they happened to be recommended from someone else's rating. Added a second work type to the TMDB worker that finds library.tmdb_ids whose media_metadata is missing or has genres NULL, and enriches them via the new enrichLibraryItem. 202 tests passing (was 184). New integration tests cover all three paths plus the worker loader filter.
fix(rec): preserve enriched metadata + enrich source & library rows
Some checks failed
PR Checks / test (pull_request) Failing after 3m32s
47b0e19856
Three bugs in TMDB metadata population were causing cards to render with
NULL director/cast/genres/runtime in production:

1. upsertRecsAndMetadata wiped already-enriched recs to NULL on every
   30-day refresh. The merge() upserted every rec with details=undefined
   for ones it had skipped fetching. Now split into "full" rows (merge
   all columns) and "thin" rows (merge only the columns we always have
   from the recommendations payload).

2. Source rows (the rated item itself) only ever got a sparse stub from
   library data and were never enriched. New enrichSourceRow helper
   fetches details for the source and upgrades pre-existing sparse rows.

3. Unrated library items had no enrichment path at all — they only got
   rich metadata if they happened to be recommended from someone else's
   rating. Added a second work type to the TMDB worker that finds
   library.tmdb_ids whose media_metadata is missing or has genres NULL,
   and enriches them via the new enrichLibraryItem.

202 tests passing (was 184). New integration tests cover all three
paths plus the worker loader filter.
fix(rec): use db.fn.now() so MariaDB strict mode accepts the insert
All checks were successful
PR Checks / test (pull_request) Successful in 4m54s
f6b8183653
MariaDB DATETIME columns in strict mode reject ISO timestamp strings
(...T...Z); the new tests in rec-enrichment.test.ts were the first to
exercise these inserts under MariaDB and caught it. db.fn.now() expands
to NOW() / CURRENT_TIMESTAMP per dialect — works on SQLite, Postgres,
and MariaDB without any per-driver special casing.

Verified: 202 SQLite, 112 Postgres, 112 MariaDB.
aureus force-pushed fix/tmdb-metadata-enrichment from f6b8183653
All checks were successful
PR Checks / test (pull_request) Successful in 4m54s
to 2a1178e806
All checks were successful
PR Checks / test (pull_request) Successful in 4m33s
2026-05-26 05:01:54 +00:00
Compare
aureus merged commit df45bf70ce into main 2026-05-26 05:08:33 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
aureus/watchcraft!14
No description provided.