Repository navigation
fix(catalog): project air_timezone in episode catalog subquery - #24
Conversation
episodeCatalogSelectBody is the derived "mi" relation that episode catalog
hydration and preview read qualifiedListItemColumns("mi") from. The local
episode airtimes feature (fb10bde) added air_timezone to the shared column
lists but not to this hand-written subquery, so the outer projection
referenced mi.air_timezone, which the subquery never exposed.
Postgres returns SQLSTATE 42703 (undefined_column), which is not one of the
codes episodeCatalogEntriesUnavailable treats as "fast path unavailable" (it
only catches 42P01/42883), so episode catalog requests failed with HTTP 500
instead of degrading. movie and series scopes query media_items directly, so
the column is present there and only episode scope broke.
Add si.air_timezone to the subquery, and add a regression test asserting that
episodeCatalogSelectBody exposes every column qualifiedListItemColumns reads
off mi, so future additions to the shared column lists cannot silently drift
from the episode read model again.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Caution Review failedPull request was closed or merged during review No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR adds ChangesEpisode Catalog Timezone Column
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
…mpson-b2843d fix(catalog): project air_timezone in episode catalog subquery
fix(catalog): project air_timezone in episode catalog subquery
Problem
GET /api/v1/catalog?source=query&type=episode&...returns HTTP 500 (Failed to resolve catalog) on dev, whilemovieandseriesscopes return 200.Server log:
Root cause
Episode catalog hydration/preview run
SELECT qualifiedListItemColumns("mi") FROM (episodeCatalogSelectBody) mi, wheremiis a hand-written subquery rather than the physicalmedia_itemstable.fb10bde0 feat(calendar): show local episode airtimesaddedair_timezoneto the shared column lists (itemColumns,qualifiedListItemColumns, the upsert) but did not add it toepisodeCatalogSelectBody. The outer projection then referencedmi.air_timezone, which the subquery never projected → Postgres42703.42703is not one of the codesepisodeCatalogEntriesUnavailabletreats as "fast path unavailable" (it only catches42P01/42883), so the request errored with a 500 instead of degrading.movie/seriesquerymedia_itemsdirectly, so the column is present for them and onlyepisodescope broke. Theair_timezonecolumn itself exists in the DB (migration162) — this was purely a code-level column-list mismatch, not a missing migration.Fix
si.air_timezoneinepisodeCatalogSelectBody(internal/catalog/episode_catalog_source.go).internal/catalog/episode_catalog_select_body_test.go: asserts the episode subquery exposes every columnqualifiedListItemColumns("mi")reads offmi, so this drift (now the secondair_*instance) fails at test time instead of in production.Verification
[air_timezone]) and passes after the fix.go build ./internal/catalog/clean; fullgo test ./internal/catalog/green;gofmt/go vetclean.qualifiedListItemColumns/qualifiedItemColumnscallers (favorites, item_repo) use the physicalmedia_itemstable, so no other hydration site has the same gap.Go-only change; no web or migration changes.
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Tests