#!/usr/bin/env bash
set -euo pipefail
# Rebuild the real app fixture; no database rows are copied or manufactured.
# Pass a NEW timestamped evidence directory. Pairing URLs in the private logs
# are credentials: never upload those logs or the created T3 homes.
capture_run=${1:?Usage: start-fixtures.sh NEW_TIMESTAMPED_RUN_DIRECTORY}
mkdir -p "$capture_run"
git -C /home/ubuntu/t3code worktree add /home/ubuntu/wt/issue-27010-before 37fbefd147197fab9d88f9c120560c3f21b52cfc
(cd /home/ubuntu/wt/issue-27010-before && vp install) > "$capture_run/before-install.log" 2>&1
(
  cd /home/ubuntu/wt/issue-27010-before
  T3CODE_DEV_SEED=0 vp run dev --home-dir "$capture_run/before-home"
) > "$capture_run/before-server.log" 2>&1 &
echo $! > "$capture_run/before.pid"
(
  cd /home/ubuntu/wt/issue-27010
  T3CODE_DEV_SEED=0 vp run dev --home-dir "$capture_run/after-home"
) > "$capture_run/after-server.log" 2>&1 &
echo $! > "$capture_run/after.pid"
# Read [dev-runner]'s actual web ports and pairingUrl from these logs.
# In separate preview_open(reuseExistingTab:false) tabs, open each pairing URL.
# If needed, type its token into Pairing token and click Continue.
# Navigate to /settings/devices. No Update/Check action is clicked in this proof.
# Run session-init.js in each tab. capture-driver.js drives the remaining UI.
# The fixture is the default all-project/all-environment scope with both tools
# absent, both switches off, and no user messages. No installation is performed.
