Skip to content

Extend brand type schema with stable foundation for migration#67

Merged
natashaannn merged 6 commits into
mainfrom
refactor/s1-brand-types
May 10, 2026
Merged

Extend brand type schema with stable foundation for migration#67
natashaannn merged 6 commits into
mainfrom
refactor/s1-brand-types

Conversation

@natashaannn
Copy link
Copy Markdown
Member

PR: Extend brand type schema with stable foundation for migration

Summary

Add new type definitions and extend the Brand schema to support future brand migration work while maintaining backward compatibility.

Changes

  • Added BrandHost type: Defines host structure with name, avatar, bio, and social links
  • Added BrandMascot type: Defines mascot structure with name, image, and description
  • Extended Brand type with optional fields:
    • identity: name, tagline, description
    • hosts: array of BrandHost objects
    • mascot: BrandMascot object
    • audio: theme, stinger, background audio paths
    • background: image, video, pattern assets

Verification

  • ✅ TypeScript compilation passes with zero errors
  • ✅ All existing imports remain valid
  • ✅ Backward compatibility preserved (new fields are optional)

Impact

This provides a stable, extensible type system for downstream brand extraction work without affecting existing component behavior.

Type of Change

  • Bug fix
  • New feature
  • Breaking change (backward compatible - new optional fields only)
  • Documentation update

Test Strategy

Type-only changes - no runtime tests required. Verification done via TypeScript compilation.

Merge Risk: Low

Pure type definition changes with backward compatibility.

Issues

Closes #13

Extend brand type schema with stable foundation for migration

- Add BrandHost and BrandMascot type definitions
- Extend Brand type with identity, hosts, mascot, audio, background fields
- Preserve backward compatibility with optional new fields
- Enable downstream brand extraction work with typed schema

Type-only changes - no component behavior modifications.
Pattern: Implementation diverges from documented spec without updating the spec
Observed in: refactor/s1-brand-types
Fix brand type definitions to match PRODUCTION_REFACTOR_PLAN.md specifications

- Align BrandHost type with spec (add role, imgSrc, nameBgColor fields)
- Align BrandMascot type with spec (add enabled boolean and assets index map)
- Update Brand type with correct field names and required fields:
  * identity.terminalPath, identity.socialHandle
  * audio.introOutroMusic, audio.backgroundMusic
  * background.episodeGridAssets
- Add implementation guide docs/implementation-guides/REFACTOR_P0_BRAND.md
- Remove out-of-scope inventory change

Resolves all review findings and enables downstream Phase 0.5 steps.
Type-only changes - no component behavior modifications.
Address review warnings in Phase 0.5 brand implementation guide

- Update branch name from refactor/p0-brand to refactor/s1-brand-types to match reality
- Add sequencing guard warning between Step 1 and Step 2 to prevent runtime errors
- Fix status checks for Steps 2 and 4 to use file existence checks:
  * Step 2: ls brands/ragtech/brand.json (fails if migration incomplete)
  * Step 4: ls remotion/lib/brandRegistry.ts (fails if registry missing)

All status checks now provide real verification per CLAUDE.md requirements.
Guide ready for downstream Phase 0.5 implementation with proper dependency ordering.
Added two pre-commit guards and one pre-push guard so these patterns
are blocked at commit/push time rather than surfaced for the first time
during code review:

- Pre-commit: scripts/**/*.test.ts files must not use os.tmpdir /
  fs.mkdtempSync / mkdtemp (integration tests belong in tests/integration/)
- Pre-commit: test files must not call Math.random(), Date.now(), or
  crypto random APIs without seeding (non-deterministic → flaky tests)
- Pre-push: new mkdirSync/mkdir calls must target directories already in
  .gitignore (check-runtime-dirs.cjs; simple string literals only, skips
  template literals and /tmp paths to avoid false positives)

These patterns were previously first detected by review-pr's Step 8.
Moving enforcement upstream reduces review token cost and catches mistakes
before they accumulate across multiple commits.
Patterns that can be checked mechanically now live at the earliest
possible workflow stage instead of being caught for the first time
in review-pr:

implement-issue (Step 5d):
  Added explicit type-spec check — any new/modified type must be compared
  field-by-field against docs/PRODUCTION_REFACTOR_PLAN.md before committing.
  Diverging silently breaks downstream phases that reference field names.

implement-issue (Step 5e):
  Added staging-scope guard — run git diff --cached --name-only after staging
  and remove any out-of-scope files lint-staged may have auto-fixed.

pre-push-audit (new Step 4b-2 + 4c):
  4b-2: scope verification — flag files in the diff not mentioned in the PR body
        (lint-staged side-effect detection).
  4c:   type specification check — mirrors the implement-issue check but runs
        across all commits in the branch before the push gate clears.

review-pr (Known Gap Patterns):
  Removed the four patterns now enforced upstream:
    • Integration test in scripts/ → pre-commit hook
    • Runtime dir not in .gitignore → pre-push hook
    • Lint-staged scope creep → implement-issue + pre-push-audit
    • Non-deterministic test inputs → pre-commit hook
  Added a comment block explaining the removal so the history is preserved.
  Kept the spec-divergence pattern (pattern 5) — it requires semantic
  reasoning that hooks cannot replace.
@natashaannn natashaannn merged commit c8dfc96 into main May 10, 2026
1 check passed
@natashaannn natashaannn deleted the refactor/s1-brand-types branch May 10, 2026 03:42
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.

Extend brand type schema

1 participant