Conversation
…missing from dropdown YouTube videos with locale-variant subtitle languages (e.g. en-GB, en-US, pt-BR) were silently dropped from the subtitle dropdown because the backend resolver did exact BCP 47 matching against a Language database that only stores base codes (en, es, pt). - Normalize locale-variant codes to base language (split on hyphen) before querying the Language service, with Set-based deduplication - Relax Zod trackKind validation from enum to string to prevent parse failures on videos with 'forced' caption tracks - Use prefix matching in player-side subtitle activation so stored base code 'en' correctly activates YouTube tracks reported as 'en-GB' - Only activate first matching locale variant to avoid nondeterministic track selection from double setYouTubeCaptionTrack calls Closes NES-958 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
WalkthroughUpdates normalize YouTube subtitle language codes from locale variants (e.g., Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run journeys-e2e:e2e |
❌ Failed | 2m 21s | View ↗ |
☁️ Nx Cloud last updated this comment at 2026-04-23 23:08:21 UTC
|
The latest updates on your projects.
|
|
The latest updates on your projects.
|
|
The latest updates on your projects.
|
|
The latest updates on your projects.
|
|
The latest updates on your projects.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/plans/2026-04-10-001-fix-youtube-subtitle-locale-variants-plan.md`:
- Line 4: The plan header's status currently says "status: completed" but
several implementation units remain unchecked and the "setYouTubeCaptionTrack"
note is outdated; change the top-level status to reflect work-in-progress (e.g.,
"in-progress" or "shipped-with-followups"), update Unit 3 to state that the
exact YouTube languageCode is now passed, and edit the "setYouTubeCaptionTrack"
note to reflect the new behavior; ensure all mentions across the document
(including the referenced ranges) consistently reflect the shipped behavior and
remaining open tasks.
🪄 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: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: d0c52ba2-a8ef-4463-b1df-12261c9a5b87
📒 Files selected for processing (5)
apis/api-media/src/schema/youtube/youtube.spec.tsapis/api-media/src/schema/youtube/youtube.tsdocs/plans/2026-04-10-001-fix-youtube-subtitle-locale-variants-plan.mdlibs/journeys/ui/src/components/Video/utils/extractYouTubeCaptionsAndAddTextTracks/extractYouTubeCaptionsAndAddTextTracks.spec.tslibs/journeys/ui/src/components/Video/utils/extractYouTubeCaptionsAndAddTextTracks/extractYouTubeCaptionsAndAddTextTracks.ts
| --- | ||
| title: 'fix: YouTube subtitle locale variants missing from dropdown' | ||
| type: fix | ||
| status: completed |
There was a problem hiding this comment.
Align the completed plan with the shipped behavior.
status: completed conflicts with the unchecked implementation units, and the setYouTubeCaptionTrack note still says no change is needed even though Unit 3 now describes passing the exact YouTube languageCode. Updating those sections will keep future readers from treating this as still-open work.
Also applies to: 56-66, 70-143, 156-163
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/plans/2026-04-10-001-fix-youtube-subtitle-locale-variants-plan.md` at
line 4, The plan header's status currently says "status: completed" but several
implementation units remain unchecked and the "setYouTubeCaptionTrack" note is
outdated; change the top-level status to reflect work-in-progress (e.g.,
"in-progress" or "shipped-with-followups"), update Unit 3 to state that the
exact YouTube languageCode is now passed, and edit the "setYouTubeCaptionTrack"
note to reflect the new behavior; ensure all mentions across the document
(including the referenced ranges) consistently reflect the shipped behavior and
remaining open tasks.
This comment has been minimized.
This comment has been minimized.
…-language-missing-english-not-showing
…-language-missing-english-not-showing
|
Found 1 test failure on Blacksmith runners: Failure
|

Summary
en-GB,en-US,pt-BR) were silently dropped from the subtitle dropdown because the backend did exact BCP 47 matching against a Language database that only stores base codes (en,es,pt)trackKindvalidation to prevent parse failures on videos withforcedcaption tracksencorrectly activates YouTube tracks reported asen-GBChanges
Backend (
apis/api-media)youtube.ts: Normalize BCP 47 locale variants (en-gb→en) usingsplit('-')[0]before querying language service. Deduplicate withSet. Relax ZodtrackKindfromz.enum(['standard', 'asr'])toz.string().youtube.spec.ts: 3 new tests — locale normalization, deduplication of variants, forced track parsingFrontend (
libs/journeys/ui)extractYouTubeCaptionsAndAddTextTracks.ts: AddedmatchesLanguageCode()helper with prefix matching (enmatchesen-GBbut notend). Only activates first matching variant to avoid doublesetYouTubeCaptionTrackcalls.extractYouTubeCaptionsAndAddTextTracks.spec.ts: 5 new tests — locale variant matching, first-match-only, partial code safety, pt-BR matching, inverse direction safetyTest plan
Post-Deploy Monitoring & Validation
Invalid YouTube API response formaterrors — should decrease (fewer Zod parse failures fromforcedtracks)Failed to fetch languages from gatewayerrors would indicate the normalized codes are not matchingCloses NES-958
🤖 Generated with Claude Code
Summary by CodeRabbit