#!/usr/bin/env bash
set -euo pipefail
# Synthetic evidence only. Run each side against a new worktree-local .t3.
# Never read/copy ~/.t3 or the lead worktree. Never commit this directory.
ROOT=/tmp/lead-23986-r1/evidence-capture
SIDE=${1:?before or after}
CHECKOUT=/home/ubuntu/wt/pr-23986-$SIDE
# Worktree creation/installation (performed once):
# git -C /home/ubuntu/t3code worktree add --detach /home/ubuntu/wt/pr-23986-before 96fc7b955196637605cbf3b415152ce4dd0e2294
# git -C /home/ubuntu/t3code worktree add --detach /home/ubuntu/wt/pr-23986-after 9bb5ad261362d7464674d8c47b7c576e70c0b45d
# cd "$CHECKOUT"; vp install
# T3CODE_DEV_SEED=0 vp run dev:server --host 0.0.0.0
# Read the actual server port; 15303 before, 15658 after in this run.
# From apps/mobile: REACT_NATIVE_PACKAGER_HOSTNAME=fs-06.tail131df4.ts.net vp run dev:client --port 8081 (before) or 8082 (after).
# Prepare both cached dev clients before leasing: vp run mobile:install ios --prepare; android --prepare.
# agent-device connect proxy --daemon-base-url "$SIMLOCK_AGENT_DEVICE_URL" --session NAME
# agent-device open --platform ios --device "iPhone 17 Pro" --session NAME
# agent-device open --platform android --device "Pixel 9"/"Pixel Tablet"/"Pixel 9 Pro Fold" --session NAME
# vp run mobile:install PLATFORM --session NAME (Android adds --metro http://fs-06.tail131df4.ts.net:8081)
# Pair each side using .agents/skills/test-t3-mobile/scripts/pair-client.sh PORT "$CHECKOUT/.t3" http://fs-06.tail131df4.ts.net:PORT agent-device --session NAME
# Never upload pairing links/auth files or server logs.
PORT=${2:?actual server port}
cd "$CHECKOUT"
vp exec node "$ROOT/seed-auth.mjs" "$CHECKOUT" "$PORT" "$SIDE"
vp exec node "$ROOT/seed.mjs" "$CHECKOUT" "$PORT" "$SIDE"
# Seed creates E0 threads proof-empty-23986-{ios,android,tablet,fold}, no turns.
# Open t3code-dev://threads/ENVIRONMENT_ID/THREAD_ID after the environment is connected.
# Set explicit app Appearance, default Text=16; OS text size large (Android font_scale=1.0).
# iPhone dark and Pixel light: GPT-6.1-Sol/Extra High/Standard, no instance badge, app mic absent.
# Tablet light: maximize content; landscape; GPT-6.1-Sol/Extra High/Standard.
# scenarios.py NAME SIDE ios-focus|android-focus|wide runs the saved scripts.
# Some iOS empty text fields have no AX node: use screenshot-verified x150,y810 to focus.
# On iOS use x200,y200 to blur; the before AX placeholder container can resolve into the composer.
# Use a 5-second final hold; inspect the native movie for the final keyboard transition.
# Settings: manual-steps.sh NAME ios|android. Choose GPT-6-Luna then save.
# Wide label: choose Claude Opus 5.5/Medium; fill the exact 47-char draft in label-scenario.py.
# Configure GPT-6-Luna Low/Standard once on both sides, then return to Claude before the label scenario.
# label-scenario.py NAME SIDE appends ultrathink, removes it, opens settings, chooses Luna, saves.
# F20: command.mjs "$CHECKOUT" "$PORT" "$SIDE" '{"type":"thread.settle","commandId":"UNIQUE","threadId":"proof-empty-23986-ios"}'
# Reverse through Un-settle UI (or thread.unsettle with reason=user).
# Images: image-fixture.sh explains the OS media seed. Add through Photo Library on iOS;
# Android Choose Files -> longpress synthetic-image.png -> Select. This is a file-picked image.
# Start recordings only after the image is ready and the editor is actually blurred.
# For F11: rest -> focus -> Remove IMG_0007.png -> type Hi -> x200,y200 -> hold -> stop.
# For F10: rest Hi+image -> focus -> preview -> Back -> feed tap blur -> focus -> remove -> Hi -> Back.
# Terminal: Open terminal; focus terminal; Back; refocus; Dismiss keyboard; refocus; Back.
# Fold attempts used fold-scenario.py; rejected because Android native recording clips during pose changes.
# Do not attach CDP while recording: metadata attempts caused a Metro reload in one rejected image run.
# Every driver writes timestamped steps.jsonl; scripts and public step bundle are uploaded separately.
