Capture real evidence at the HTML preview gate#5
Merged
leochenpm merged 1 commit intoJul 16, 2026
Conversation
The preview gate existed to catch design problems before paying for an mp4 render, but `snapshot` only ever captured `--at 0`. Reviewing one opening frame cannot show a scene that reads as a generic slide, starts blank, or drops its hero visual, so the gate could approve compositions whose problems only surfaced after a full render. Capture the hook frame, one midpoint per scene, and the payoff frame in a single hyperframes call (`--at` takes a timestamp list), and return `first_frame`, `contact_sheet`, and labelled `frames`. Scene times come from the existing scene-map loader; a composition whose metadata cannot be read still captures the opening frame as before. Map results by the `frame-<NN>-` index prefix that hyperframes writes, not by mtime: with several timestamps the newest PNG is the payoff, so the old "newest wins" rule would have silently returned the closing frame as the first frame. Stale frames from a longer previous run are pruned so a shorter run cannot inherit them. Then require the critique the evidence enables: stage-compose reads the contact sheet as a design checkpoint and makes one localized repair before opening the gate; frontend-design judges every frame, not just frame 0. Hand re-mapped from the upstream Orkas video-studio agent (eed7038ac, 6fe7aedbb), translated to this repo's ovs/HyperFrames flow. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jul 15, 2026
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.
Why
The HTML preview gate exists to catch design problems before paying for an mp4 render. But
snapshotonly ever captured--at 0— a single opening frame. One frame cannot show a scene that reads as a generic slide, starts blank, or drops its hero visual, so the gate could approve a composition whose problems only surfaced after a full render. The gate was asking for a judgement it never supplied the evidence for.What
Evidence (
render.ts,composition-qa.ts)snapshotnow captures the hook frame, one midpoint per scene, and the payoff frame in a single hyperframes call —--ataccepts a timestamp list, so this is one browser session, not N.first_frame,contact_sheet(HyperFrames writes a grid view itself — no need to build one), and labelledframes.path/bytesare unchanged for existing callers.loadSceneMap+loadCompositionMeta. If metadata can't be read, it degrades to the old single-frame capture instead of failing.buildPreviewSamplePlan/matchPreviewFrames, bounded byPREVIEW_MAX_FRAMES = 8(each capture is a real browser seek; hook and payoff always survive the thinning).Discipline (skills)
stage-composestep 5: read the contact sheet as a design checkpoint, make one localized repair before opening the gate, show the sheet as the primary artifact.frontend-design: judge every returned frame, not frame 0 alone.Two bugs found while building this
first_framewould have silently been the closing frame. Results are now joined on theframe-<NN>-index prefix hyperframes actually writes.duration - 0.05rounds up todurationat hyperframes' one-decimal seek granularity (11.95 → 12.0). Caught by a unit test; times are now rounded before clamping to the last seekable tenth.Verification
pnpm build+typecheckgreen.pnpm test137 passed / 8 skipped (+9 new; 128 was the baseline).hyperframes initcomposition with a 3-scene map returned 5 correctly-labelled frames (hook-frame0s,intro-mid1s,body-mid3s,outro-mid5s,payoff-frame9.9s) plus the contact sheet. Verifiedfirst_frameis byte-identical toframe-00(the hook), and that a shorter rerun leaves no stale frames behind.frame-0-at-0.0s.jpg,my-frame-00-...,...png.bak).Scope note
The plan's PR3 bundled 7 upstream commits. Most of them (
32691008a,40d0477c1,4ea928a7a,173f9fed8) implement the upstream host's nativecomposition.*state machine — durable production state,approve_plan/approve_preview/approve_draftops, and chat-UI artifact publishing. None of that exists here and porting the prompts alone would describe gates this repo does not have. What was genuinely portable is the preview-evidence half, which needed code before the prompt could be honest — that's this PR.