Skip to content

fix(codecs): restore the runtime kind guard the port dropped - #3

Merged
ralyodio merged 1 commit into
mainfrom
kind-guard
Aug 29, 2026
Merged

fix(codecs): restore the runtime kind guard the port dropped#3
ralyodio merged 1 commit into
mainfrom
kind-guard

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

The original JavaScript guarded both arguments — if (!codec || !kind). Porting to TypeScript, kind became a union type and the runtime check looked redundant, so it went. It is not redundant: this module is imported by two plain-JavaScript client bundles, where a missing kind is an ordinary runtime value rather than a compile error.

Without it, mseCandidates(null, 'mp3') stopped meaning "nothing to ask" and started asking MSE about null/mp4.

Caught by genrewatch's own suite the moment it adopted the shared table — which is rather the argument for adopting it there instead of leaving three copies drifting.

80 tests, tsc and prettier clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WFLwZtXE6iBJyJSgrsWqRM

The original JavaScript guarded both arguments -- `if (!codec || !kind)`.
Porting it to TypeScript, `kind` became a union type and the runtime check
looked redundant, so it went. It is not redundant: this module is imported by
two plain-JavaScript client bundles, where a missing kind is an ordinary
runtime value rather than a compile error.

Without it, `mseCandidates(null, 'mp3')` stopped meaning "nothing to ask" and
started asking MSE about `null/mp4`.

Caught by genrewatch's own suite the moment it adopted the shared table, which
is the argument for adopting it there rather than leaving three copies.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WFLwZtXE6iBJyJSgrsWqRM
@ralyodio
ralyodio merged commit d6e914d into main Aug 29, 2026
3 checks passed
@ralyodio
ralyodio deleted the kind-guard branch August 29, 2026 08:43
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