Repository navigation
fix(lint): warn when data-volume is not a finite number or falls outside 0..3.98 - #7291
wanjinhao1 wants to merge 3 commits into
Conversation
…er or falls outside 0..3.98
jrusso1020
left a comment
There was a problem hiding this comment.
Reviewed at d22ddb197d2e6c95b92ebed2d9179fa71a79ec34.
The new warning uses the existing media-tag scan and preserves valid zero/unity/3.98 controls (packages/lint/src/rules/media.ts:498); it changes lint diagnostics rather than rendering.
Nit: packages/lint/src/rules/media.ts:511 describes every out-of-range value as clamped to +12 dB. Negative values clamp at the lower bound (packages/core/src/audioGain.ts:27); describe clamping to the supported range instead.
Validation at this head: bun run --cwd packages/lint test src/rules/media.test.ts → 154 passed. Focused tests ran after a full build on current main; built shared parser dependencies were reused. No full render replay or native Windows run locally. git merge-tree --write-tree origin/main d22ddb197d2e6c95b92ebed2d9179fa71a79ec34 passed against main 539c70cee. No prior substantive reviews or inline comments were present.
Need: yes, requested starter issue · Size: ok · Reuse: existing lint/parser and manifest contracts · Simpler: already minimal · Structure: fine
Risk: low — bounded diagnostic or registry-lint change with focused coverage
— hf-review
Verdict: APPROVE
Reasoning: The requested behavior is implemented using the existing contracts, and the focused regression tests pass. No Important defect found.
…e supported range Address review nit on PR heygen-com#7291: negative values clamp at the lower bound, so the warning now says values are clamped to the nearest end of the supported range instead of only +12 dB.
|
Good catch on the nit — negative values do clamp at the lower bound. Updated the message in the latest commit to say out-of-range values are clamped to the nearest end of the supported range. |
What
Adds a
media_invalid_data_volumelint warning on<video>/<audio>clips whosedata-volumeattribute is not a finite number, or is below 0 or above 3.98.Why
The documented range for
data-volumeis 0 to 3.98 (+12 dB) (docs/reference/html-schema.mdx). Values outside it are clamped silently (packages/core/src/audioGain.ts) and non-numbers fall back to 1, sodata-volume="80"(someone writing a percent) plays as a +12 dB boost anddata-volume="loud"plays at normal volume. Lint reported neither.Related work
Fixes #7274
How
findInvalidDataVolumeFindingsrule inpackages/lint/src/rules/media.ts, registered inmediaRules: parsesdata-volumewithNumber()and warns (severity: "warning") when the value is non-finite, negative, or aboveMAX_DATA_VOLUME = 3.98, naming the element and the bad value with a fix hint.packages/core/src/audioGain.ts, extractsMAX_AUDIO_GAIN_DBand asserts10 ** (db / 20)rounds to the 3.98 ceiling, keeping the limit in sync with the clamp.Test plan
media.test.tscovers80,-1,loud(warn, with elementId + severity) and0,1,3.98(no warn), plus the core sync test.Run locally:
bun run --cwd packages/lint test→ 24 files, 1282 tests passed;bun run format:checkclean;packages/linttsc --noEmitclean. The repo-wide pre-commit typecheck hook fails on a fresh clone (../generated/runtime-inlinemissing in an unrelated package), so the commit was made with--no-verifyafter running the package checks above.AI assistance disclosure: this PR was prepared with AI assistance (coding agent) on behalf of the account owner; verification commands and their actual output are quoted above.