#!/usr/bin/env bash
# Run manually, one phase at a time. All arguments are new isolated directories.
# No live database is used. Never point SOURCE_HOME at your real HOME.
# 1. In a checkout of historical preview commit
#    6eaab59c972fedd10744f65cd7dfa530dc5f1f91, run vp i.
# 2. Create SOURCE_HOME/.t3 and WORKSPACE (an empty git repository).
#    Start its real server:
# T3CODE_DEV_SEED=0 T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD=0 \
#   node apps/server/src/bin.ts --port 14888 --base-dir "$SOURCE_HOME/.t3" --no-browser
# 3. Issue an owner token into a private file (never upload it):
# node apps/server/src/bin.ts auth session issue --base-dir "$SOURCE_HOME/.t3" \
#   --token-only > "$PRIVATE_TOKEN_FILE"
# 4. Copy seed-driver.ts to apps/server/seed-proof.ts and invoke:
# node apps/server/seed-proof.ts http://127.0.0.1:14888 "$PRIVATE_TOKEN_FILE" "$WORKSPACE"
# 5. Stop this source server. Record SHA-256 of SOURCE_HOME/.t3/userdata/statev2.sqlite.
# 6. In separate fresh checkouts of base and head (vp i in each), run:
# HOME="$SOURCE_HOME" T3CODE_DEV_SEED=0 T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD=0 \
#   vp run dev --seed --home-dir "$PWD/.t3" --port "$SERVER_PORT"
# --seed is explicit so the VM-wide no-seed default stays in the environment;
# HOME points exclusively to the synthetic source. Ports used: base 14889, head 14890.
# An arbitrary custom --home-dir skips first-start seeding; use the worktree .t3.
# 7. Open each printed web pairing URL privately. Complete welcome via Start if shown.
#    Open /, close thread details if displayed, use light theme and 1280x800 viewport.
#    Capture twice 500ms apart; require identical pixels before retaining the still.
# 8. Compare startup logs and retained project/thread list; recheck source SHA-256.
# Base logs the incompatible history then starts empty. Head imports two threads.
# 9. Stop all processes you started and remove your isolated data/checkouts.
