#!/usr/bin/env bash
set -euo pipefail
base=/tmp/lead-33293-r2/capture-3
run="$base/run-$(date -u +%Y%m%dT%H%M%SZ)"
mkdir "$run"
printf '%s\n' "$run"
git clone https://github.com/pingdotgg/zact.git "$run/fixture"
git -C "$run/fixture" switch theo/edge
gh pr list -R pingdotgg/zact --json number,headRefName,state --jq '.[] | select(.number==2 or .number==12)' > "$run/open-prs.json"
# Run before cec8d73a1f and head ae9aad89e1 with separate fresh homes:
# T3CODE_DEV_SEED=0 vp run dev --home-dir "$run/before-home"
# T3CODE_DEV_SEED=0 vp run dev --home-dir "$run/after-home"
# Pair the Browser panel using each startup URL. Never publish the URL or raw server logs.
# Wait for [aria-label="Threads"] before injecting rpc-driver.js, project-driver.js,
# and scenario-driver.js (trim source; preview_evaluate runs ordinary JS, not a module).
# Call captureCreateProject("<new run>/fixture"). Remove only the auto-created dev project,
# whose bare UUID is in this fresh server's projection_projects table.
# Keep dark theme, 1440x900 CSS, DPR 2, details open, sidebar visible.
#
# R1: seed('capture-r1','Feature branch switch','theo/edge').
# Select its sidebar row. Wait for full PR details, fonts, no animations and a stable screen.
# Record, then send('capture-r1','capture-r1-turn-1',
# 'Replay a turn while the test driver switches the checkout to another feature branch externally.').
# Await pending Replay approval; external git switch theo/update-13.4.0; approve('capture-r1').
# Await completed run, ready checkpoint, succeeded checkpoint.capture and discovered PR.
# Capture endpoint. Baseline keeps theo/edge + PR 2; head adopts theo/update-13.4.0 + PR 12.
#
# R2: archive R1. Seed('capture-r2','Default branch guard','theo/update-13.4.0').
# Send warmup 'Replay a warmup turn before the default branch guard scenario.'.
# Accept approval, await finalization. Select row and wait for rendered code/PR details.
# Record, send second turn 'Replay another turn while the test driver switches the checkout to the default branch externally.'.
# Await approval, external git switch main, approve. Await finalization.
# Both revisions retain stored feature + PR 12 while actual Git is main. Capture endpoint.
#
# R3: archive R2, external git switch theo/edge. Seed('capture-r3','Branch picker switch','theo/edge').
# Send warmup 'Replay a warmup turn before switching branches with the app picker.'.
# Approve, await finalization. Select row, wait for fully rendered code and PR 2.
# Inject picker-observer.js. Record, click [aria-label="Thread details"] [role="combobox"],
# then [role="option"]:has([title="theo/update-13.4.0"]).
# Move pointer to blank header x1100 y26; wait until PR 12 renders and record through it.
# Baseline may retain PR 2 until periodic refresh. Head clears persisted branch PR immediately,
# but the optimistic details branch can display PR 2 briefly before metadata commit.
# Our first baseline take stopped before periodic refresh: the selected baseline recording
# repeats picker edge -> new after restoring edge through the same UI, with no extra turn.
#
# Endpoint-only comparability recaptures revisit the completed threads with archive/unarchive,
# restore the same actual Git ref externally, and use the same pointer x1100 y26 and bottom scroll.
# They never write target thread metadata or PR data. Wait for Git action/status fetches too.
# Run capture-endpoint.js, wait for network/resources and fonts, then take screenshots >=500ms
# apart and require ImageMagick compare -metric AE = 0. Keep source stills.
# normalize.py documents opaque timing-only masks; make-diffs.sh and make-sheets.sh produce pairs.
# transcript.py reads ONLY these synthetic DBs read-only, retaining safe fields and event order.
# Upload scripts, stills, diffs, sheets, recordings and safe transcripts with ghdrop upload -m.
# Replay's pictured commands, edits and test results are simulated; they did not execute.
