Skip to content

fix: make caption overrides refresh-safe#609

Merged
vanceingalls merged 2 commits intomainfrom
fix-caption-overrides-refresh
May 4, 2026
Merged

fix: make caption overrides refresh-safe#609
vanceingalls merged 2 commits intomainfrom
fix-caption-overrides-refresh

Conversation

@vanceingalls
Copy link
Copy Markdown
Collaborator

@vanceingalls vanceingalls commented May 3, 2026

Summary

This stacked PR makes caption overrides refresh-safe.

Caption edits are still saved to caption-overrides.json, but override targets are now stable across preview refreshes and regenerated caption HTML.

Architecture

  • Stable word identity: generated caption HTML preserves optional transcript word IDs in the TRANSCRIPT array and emits those IDs on word spans.
  • Parser continuity: the caption parser preserves existing transcript word id fields instead of regenerating index-only identity.
  • Override loading: Studio loads saved overrides by wordId first, with the existing wordIndex fallback kept for older overrides.
  • Idempotent runtime wrapping: transform overrides reuse an existing data-caption-wrapper="true" wrapper instead of nesting wrappers on every refresh.
  • Animation compatibility: overrides still wrap the word so inner word-level GSAP animation can continue to target the original span.

User Impact

Users can edit caption word position, scale, rotation, color, opacity, font size, font weight, and font family, then refresh without overrides drifting to the wrong word or accumulating nested wrappers.

Main Files

  • packages/core/src/runtime/captionOverrides.ts
  • packages/studio/src/captions/generator.ts
  • packages/studio/src/captions/parser.ts
  • packages/studio/src/captions/hooks/useCaptionSync.ts

Test Plan

volta run --node 22.20.0 bun run --filter @hyperframes/core test -- src/runtime/captionOverrides.test.ts
volta run --node 22.20.0 packages/studio/node_modules/.bin/vitest run --root packages/studio --config /dev/null src/captions/parser.test.ts src/captions/generator.test.ts
volta run --node 22.20.0 bun run --filter @hyperframes/core typecheck
volta run --node 22.20.0 bun run --filter @hyperframes/studio typecheck
volta run --node 22.20.0 bunx oxlint <changed files>
volta run --node 22.20.0 bunx oxfmt --check <changed files>
git diff --check

Copy link
Copy Markdown
Collaborator Author

vanceingalls commented May 3, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@vanceingalls vanceingalls force-pushed the fix-caption-overrides-refresh branch from 8c5940f to 0882073 Compare May 4, 2026 02:06
@vanceingalls vanceingalls force-pushed the feat/studio-manual-edit-manifest branch from ec63fd7 to 446c5e2 Compare May 4, 2026 02:33
@vanceingalls vanceingalls force-pushed the fix-caption-overrides-refresh branch from 0882073 to bb2c5f8 Compare May 4, 2026 03:04
@vanceingalls vanceingalls force-pushed the feat/studio-manual-edit-manifest branch from e0c88dd to ce1de64 Compare May 4, 2026 03:08
@vanceingalls vanceingalls force-pushed the fix-caption-overrides-refresh branch from bb2c5f8 to 4829dc1 Compare May 4, 2026 03:08
@vanceingalls vanceingalls force-pushed the feat/studio-manual-edit-manifest branch from ce1de64 to fd62a9d Compare May 4, 2026 03:13
@vanceingalls vanceingalls force-pushed the fix-caption-overrides-refresh branch from 4829dc1 to 6161c79 Compare May 4, 2026 03:14
Copy link
Copy Markdown
Collaborator

@miguel-heygen miguel-heygen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking findings.

I reviewed this on top of #593 at 6161c790e2c4923988071a6de16a2b11a7ecd9ea. The wrapper reuse path is idempotent, wordId propagation through parser/generator/runtime is stable, and the legacy wordIndex fallback remains covered.

Validated locally:

  • bun run --filter @hyperframes/core test -- src/runtime/captionOverrides.test.ts
  • packages/studio/node_modules/.bin/vitest run --root packages/studio --config /dev/null src/captions/parser.test.ts src/captions/generator.test.ts
  • bun run --filter @hyperframes/core typecheck
  • bun run --filter @hyperframes/studio typecheck
  • bunx oxlint / bunx oxfmt --check on the changed caption files

Browser smoke: loaded a temporary Studio preview project with stable word IDs plus caption-overrides.json, confirmed the runtime applied the wordId override, reloaded, and confirmed it still had exactly one caption wrapper with the expected transform/font size.

CI is green except Graphite mergeability still appears pending, which I do not consider a code blocker for this review.

@vanceingalls vanceingalls changed the base branch from feat/studio-manual-edit-manifest to graphite-base/609 May 4, 2026 06:06
@vanceingalls vanceingalls force-pushed the fix-caption-overrides-refresh branch from 6161c79 to 72cceb4 Compare May 4, 2026 06:06
@graphite-app graphite-app Bot changed the base branch from graphite-base/609 to main May 4, 2026 06:07
@vanceingalls vanceingalls force-pushed the fix-caption-overrides-refresh branch from 72cceb4 to e5f9e95 Compare May 4, 2026 06:07
@vanceingalls vanceingalls merged commit 8d83d4f into main May 4, 2026
42 checks passed
Copy link
Copy Markdown
Collaborator Author

Merge activity

@vanceingalls vanceingalls deleted the fix-caption-overrides-refresh branch May 4, 2026 06:29
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