Skip to content

fix(cli): skip undefined cues during incremental batch push#2059

Merged
AndreyHirsa merged 1 commit intomainfrom
fix/vtt-batch-push
Mar 26, 2026
Merged

fix(cli): skip undefined cues during incremental batch push#2059
AndreyHirsa merged 1 commit intomainfrom
fix/vtt-batch-push

Conversation

@AndreyHirsa
Copy link
Copy Markdown
Contributor

@AndreyHirsa AndreyHirsa commented Mar 26, 2026

Summary

Fix VTT push crash when translation API batches responses, causing webvtt.compile to throw on undefined cue text values.

Changes

  • Skip empty cues in VTT push
  • Each batch writes a partial VTT file; subsequent batches read it back and build on it until complete

Visuals

N/A

Checklist

  • Changeset added (if version bump needed)
  • Tests cover business logic (not just happy path)
  • No breaking changes (or documented below)

Summary by CodeRabbit

  • Bug Fixes
    • VTT incremental batch pushing now correctly skips undefined cues, improving handling of edge cases during video text track processing.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3982e366-fbef-4f78-baa8-380e458ae841

📥 Commits

Reviewing files that changed from the base of the PR and between 2f6438f and 69d35bc.

📒 Files selected for processing (2)
  • .changeset/polite-cats-rhyme.md
  • packages/cli/src/cli/loaders/vtt.ts

📝 Walkthrough

Walkthrough

A new changeset file was added to mark a patch-level release. The VTT loader's push method was modified to filter out cue entries with undefined or falsy text values during batch payload transformation, changing from a map() to a reduce() implementation.

Changes

Cohort / File(s) Summary
Changeset
.changeset/polite-cats-rhyme.md
Added patch-level release marker for lingo.dev package documenting the VTT cue filtering behavior.
VTT Loader
packages/cli/src/cli/loaders/vtt.ts
Modified push method to use reduce() instead of map(), skipping cue emissions for entries with falsy text values while preserving cue structure for valid entries.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • PR #1990: Filters out undefined/null subtitle texts in both srt.ts and vtt.ts loaders using similar logic patterns
  • PR #2057: Modifies the vtt.ts push implementation to handle originalInput and reinsertion of STYLE/REGION blocks

Suggested reviewers

  • cherkanovart

Poem

🐰 VTT cues now skip the undefined dance,
No empty text gets a second chance,
Reduce and filter, clean and bright,
Batch pushing handled just right! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: skipping undefined cues during VTT incremental batch push, which matches the core code modification.
Description check ✅ Passed The description covers the summary and changes but is missing tests section details; however, only the 'Tests cover business logic' checkbox is unchecked, which is acceptable.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/vtt-batch-push

Comment @coderabbitai help to get the list of available commands and usage tips.

@AndreyHirsa AndreyHirsa merged commit 4344399 into main Mar 26, 2026
10 checks passed
@AndreyHirsa AndreyHirsa deleted the fix/vtt-batch-push branch March 26, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants