Skip to content

test(producer): the injector budget test no longer leaves a no-op injector for later tests - #7384

Merged
miguel-heygen merged 1 commit into
mainfrom
test/injector-budget-no-module-mock
Nov 7, 2026
Merged

miguel-heygen merged 1 commit into
mainfrom
test/injector-budget-no-module-mock

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What

chunkFrames.injectorBudget.test.ts no longer leaves a no-op video frame injector behind for the tests that run after it in the same bun process.

Why

The test replaced the whole @hyperframes/engine module with mock.module, swapping createVideoFrameInjector for async () => {}, and then imported chunkFrames.js under that mock. Its afterAll put the engine module back, but chunkFrames.js was already loaded and kept the no-op. Run in one process with bun test src/services/distributed, every later chunk render drew no video frames:

  • a locally read video stayed on its first frame;
  • a video read by URL did not show at all.

So renderChunk's "a video the chunk does not show" test failed with two different chunk hashes. CI runs each bun test file in its own process (scripts/run-test-lane.mjs), so CI never hit this, and the renderer itself is unchanged in behaviour. Only a hand-run of the folder did.

How

chunkFrames.ts builds injectors through a small mutable chunkFrameInjectorDependencies object, the same seam renderChunk.ts already has (distributedCaptureSessionDependencies). The budget test swaps it inside try/finally, so the real injector is back before the next test. No module mock.

Tests

  • New in chunkFrames.injectorBudget.test.ts: "leaves the engine's own injector in place for every later test". It runs after the budget test and checks that the factory builds the engine's real injector, which returns null for an empty lookup.

fails without the fix: on main the new test gets [AsyncFunction] (the leftover no-op) instead of null. Running chunkFrames.injectorBudget.test.ts and renderChunk.test.ts in one process fails renderChunk's "a video the chunk does not show" 3 of 3 on main; with this change it passes 2 of 2.

Break checks:

  • Drop the finally restore and the new test fails.
  • Make the factory call createVideoFrameInjector directly and the budget test fails.

Run on Linux:

  • The budget test, 3 runs, green.
  • chunkFrames.test.ts and renderChunk.test.ts, each on their own.
  • The whole services/distributed folder in one process: renderChunk now passes. The three files there that use vitest's vi.mock (plan.masterBus, renderChunk.stall, renderChunk.verifyInWorker) still report load errors under plain bun test, the same as on main; CI runs them under vitest.
  • bun run typecheck and the comment ratchet.

Size

About 30 lines, on its own: a test-isolation fix in one file and its seam. No open PR in this repo touches these files.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 267 (base branch 267), smooth 109 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (8)

@heygengenesis heygengenesis Bot 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.

Verdict: APPROVE · 0 blocker · 0 important · 0 nits · head 3939a725

Scope
  • Read both files. The seam has the same shape as distributedCaptureSessionDependencies. The try/finally restore puts the real injector back before the next test.
  • The new test asserts null for a null lookup. That holds: the real createVideoFrameInjector returns null first thing (videoFrameInjector.ts:180). On main, the module mock is only undone in afterAll, so the test gets the no-op and fails. The "fails without the fix" line holds.
  • renderChunk.verifyInWorker.test.ts uses vi.mock on engine. It spreads the original module and leaves createVideoFrameInjector alone. vi.mock is hoisted, so the object-captured binding sees the same value as before.
  • CI at this head: CI, Comments, CodeQL, PR captures and Player perf pass. regression and Windows render were still running when I posted.
  • No prior reviews.

— genesis-v2

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 7, 2026
Merged via the queue into main with commit 34118d8 Nov 7, 2026
91 checks passed
@miguel-heygen
miguel-heygen deleted the test/injector-budget-no-module-mock branch November 7, 2026 23:12
@miguel-heygen miguel-heygen mentioned this pull request Nov 8, 2026
3 of 5 tasks
SanHsien added a commit to SanHsien/hyperframes that referenced this pull request Nov 9, 2026
Port the adopted upstream fixes from f5bde95 to the current upstream tip:
heygen-com#7375 multipart cloud upload, heygen-com#7382 minParallelChunks, heygen-com#7349 HLG header SEI,
heygen-com#7369 skip unmounted compositions in lint/check, heygen-com#7381 filesystem-path media
in the cloud archive, heygen-com#7383 Safari cut-point pre-roll revert, heygen-com#7373 clock
steering between audio time updates, heygen-com#7384 injector test isolation, heygen-com#7378
preview seek retention, heygen-com#7390 virtual timer schedule per worker, heygen-com#7394 CDN
script failure naming, heygen-com#7395 menu row radius, heygen-com#7119 decode timeout caller
test, heygen-com#7397 authored tween order, heygen-com#7402 capture page clip loading, heygen-com#7412 muted
video audio track at cuts, heygen-com#6150 template root variable test, heygen-com#7442 held tail
seek once.

Deliberate local differences: heygen-com#7067's audio-start hold is not carried into
clock.ts, mountedSources comes from heygen-com#6827 as a helper only, cloud/_gen/types.ts
omits the image-request types the fork does not generate, and the lint
symlink test skips through symlinkOrSkip where the account cannot create links.

Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
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