Skip to content

refactor(producer): remove typecasts, deduplicate, name constants#1421

Closed
miguel-heygen wants to merge 2 commits into
refactor/consolidate-patternsfrom
refactor/code-quality
Closed

refactor(producer): remove typecasts, deduplicate, name constants#1421
miguel-heygen wants to merge 2 commits into
refactor/consolidate-patternsfrom
refactor/code-quality

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Code quality polish on the extracted HDR compositor:

  • Extract seekInjectAndQueryStacking / seekAndInject helpers, deduplicating the seek+inject+query pattern across 3 capture files (5→2 clone groups)
  • Fix as Buffer casts with properly typed arrays
  • Add TRANSFORM_IDENTITY_EPSILON, OPAQUE_ALPHA_THRESHOLD, RGB48_BYTES_PER_PIXEL constants
  • Add AffineMatrix tuple type + isAffineMatrix guard, eliminating 4 non-null assertions
  • Extract resolveBlitOpacity helper (5 identical ternaries → 1 function)
  • Narrow blanket fallow-ignore-file to line-level fallow-ignore-next-line complexity

239 LOC (147 insertions, 92 deletions)

Stack: 5/5

…erns

- Extract seekInjectAndQueryStacking() and seekAndInject() helpers to
  deduplicate the seek+inject+query pattern across sequential loop,
  hybrid loop, and per-scene transition capture (3 call sites → 1 helper)
- Fix sceneBuf as Buffer casts by properly typing the scene-capture
  arrays as [Buffer, Set<string>][] instead of using as const + cast
- Replace as NonNullable<> cast on outputFormat with as const fallback
- Add explanatory comments on inherent linkedom DOM casts
- Replace magic 0.001/0.999 with TRANSFORM_IDENTITY_EPSILON and
  OPAQUE_ALPHA_THRESHOLD; replace BPP=6 with RGB48_BYTES_PER_PIXEL
- Add AffineMatrix tuple type + isAffineMatrix guard, eliminating
  all 4 non-null assertions on matrix indices
- Extract resolveBlitOpacity() to replace 5 identical ternaries
- Narrow fallow-ignore-file to line-level complexity suppressions

miguel-heygen commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator Author

@miguel-heygen miguel-heygen changed the title refactor(producer): remove typecasts and deduplicate HDR capture patterns refactor(producer): remove typecasts, deduplicate, name constants Jun 13, 2026
@miguel-heygen miguel-heygen marked this pull request as ready for review June 13, 2026 22:20
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.

1 participant