Skip to content

refactor(overlay-renderer): introduce brand overlay registry - #69

Merged
natashaannn merged 8 commits into
mainfrom
refactor/s1-brand-registry
May 13, 2026
Merged

refactor(overlay-renderer): introduce brand overlay registry#69
natashaannn merged 8 commits into
mainfrom
refactor/s1-brand-registry

Conversation

@natashaannn

Copy link
Copy Markdown
Member

Summary

  • Added id: string to Brand type and "id": "ragtech" to brand.json as a
    bridge required by the registry pattern until the full brand.json migration
    (Phase 0.5 Step 2).
  • Introduced remotion/lib/brandRegistry.ts with getBrandOverlays(brandId)
    returns all 11 ragtech keyword overlays for 'ragtech', empty map for any
    other brand. Future brands plug in here without touching core renderer code.
  • Refactored OverlayRenderer to use { ...CORE_TEMPLATE_MAP, ...getBrandOverlays(brand.id) }
    removes hardcoded brand overlay imports from the core renderer entirely.
  • Fixed a next/babel → Jest ESM/CJS injection ordering bug in the react jest
    project by passing babelrc: false, configFile: false to babel-jest; also
    fixed the next/image mock factory in tests/setup.react.ts.

How to review

  • remotion/lib/brandRegistry.ts — new registry; verify all 11 ragtech keyword
    overlays are present and the unknown-brand path returns {}.
  • remotion/components/OverlayRenderer.tsx — diff should show only: removal of
    11 brand overlay imports, extraction of named constants, and the
    ...getBrandOverlays(brand.id) spread. No logic changes to cue timing.
  • remotion/lib/brandRegistry.test.ts — confirm tests cover ragtech full set,
    unknown brand, and count parity.
  • remotion/components/OverlayRenderer.test.tsx — confirm getBrandOverlays
    called with brand.id ('ragtech').
  • jest.config.jsbabelrc: false, configFile: false is intentional; works
    around a next/babel plugin ordering bug (see comment in file).

Test plan

  • npm test passes — 253 tests, 11 suites, 0 failures
  • tsc --noEmit — clean
  • [REMOTION-VISUAL] Remotion Studio scrub — all overlays render correctly
    for ragTechVodcast. GifWindowOverlay freeze is pre-existing, zero changes
    to that file in this branch.

Issue

Closes #15

natashaannn and others added 8 commits May 13, 2026 15:06
Brand needs an id string so the overlay registry can select the correct
brand-specific overlay set via getBrandOverlays(brand.id).  The spec
references brand.id in OverlayRenderer but the field was omitted from
the Phase 0.5 type extension.  Adding it here unblocks the registry
without waiting for the brand.json → brands/ragtech/brand.json
migration (Step 2).

AC: prereq for brand registry issue
Creates the extensibility seam for brand-specific overlays without
moving any files.  getBrandOverlays(brandId) returns the full set of
RAG Tech keyword overlays for 'ragtech' and an empty map for any
unknown brand.  Imports remain at current paths — a future issue will
migrate them to brands/ragtech/components/ and switch to the require()
form specified in the refactor plan.

Also fixes a pre-existing setup.react.ts bug where jest.mock() factory
referenced document before jsdom was initialised, blocking all react
project tests.

AC: #1 (registry exists and returns correct set), #2 (unknown brand returns {})
…s registry

Replaces the monolithic LONGFORM/SHORTFORM_COMPONENT_MAP constants that
hardcoded all overlays (core + brand-specific) with:

  { ...CORE_TEMPLATE_MAP, ...(isShortForm ? SHORTFORM_OVERRIDES : {}), ...getBrandOverlays(brand.id) }

CORE_TEMPLATE_MAP holds only brand-independent templates; brand overlays
are now resolved at render time via the registry.  Functional parity is
preserved: ragtech resolves exactly the same component set as before.

Also removes the unused FADE_OUT_FRAMES constant and suppresses two
pre-existing no-explicit-any violations that surfaced when this file
was staged (Phase 9 will address no-explicit-any project-wide).

AC: #3 (OverlayRenderer uses registry), #4 (ragtech parity), #5 (tsc clean)
Phase 0.5 Steps 4 (brand registry) and 5 (OverlayRenderer wiring) are
complete on refactor/s1-brand-registry.  CLAUDE.md updated to reflect
brandRegistry.ts as a new key source file and to note the Brand type
now includes id.
…ry wiring

Pre-push audit identified OverlayRenderer.tsx had no test coverage.
Four tests added: null render with no segments, null render with cut
segments, registry delegation (getBrandOverlays called with brand.id),
and isShortForm pass-through.

Also fixes a pre-existing jest infra bug: next/babel.js$2 injects
'import React from "react"' after @babel/preset-env's CJS transform
has already run, leaving raw ESM imports in the output that Node CJS
cannot evaluate.  Fix: react project now uses an explicit babel config
(babelrc:false) without next/babel, avoiding the late-injection issue.
…ACTOR_PLAN

Brand.id was added to the implementation without updating the spec type
block. The spec code snippets already referenced brand.id (lines 357–360)
but the type definition at line 296 lacked the field, creating an internal
inconsistency. Resolves review blocker B1.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…spread order

W2: componentMap was reconstructed on every Remotion frame (60fps) via three
object spreads, replacing the prior pattern of selecting between two pre-built
module-level constants. Wrapped in useMemo([brand.id, isShortForm]) to prevent
per-frame object churn.

W3: Moved getBrandOverlays() before SHORTFORM_OVERRIDES in the spread so that
shortform variants always take precedence over brand overlays. Previously brand
overlays spread last, meaning a future brand supplying a ConceptExplainer key
would silently override the short-form version.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@natashaannn
natashaannn merged commit 6fbfa75 into main May 13, 2026
1 check passed
@natashaannn
natashaannn deleted the refactor/s1-brand-registry branch May 13, 2026 09:13
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.

Introduce brand overlay registry

1 participant