#!/usr/bin/env bash
# Real-service mobile reproduction. Run once from each tested checkout with a fresh home.
# Arguments: evidence root, fresh T3 home, backend port, device-reachable host, session.
set -euo pipefail
root="$1"
app_home="$2"
port="$3"
host="$4"
session="$5"
# Start that checkout's isolated server and Metro first, with T3CODE_DEV_SEED=0.
# Keep the same iPhone 18 Pro (iOS 27.2), light theme and 402x874 capture size.
if [[ ! -d "$root/acme/gh-checkout" ]]; then
  git clone --quiet --depth 1 https://github.com/juliusmarminge/trpc-interop.git "$root/acme/gh-checkout"
fi
if [[ ! -d "$root/acme/gl-checkout" ]]; then
  git clone --quiet --depth 1 https://gitlab.com/juliusmarminge/trpc-interop.git "$root/acme/gl-checkout"
fi
T3CODE_PORT="$port" node apps/server/src/bin.ts project add "$root/acme" --title acme --base-dir "$app_home"
.agents/skills/test-t3-mobile/scripts/pair-client.sh "$port" "$app_home" "http://$host:$port" agent-device --session "$session"
# In the app: PRs > More filters > Project > acme.
# Wait for both rows and their line counts, then take two screenshots >=500ms apart.
# Base observed: both rows +6/-0 after filtering (both +40/-9 before filtering).
# Head observed: GitLab +40/-9; GitHub +6/-0.
# The real GitHub API confirms its request's counts:
gh api repos/juliusmarminge/trpc-interop/pulls/1 --jq '{title,additions,deletions}'
# For GitLab, inspect the real diff; the fixture changes 9 old lines to 40 new lines.
glab api projects/juliusmarminge%2Ftrpc-interop/merge_requests/1/diffs
