Skip to content

fix: preserve explicit zero caption grain - #3032

Closed
miguel-heygen wants to merge 1 commit into
mainfrom
fix/grain-zero-1785872503
Closed

miguel-heygen wants to merge 1 commit into
mainfrom
fix/grain-zero-1785872503

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Aug 4, 2026 •

Copy link
Copy Markdown
Collaborator

fixes reported:1785872503.756319; no related claim remains outstanding

Source claim: https://slack.com/archives/C0BGC335AQY/p1785872503756319

Summary:

  • preserve an explicit plate grain value of zero instead of replacing it with the default
  • omit the FFmpeg noise filter when resolved grain is zero
  • retain noise=alls=5 when the grain setting is absent

Regression coverage:

  • explicit grain zero compiles without a noise filter
  • missing grain continues to compile with the default level

Verification:

  • node --check skills/embedded-captions/scripts/make-theme.cjs
  • node --test skills/embedded-captions/scripts/make-theme.test.mjs (2 passed)
  • bun run test:skills (463 passed)
  • bunx oxlint changed files
  • bunx oxfmt --check changed files

@miga-heygen miga-heygen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Clean, correct fix.

The bug: || coerces 0 to falsy, so (dna.plate || {}).grain || 5 replaced an explicit grain: 0 with 5 — the noise filter always ran even when the theme author explicitly disabled it.

The fix: ?? preserves 0 (only null/undefined trigger the default). The noise filter string is now built conditionally — empty when grain === 0, which cleanly removes the ,noise=alls=... segment from the ffmpeg filter graph rather than passing noise=alls=0 (which would still allocate the filter for no visual effect).

Two things I verified:

  • The filter + rgba + noise concatenation still produces a valid filter graph in both the zero and non-zero paths. The null filter name in the test output ([0:v]null[v]) is expected — it's the upstream filter variable's value when no spatial filter is active.
  • The P.grain || 5 on line 8540 (heroless branch) is also replaced with ??, so the grain value is consistent between the plate object construction and its later use.

Test coverage is proportionate: explicit-zero and missing-grain are the two boundary cases that matter. No notes.

— Miga

@miga-heygen miga-heygen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No blocking issues found in my review. Stamping. — Miga

@jrusso1020

Copy link
Copy Markdown
Collaborator

Continuing this contribution in #3656, rebuilt on current main with regression coverage and attribution to this PR. Keeping this PR open until the successor lands. Thanks for the original fix.

@jrusso1020

Copy link
Copy Markdown
Collaborator

Closing as implemented in #3656, now merged. The successor preserves this contribution while updating it for current main and adding regression coverage. Thanks for the original fix.

@jrusso1020 jrusso1020 closed this Sep 4, 2026
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.

3 participants