Repository navigation
Conversation
jrusso1020
approved these changes
Oct 15, 2026
jrusso1020
left a comment
Collaborator
There was a problem hiding this comment.
Approving. This fixes #3899: import now reads each outer group's word count instead of averaging.
packages/studio/src/captions/parser.ts:112(readTranscriptGroups) skips groups nested inside another group selector, so the.caption-block > .caption-linelayout (e.g.registry/components/caption-editorial-emphasis) counts once. It also returnsnullunless the DOM covers exactly every transcript word.- Groups and words go through the same model builder as before, so the ID scheme (
group-N,segment-N,wN) is unchanged for uniform grouping. - One behavior change to be aware of: when the DOM doesn't account for every word (
parser.ts:192), the fallback is now a fixed 5 words per group instead of the old words/groups average. The PR describes this, and a partial DOM average was not reliable anyway, so I'm fine with it. - I checked the fixture compositions under
packages/producer/tests/*/captions.html. Groups with no.wordspans (e.g. style-8) still fall back to 5, which is the same result as main.
What I ran:
vitest run src/captions: 71/71 pass.- Mutation check: with main's
parser.tsrestored, 7 of the new cases fail ([5,2],[2,4,1], caption-line, caption-block, nested lines, incomplete DOM, regenerate + re-import). That matches the PR's claim. git merge-treeagainst #3896's head: no conflicts, so the two caption PRs can land in either order.
— Rames
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Opening existing captions in Studio silently moved words between groups. Seven words authored as
5 + 2became4 + 3, so editing and regenerating captions used the wrong boundaries.Fixes #3899.
How
Read each outer caption group's word count instead of averaging all words and groups. Nested layout lines do not count twice. Incomplete DOM falls back to the existing five-word grouping without dropping transcript words.
Both import paths share the existing model construction, preserving segment IDs, word IDs, timing, and defaults. No UI changes or dependencies.
Verification
5 + 2,2 + 4 + 1, alternate class names, nested lines, incomplete DOM, and generated-HTML re-import.Before
Main imports the authored
5 + 2caption groups as4 + 3. Browser regression harness using the actual Studio parser from main (a4a7cbeac) and synthetic fixture data in a live iframe DOM.After
The same input retains
5 + 2, keeping “needed.” in the first group. The harness uses this PR’s parser with the same source and DOM.