-
-
Notifications
You must be signed in to change notification settings - Fork 226
fix!: correct catalog, timeline, token, and teardown contracts found in API review #2439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
6bed427
refactor(token)!: encapsulate Key so cached crypto material can't go …
kixelated bedf2ce
fix!: correct catalog, timeline, and teardown contracts found in API …
kixelated 03ec0bd
test(mux): drop clone() workarounds around the borrowing finish
kixelated 558df98
fix(net)!: make broadcast::Producer::finish actually end the broadcast
kixelated c7d1086
fix(mux,rtc): don't advertise renditions a fallible producer never ba…
kixelated 02646e5
fix(hang): reject malformed known containers in the JS schema
kixelated c13c1eb
refactor(token,hang)!: restore field access and TypeScript narrowing
kixelated c6f3feb
refactor(token)!: name the key material and give Jwk a named conversion
kixelated e9ab88e
fix(watch): report the real container kind when skipping a rendition
kixelated f7fdeb7
refactor(token)!: name the Jwk <-> Key conversion import/export
kixelated e392a3b
test(mux): guard the stranded-rendition test against a vacuous pass
kixelated File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| import { expect, test } from "bun:test"; | ||
| import { type Container, ContainerSchema, containerSupported } from "./container.ts"; | ||
| import { RootSchema } from "./root.ts"; | ||
|
|
||
| test("known containers round-trip", () => { | ||
| const known: Container[] = [{ kind: "legacy" }, { kind: "cmaf", init: "AAEC" }, { kind: "loc" }]; | ||
| for (const container of known) { | ||
| const parsed = ContainerSchema.parse(container); | ||
| expect(parsed).toEqual(container); | ||
| expect(containerSupported(parsed)).toBe(true); | ||
| } | ||
| }); | ||
|
|
||
| test("unknown container is preserved instead of throwing", () => { | ||
| const container = { kind: "future", extra: { nested: [1, 2] }, flag: true }; | ||
| const parsed = ContainerSchema.parse(container); | ||
| // Tagged with a literal `kind` so the union stays discriminated; `raw` is the original. | ||
| expect(parsed).toEqual({ kind: "unknown", raw: container }); | ||
| expect(containerSupported(parsed)).toBe(false); | ||
| }); | ||
|
|
||
| test("catalog with an unknown container keeps its other renditions", () => { | ||
| const catalog = { | ||
| video: { | ||
| renditions: { | ||
| future: { | ||
| codec: "avc1.64001f", | ||
| container: { kind: "future", magic: 7 }, | ||
| }, | ||
| legacy: { | ||
| codec: "avc1.64001f", | ||
| codedWidth: 1280, | ||
| codedHeight: 720, | ||
| container: { kind: "legacy" }, | ||
| }, | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| const parsed = RootSchema.parse(catalog); | ||
| if (!parsed.video || !("renditions" in parsed.video)) throw new Error("missing video section"); | ||
|
|
||
| const known = parsed.video.renditions.legacy; | ||
| expect(known?.container.kind).toBe("legacy"); | ||
| expect(Number(known?.codedWidth)).toBe(1280); | ||
|
|
||
| // The unknown rendition keeps its original JSON verbatim under `raw`. | ||
| expect(parsed.video.renditions.future?.container).toEqual({ | ||
| kind: "unknown", | ||
| raw: { kind: "future", magic: 7 }, | ||
| }); | ||
| }); | ||
|
|
||
| test("a malformed known container errors instead of degrading to passthrough", () => { | ||
| // `cmaf` without `init` fails its own schema. It must NOT fall through to the passthrough | ||
| // arm, which would still report kind "cmaf" and hand decoders an undefined init segment. | ||
| expect(() => ContainerSchema.parse({ kind: "cmaf" })).toThrow(); | ||
|
|
||
| // A genuinely unrecognized kind still parses, so one future rendition can't fail the catalog. | ||
| expect(ContainerSchema.parse({ kind: "future", magic: 7 })).toEqual({ | ||
| kind: "unknown", | ||
| raw: { kind: "future", magic: 7 }, | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.