test(core): fix flaky calibration-flash e2e assertion - #54
Merged
Merged
Conversation
The e2e gate asserted `videoClockOffsetMs > 0`, which conflated "flash detected at offset 0" with "flash not found (fell back to 0)". When recordVideo's first encoded frame IS the magenta flash — VP8 coalesces the identical pre-flash blank frames — the flash sits at pts_time 0 and detection correctly returns offset 0, tripping the `> 0` check ~1 run in 3 despite a perfect detection. Verified against the exact recording that failed: detectFlashOffsetMs returns 0 (non-null). Now re-detect on the raw recording and assert the flash was found (non-null) and that the pipeline consumed that offset; null still fails, so genuine misses are still caught. Add a unit test pinning that a first-frame flash parses to 0, not null. Production behavior was already correct — this is a test-only fix. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…lake # Conflicts: # CHANGELOG.md
jbrecht
added a commit
that referenced
this pull request
Jun 15, 2026
Lockstep minor bump. Carries #52 (chapters now respect YouTube's 10s floor and Vimeo's 50-char title limit; new exports enforceMinChapterDuration and YOUTUBE_MIN_CHAPTER_MS; default title cap 60→50) and the flaky calibration-flash e2e fix (#54). Minor rather than patch: two additive public exports plus the title-cap behavior change. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Root cause
The e2e gate intermittently failed at
assert.ok(result.videoClockOffsetMs > 0, 'calibration flash was detected')(~1 run in 3). It is not a detection-robustness problem —#46's range tolerance is fine.The flash (
#ff00ff) is painted right afterclock.zero().recordVideostarts at context creation, but VP8 coalesces the identical pre-flashabout:blankframes, so the first encoded frame is sometimes the flash itself atpts_time:0. Detection then correctly returns offset0— and the assertion's> 0treated that valid detection as a failure. The offset0is also the correct value (the flash genuinely is at clock zero).I confirmed this against the raw recording from a failed run: chroma at frame 0 =
UAVG 201 / VAVG 219(clean magenta),pts_time 0, sodetectFlashOffsetMsreturns0.Fix (test-only)
!== null) and thatvideoClockOffsetMsequals that detected offset — instead of asserting the offset is positive. A genuine miss (null) still fails the gate, so the original intent (catch real misses) is preserved.parseFlashFromMetadataregression test pinning that a first-frame magenta flash parses to0, notnull.Production code is unchanged — the pipeline already distinguished
null(warn, fall back) from a found offset, and0is the right answer when the flash is on frame 0.Verification
pnpm buildclean.Note
This adds an
## UnreleasedCHANGELOG entry; #53 does too, so whichever merges second needs a trivial one-line merge to combine the bullets under a single## Unreleased. Both should land before the next version bump.🤖 Generated with Claude Code