Skip to content

video-mode: snap a sliver of selector lead-in forward to the first highlight (main CI flake) - #41

Open
mmkal wants to merge 1 commit into
mainfrom
fix-selector-trim-lead-in
Open

video-mode: snap a sliver of selector lead-in forward to the first highlight (main CI flake)#41
mmkal wants to merge 1 commit into
mainfrom
fix-selector-trim-lead-in

Conversation

@mmkal

@mmkal mmkal commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #40, which fixed the after case. Main still flakes on reveals an expanding textarea one line at a time at its final geometry (1/2 on main's latest run, 3/3 on #39) with the mirror case.

Diagnosed from the CI run's own artifacts (gh run download): the selector trim start lands a sliver before the first highlight (36ms / 92ms / 54ms across the three attempts), so the render opens with ~1 frame of raw footage before the waitFor hold. On a slow runner the screencast starts so late that its very first frames already show the fill's result — the CI raw video is 2.0s long with text present at t=0.04s — so that opening frame is the filled, expanded textarea, one frame before the reveal's empty still:

First six rendered frames from the failing CI run — frame 0 is the filled, expanded textarea; frames 1-5 are the hold with the empty textarea:

ci-textarea-first-frames.png

A lead-in shorter than the existing fill stabilization window (max(0, timelineOffset) + 3 frames) isn't worth keeping and can't be trusted on a lagging recorder, so the start now snaps forward to the first highlight. Longer lead-ins are untouched; #40's after-case clamp stays.

Runner-timing-specific like #40 — this PR's CI run is the verification. Blocks #39.

🤖 Generated with Claude Code

Session: b7f6f792-6606-44be-9ec3-207eb762c4b6


Note

Medium Risk
Changes rendered video trim boundaries for selector-based starts on slow runners; scoped to short lead-ins but affects pixel-accurate video assertions if they depend on exact first frames.

Overview
Extends selector trim start correction in video-mode render finalization: after the existing clamp when trim start lands after a highlight (#40), it now handles the mirror case when trim start sits a short sliver before the first highlight.

If sourceRange.start is within the fill stabilization window (max(0, timelineOffset) + 3 frame durations), it snaps forward to firstHighlightStart instead of keeping ~1 frame of raw screencast. That avoids opening on lagging-recorder frames that already show post-fill UI (e.g. expanded textarea) before a fill-reveal hold.

Longer lead-ins are unchanged; only sub-tolerance gaps are adjusted.

Reviewed by Cursor Bugbot for commit 52054c5. Bugbot is set up for automated code reviews on this repo. Configure here.

…ghlight

#40 clamped a selector trim start that landed AFTER a highlight. CI kept
flaking on the mirror case: a start a sliver (36-92ms measured) BEFORE
the first highlight. That sliver is raw footage from the recording's
very first frames, and on a slow runner the screencast starts so late
that those frames already show the action's result - the rendered video
opened on the filled, expanded textarea one frame before the reveal's
empty still (confirmed from the CI run's own raw/rendered artifacts: the
2.0s raw video has text at t=0.04s).

A lead-in shorter than the fill stabilization window (max(0,
timelineOffset) + 3 frames) is not worth keeping; open on the first
highlight instead. Longer lead-ins are untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@pkg-pr-new

pkg-pr-new Bot commented Aug 26, 2026

Copy link
Copy Markdown

Open in StackBlitz

pnpm add https://pkg.pr.new/middlewright@41

commit: 52054c5

@mmkal
mmkal marked this pull request as ready for review August 26, 2026 23:06
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