Repository navigation
Conversation
verifySynchronizedMedia dereferenced item.frameDomain.frameRate (and .frameCount) right after confirming only that the top-level value is an object. When frameDomain is missing or not an object it threw a bare "Cannot read properties of undefined (reading 'frameRate')" TypeError instead of a stated validation error. That is what surfaces when an older or hand-edited result.json is read (see hypit-ai#388). Add the same object() guard the sibling verifiers already use so a malformed frame domain is reported as "SynchronizedMedia.frameDomain must be an object". Adds packages/media/test/identity.test.ts covering a well-formed value and missing / non-object frame domains.
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
verifySynchronizedMediadereferenceditem.frameDomain.frameRate(anditem.frameDomain.frameCount) right after confirming only that the top-levelvalue is an object. When
frameDomainis missing or is not an object, thatthrew a bare
TypeError: Cannot read properties of undefined (reading 'frameRate')instead of a stated validation error.
This is the crash reported in #388, where reading an older / hand-edited
result.jsonwhoseSynchronizedMedialacks a well-formedframeDomainfails with exactly that message (
@hypit/media@1#SynchronizedMedia ... Cannot read properties of undefined (reading 'frameRate')).Fix
Add the same
object()guard the sibling verifiers (verifyTimelineVisual,verifyMuxedMedia,verifyRational, ...) already use, so a malformed framedomain is reported as
SynchronizedMedia.frameDomain must be an object.const item = object(value, "SynchronizedMedia") as unknown as SynchronizedMedia; + object(item.frameDomain, "SynchronizedMedia.frameDomain"); verifyRational(item.frameDomain.frameRate, "SynchronizedMedia.frameDomain.frameRate");Scope
This addresses only the unguarded
frameRatecrash from #388 (turning it intoa diagnosable validation error). It does not claim to make the bundled archive
replay end-to-end — that report also involves missing
source.id/run.idfields in the archived result, which are separate.
Tests
Adds
packages/media/test/identity.test.ts:SynchronizedMediastill verifies;frameDomainand non-objectframeDomainnow throw the stated error.pnpm --filter @hypit/media test(12 tests) andpnpm checkboth pass.