-
Notifications
You must be signed in to change notification settings - Fork 153
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a7e96b9406
i️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1 Badge Clear stale frame artifacts before reading extracted frames
When diff video is run with an existing --out directory, this code reads every frame-*.png in that folder after extraction, but the folder is never cleaned first. If a previous run produced more frames than the current run, leftover PNGs are included in files, so transition analysis uses stale frames and reports incorrect timing/content. This is reproducible by running diff video twice against the same output dir with different --max-frames or video lengths.
Useful? React with 👍 / 👎.
thymikee
commented
Jun 10, 2026
Re-checking this PR today: it is stale and not mergeable as-is. GitHub reports conflicts (mergeStateStatus: DIRTY, mergeable: CONFLICTING), and the last checks are from April with unit/typecheck failures.
If this feature is still intended to land, the branch needs to be rebased onto current main, conflicts resolved, and validation rerun before a useful final review. Until then I would not merge it.
thymikee
commented
Jun 11, 2026
Code review
Verdict: minor issues — no blockers; the security-sensitive parts are done correctly, but there are a few edge-case and hygiene gaps, and the branch is significantly stale against main.
Security (checked, no findings)
- Command injection: clean.
runCmdusesspawn(..., { shell: false })with array args; the video path and fps values are never shell-interpolated, and the path is resolved absolute before being passed so it can't be mistaken for an ffmpeg option. - Stale-frame cleanup (ddeeb9f): correct and safely scoped.
removeStaleFrames(src/utils/video-frames.ts:84-95) only deletes files matching^frame-\d+\.png$inside the command's own<out>/framessubdirectory. - Memory: frames are compared pairwise, two PNGs in memory at a time, capped at
--max-frames ≤ 500.
Findings
-
Minor —
src/utils/video-frames.ts:122-126(formatFps): the clamped fpsmaxFrames / durationSeccan format to"0"(e.g.--max-frames 2on a ~70+ minute recording), making ffmpeg fail with an opaqueCOMMAND_FAILEDinstead of clamping to a minimum positive fps. -
Minor —
src/utils/video-frames.ts:44-47+src/utils/transition-summary.ts:92: a very short video (0-1 sampled frames) or a corrupt video that ffmpeg exits 0 on surfaces asINVALID_ARGS: 'transition summary requires at least two frames'— blaming the user's arguments rather than the video. -
Minor —
src/utils/transition-summary.ts:122-124: the ddeeb9f fix clears staleframe-*.pngbut not staletransition-N.diff.pngin--out; rerunning into the same dir with fewer detected transitions leaves misleading leftover diff images — the same bug class the latest commit fixed, one level up. -
Minor —
diff videobranch insrc/cli/commands/screenshot.ts: the output dir (ormkdtempdir) is created before the ffmpeg TOOL_MISSING probe, littering empty temp dirs on failure; temp dirs are also never cleaned on success when--outis omitted. -
Minor —
src/utils/transition-summary.ts:181-189: directory mode ingests every*.png, sodiff frames <dir> --out <same dir>makes the next run treat its owntransition-1.diff.pngas an input frame — no filtering or warning. -
Minor —
src/utils/video-frames.ts:22: the fixed 60 sVIDEO_EXTRACT_TIMEOUT_MScan SIGKILL extraction of long/high-res recordings (the exact case--max-frames 500targets), with no flag to extend it. -
Minor (tests) —
video-frames.test.tsonly covers TOOL_MISSING and stale-frame cleanup; no tests for the fps-clamp math, timestamp parsing/fallback, ffprobe failure, or the <2-extracted-frames path. -
Major (process, not code) — staleness/rebase risk: the branch is based on 0.12.4 (April); main has ~50 commits since, several touching exactly this PR's shared files — notably
screenshot-diff.tswas refactored to a worker thread (b8172e3; options now havemaxPixels, and this PR'sincludeOcrflag doesn't exist there), plus type-consolidation passes and large drift incommand-schema.tsandoutput.ts. TheincludeOcropt-out is load-bearing — without re-porting it onto main's worker version, the pairwise loop would run OCR on up to ~499 comparisons.
Overall
Well-structured feature: clean exec hygiene, bounded memory, sensible heuristics, and the latest artifact-cleanup fix is correct and conservative. The biggest practical concern is the two-month-stale base — this needs a careful rebase, re-threading includeOcr through the new worker-thread diff pipeline in particular, before merge.
Generated by Claude Code
Summary
Add transition summaries for visual frame sequences and recordings via
diff framesanddiff video.diff framesaccepts a PNG directory or explicit PNG frame paths, whilediff videouses externalffmpeg/ffprobeto sample recordings into frames without adding JS dependencies. The summarizer reuses screenshot diff region/OCR hints only on selected transition boundaries, supports gesture telemetry labels such asafter tap, and writes keyframe/diff artifacts under--out.Example from a synthetic Settings-like frame sequence:
diff videoprerequisite behavior when FFmpeg is missing:Touched-file count: 10. Scope stayed within the diff/media command family plus docs/skill guidance.
Validation
pnpm formatpnpm check:quickpnpm vitest run src/utils/__tests__/transition-summary.test.ts src/__tests__/cli-diff.test.ts src/utils/__tests__/cli-option-schema.test.tspnpm test:smokepnpm buildgit diff --checkpnpm ad diff frames <frames-dir> --out <out-dir> --telemetry <telemetry.json> --threshold 0pnpm ad diff video /tmp/missing.mp4 --out /tmp/transition-video-outin an environment without FFmpeg/FFprobe to verify the prerequisite errorKnown gap: full
pnpm check:unit/all-unit Vitest runs were attempted, but the tool session was terminated before Vitest printed a final summary; targeted unit/CLI tests, smoke tests, typecheck/lint, and build passed.