refactor(overlay-renderer): introduce brand overlay registry - #69
Merged
Conversation
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>
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.
Summary
id: stringtoBrandtype and"id": "ragtech"tobrand.jsonas abridge required by the registry pattern until the full brand.json migration
(Phase 0.5 Step 2).
remotion/lib/brandRegistry.tswithgetBrandOverlays(brandId)—returns all 11 ragtech keyword overlays for
'ragtech', empty map for anyother brand. Future brands plug in here without touching core renderer code.
OverlayRendererto use{ ...CORE_TEMPLATE_MAP, ...getBrandOverlays(brand.id) }—removes hardcoded brand overlay imports from the core renderer entirely.
next/babel→ Jest ESM/CJS injection ordering bug in the react jestproject by passing
babelrc: false, configFile: falseto babel-jest; alsofixed the
next/imagemock factory intests/setup.react.ts.How to review
remotion/lib/brandRegistry.ts— new registry; verify all 11 ragtech keywordoverlays are present and the unknown-brand path returns
{}.remotion/components/OverlayRenderer.tsx— diff should show only: removal of11 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— confirmgetBrandOverlayscalled with
brand.id('ragtech').jest.config.js—babelrc: false, configFile: falseis intentional; worksaround a next/babel plugin ordering bug (see comment in file).
Test plan
npm testpasses — 253 tests, 11 suites, 0 failurestsc --noEmit— cleanfor
ragTechVodcast. GifWindowOverlay freeze is pre-existing, zero changesto that file in this branch.
Issue
Closes #15