feat: separate live and vod quality for watched channels#1203
Conversation
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughThis PR adds a separate ChangesAdd VOD Resolution Configuration Field
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/docs.go`:
- Around line 5853-5865: The docs' vod_resolution enum in docs.go doesn't match
the backend utils.VodQuality contract: update the enum values used by
vod_resolution to exactly match utils.VodQuality (use numeric strings like
"1440", "1080", "720", "480", "360", "160", plus "best", "audio", and include
"source") and make the same change in the second occurrence (the block
referenced around the second location). Edit the vod_resolution enums in docs.go
so they align with the utils.VodQuality symbol values used by the backend to
avoid request/validation mismatches.
In `@internal/database/database.go`:
- Around line 101-109: The current migration adds vod_resolution with DEFAULT
"best" so backfillLiveVodResolution never matches; either (A) change the
migration path: add the vod_resolution column without a DEFAULT, run
backfillLiveVodResolution to set vod_resolution = resolution for existing rows,
then ALTER the column to set DEFAULT 'best' for future inserts (locate the logic
around client.Schema.Create and ent/schema/live.go/ent/migrate/schema.go to
implement this), or (B) change backfillLiveVodResolution to treat the existing
DEFAULT value as a placeholder by updating rows where vod_resolution IS NULL OR
vod_resolution = '' OR vod_resolution = 'best' to vod_resolution = resolution;
also ensure columnExists properly propagates errors (it should return false on
error) so the backfill runs when appropriate.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: fb1348d3-5244-4615-ac7a-f62c134ed9cc
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (22)
docs/docs.godocs/swagger.jsondocs/swagger.yamlent/live.goent/live/live.goent/live/where.goent/live_create.goent/live_update.goent/migrate/schema.goent/mutation.goent/runtime.goent/schema/live.gofrontend/app/components/admin/watched/DrawerContent.tsxfrontend/app/hooks/useWatchedChannels.tsfrontend/messages/de.jsonfrontend/messages/en.jsonfrontend/messages/uk.jsoninternal/database/database.gointernal/live/clip.gointernal/live/live.gointernal/live/vod.gointernal/transport/http/live.go
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/database/database.go (1)
183-183: ⚡ Quick winError-handling tradeoff noted: consider retry or fail-loud on persistent errors.
Returning
falseon error prioritizes correctness on first boot (when the column doesn't exist and the backfill is required) over safety on subsequent boots (if the check transiently fails when the column already exists, the backfill runs again and could overwrite rows where users explicitly setvod_resolution = 'best').For a one-time migration this is reasonable—the warning log provides operator visibility, and transient failures on later boots are rare. However, for additional resilience, consider:
- Retrying the query a few times before returning
false, or- Logging at Error level and treating persistent query failure as a fatal migration precondition (since we can't safely decide whether to backfill without knowing the column state).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/database/database.go` at line 183, The code that checks whether the vod_resolution column exists (the function that currently returns false on query error in internal/database/database.go) should not silently treat a query error as “no column”; either implement a small retry loop (e.g., 3 attempts with short backoff) around the existence query and only return false after retries fail, or escalate on persistent failure by logging at Error level and returning an explicit fatal error instead of false so callers can abort the migration/backfill; update the function handling the vod_resolution existence check to perform retries or return an error, and ensure callers adjust to handle the error path accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@internal/database/database.go`:
- Line 183: The code that checks whether the vod_resolution column exists (the
function that currently returns false on query error in
internal/database/database.go) should not silently treat a query error as “no
column”; either implement a small retry loop (e.g., 3 attempts with short
backoff) around the existence query and only return false after retries fail, or
escalate on persistent failure by logging at Error level and returning an
explicit fatal error instead of false so callers can abort the
migration/backfill; update the function handling the vod_resolution existence
check to perform retries or return an error, and ensure callers adjust to handle
the error path accordingly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: bc6e48b9-2c5b-46c3-a2a9-0e5bc551525b
📒 Files selected for processing (2)
docs/docs.gointernal/database/database.go
✅ Files skipped from review due to trivial changes (1)
- docs/docs.go
Closes #1190
Adds a separate quality for live and vod/video archives in watched channels. Live quality is backfilled on first run.