From cbcca6e55ff751f0c6a77f37865c181aa429ddd3 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 5 May 2026 07:53:46 +0100 Subject: [PATCH] ci: use Crabbox media previews for Mantis --- .../mantis-discord-status-reactions.yml | 67 +++++++++++++------ docs/concepts/mantis.md | 9 +-- 2 files changed, 51 insertions(+), 25 deletions(-) diff --git a/.github/workflows/mantis-discord-status-reactions.yml b/.github/workflows/mantis-discord-status-reactions.yml index 89e49540a0a..071bf919b67 100644 --- a/.github/workflows/mantis-discord-status-reactions.yml +++ b/.github/workflows/mantis-discord-status-reactions.yml @@ -411,23 +411,23 @@ jobs: local lane="$1" local input="$root/$lane/discord-status-reactions-tool-only-desktop.mp4" local output="$root/$lane/discord-status-reactions-tool-only-desktop-preview.gif" - local palette="$root/$lane/discord-status-reactions-tool-only-desktop-preview-palette.png" - ffmpeg -y -i "$input" -vf "fps=4,scale=640:-1:flags=lanczos,palettegen=stats_mode=diff" -frames:v 1 -update 1 "$palette" - ffmpeg -y -i "$input" -i "$palette" -lavfi "fps=4,scale=640:-1:flags=lanczos[x];[x][1:v]paletteuse=dither=bayer:bayer_scale=3:diff_mode=rectangle" -loop 0 "$output" - rm -f "$palette" + local clip="$root/$lane/discord-status-reactions-tool-only-desktop-change.mp4" + local metadata="$root/$lane/discord-status-reactions-tool-only-desktop-preview.json" + crabbox media preview \ + --input "$input" \ + --output "$output" \ + --trimmed-video-output "$clip" \ + --json > "$metadata" } - if ! command -v ffmpeg >/dev/null 2>&1; then - sudo apt-get update && sudo apt-get install -y ffmpeg || true - fi - if command -v ffmpeg >/dev/null 2>&1; then - if ! make_desktop_preview baseline || ! make_desktop_preview candidate; then - rm -f "$root/baseline/discord-status-reactions-tool-only-desktop-preview.gif" - rm -f "$root/candidate/discord-status-reactions-tool-only-desktop-preview.gif" - echo "::warning::Could not generate animated desktop previews; continuing with screenshots and MP4 links." - fi - else - echo "::warning::ffmpeg is unavailable; skipping animated desktop previews." + if ! make_desktop_preview baseline || ! make_desktop_preview candidate; then + rm -f "$root/baseline/discord-status-reactions-tool-only-desktop-preview.gif" + rm -f "$root/candidate/discord-status-reactions-tool-only-desktop-preview.gif" + rm -f "$root/baseline/discord-status-reactions-tool-only-desktop-change.mp4" + rm -f "$root/candidate/discord-status-reactions-tool-only-desktop-change.mp4" + rm -f "$root/baseline/discord-status-reactions-tool-only-desktop-preview.json" + rm -f "$root/candidate/discord-status-reactions-tool-only-desktop-preview.json" + echo "::warning::Could not generate motion-trimmed desktop previews; continuing with screenshots and full MP4 links." fi baseline_status="$(jq -r '.scenarios[0].status' "$root/baseline/discord-qa-summary.json")" @@ -461,6 +461,12 @@ jobs: if [[ -f "$root/candidate/discord-status-reactions-tool-only-desktop-preview.gif" ]]; then echo "- Candidate desktop preview: \`candidate/discord-status-reactions-tool-only-desktop-preview.gif\`" fi + if [[ -f "$root/baseline/discord-status-reactions-tool-only-desktop-change.mp4" ]]; then + echo "- Baseline desktop change clip: \`baseline/discord-status-reactions-tool-only-desktop-change.mp4\`" + fi + if [[ -f "$root/candidate/discord-status-reactions-tool-only-desktop-change.mp4" ]]; then + echo "- Candidate desktop change clip: \`candidate/discord-status-reactions-tool-only-desktop-change.mp4\`" + fi echo "- Baseline desktop video: \`baseline/discord-status-reactions-tool-only-desktop.mp4\`" echo "- Candidate desktop video: \`candidate/discord-status-reactions-tool-only-desktop.mp4\`" } > "$root/mantis-report.md" @@ -499,7 +505,7 @@ jobs: permission-issues: write permission-pull-requests: write - - name: Comment PR with inline QA screenshots + - name: Comment PR with inline QA evidence if: ${{ always() && needs.resolve_request.outputs.pr_number != '' && steps.run_mantis.outputs.output_dir != '' }} env: GH_TOKEN: ${{ steps.mantis_app_token.outputs.token }} @@ -557,8 +563,16 @@ jobs: if [[ -f "$root/baseline/discord-status-reactions-tool-only-desktop-preview.gif" && -f "$root/candidate/discord-status-reactions-tool-only-desktop-preview.gif" ]]; then cp "$root/baseline/discord-status-reactions-tool-only-desktop-preview.gif" "$artifacts_worktree/$artifact_root/baseline-desktop-preview.gif" cp "$root/candidate/discord-status-reactions-tool-only-desktop-preview.gif" "$artifacts_worktree/$artifact_root/candidate-desktop-preview.gif" + cp "$root/baseline/discord-status-reactions-tool-only-desktop-preview.json" "$artifacts_worktree/$artifact_root/baseline-desktop-preview.json" + cp "$root/candidate/discord-status-reactions-tool-only-desktop-preview.json" "$artifacts_worktree/$artifact_root/candidate-desktop-preview.json" has_desktop_previews="true" fi + has_change_clips="false" + if [[ -f "$root/baseline/discord-status-reactions-tool-only-desktop-change.mp4" && -f "$root/candidate/discord-status-reactions-tool-only-desktop-change.mp4" ]]; then + cp "$root/baseline/discord-status-reactions-tool-only-desktop-change.mp4" "$artifacts_worktree/$artifact_root/baseline-desktop-change.mp4" + cp "$root/candidate/discord-status-reactions-tool-only-desktop-change.mp4" "$artifacts_worktree/$artifact_root/candidate-desktop-change.mp4" + has_change_clips="true" + fi cp "$root/baseline/discord-status-reactions-tool-only-desktop.mp4" "$artifacts_worktree/$artifact_root/baseline-desktop.mp4" cp "$root/candidate/discord-status-reactions-tool-only-desktop.mp4" "$artifacts_worktree/$artifact_root/candidate-desktop.mp4" cp "$root/comparison.json" "$artifacts_worktree/$artifact_root/comparison.json" @@ -581,12 +595,22 @@ jobs: if [[ "$has_desktop_previews" == "true" ]]; then preview_section="$(cat < | Animated candidate desktop preview | EOF )" fi + change_clip_section="" + if [[ "$has_change_clips" == "true" ]]; then + change_clip_section="$(cat < "$comment_file" < @@ -610,6 +634,7 @@ jobs: | --- | --- | | Baseline Mantis desktop browser screenshot | Candidate Mantis desktop browser screenshot | ${preview_section} + ${change_clip_section} Full videos: - [Baseline desktop MP4](${raw_base}/baseline-desktop.mp4) @@ -628,13 +653,13 @@ jobs: comment_payload="$(mktemp)" jq -n --rawfile body "$comment_file" '{ body: $body }' > "$comment_payload" if gh api --method PATCH "repos/${GITHUB_REPOSITORY}/issues/comments/${comment_id}" --input "$comment_payload" >/dev/null; then - echo "Updated Mantis QA screenshot comment on PR #${TARGET_PR}." + echo "Updated Mantis QA evidence comment on PR #${TARGET_PR}." else - echo "::warning::Could not update existing Mantis QA screenshot comment ${comment_id}; creating a new one." + echo "::warning::Could not update existing Mantis QA evidence comment ${comment_id}; creating a new one." gh pr comment "$TARGET_PR" --body-file "$comment_file" - echo "Created Mantis QA screenshot comment on PR #${TARGET_PR}." + echo "Created Mantis QA evidence comment on PR #${TARGET_PR}." fi else gh pr comment "$TARGET_PR" --body-file "$comment_file" - echo "Created Mantis QA screenshot comment on PR #${TARGET_PR}." + echo "Created Mantis QA evidence comment on PR #${TARGET_PR}." fi diff --git a/docs/concepts/mantis.md b/docs/concepts/mantis.md index 8c06129ae31..af162041564 100644 --- a/docs/concepts/mantis.md +++ b/docs/concepts/mantis.md @@ -168,10 +168,11 @@ worktrees, runs `discord-status-reactions-tool-only` against each worktree, and uploads `baseline/`, `candidate/`, `comparison.json`, and `mantis-report.md` as Actions artifacts. It also renders each lane's timeline HTML in a Crabbox desktop browser and publishes those VNC screenshots beside the deterministic -timeline PNGs in the PR comment. The same PR comment embeds lightweight animated -GIF previews generated from the VNC desktop recordings and links to the full -desktop MP4 files, while the screenshots stay inline for quick review. The -workflow builds the Crabbox CLI from +timeline PNGs in the PR comment. The same PR comment embeds lightweight +motion-trimmed GIF previews generated by `crabbox media preview`, links to the +matching motion-trimmed MP4 clips, and keeps the full desktop MP4 files for deep +inspection. Screenshots stay inline for quick review. The workflow builds the +Crabbox CLI from `openclaw/crabbox` main so it can use the current desktop/browser lease flags before the next Crabbox binary release is cut.