# Real-app reconnect proof

Surface: web dev client in the shared Chromium preview, 1280x800 CSS pixels, dark theme (captures at device scale 2). Each client ran with an empty isolated data directory and no live-install seed. The factory T3 Connect relay and its real Clerk test account were used. No tests, mocked relay responses, fake accounts, or protocol stand-ins were used.

Base client: 399e8087a02162d9c8436af704683dc1476abfb1.
Head client: be5338aff20057aee55706a898772844877d8b07.
Historical protocol-1 host: 024d49520e (the parent of the real protocol-2 migration).

## Setup

1. Install dependencies in the two isolated checkouts. The historical checkout needs `CI=true vp i` when replacing newer dependencies without a TTY.
2. Source the private factory test-stage configuration. Never publish it or the raw CLI logs.
3. On the historical host, run the actual `connect link --headless` CLI, accept the relay-client installation, and approve the device login through Clerk with the supplied test account.
4. Start the historical host with `serve --host 0.0.0.0 --port 14601 --base-dir <legacy-home>`. Confirm its real tunnel registers and its descriptor reports protocol 1. Stop it, then copy this synthetic home to an upgrade home. This preserves identity without trying to downgrade a migrated database.
5. Run `host-driver.py <historical-checkout> <current-checkout> <legacy-home> <upgrade-home> <run-directory>`. Input `current` starts the real compatible host; `legacy` starts the real old host; `quit` stops the driver's child. Each transition waits for the descriptor and logs its actual protocol and timestamp. Tunnels are real and need time to become reachable after restart.

## Same compatibility/recovery flow on both clients

1. Start the appropriate commit with `T3CODE_DEV_SEED=0 vp run dev`, using isolated client data and an unused port. Pair through its printed URL, open Settings, and sign in to the real factory T3 Connect account. The second client reused the browser's valid Clerk session.
2. Settings > Environments > List: Add the intended online host. Wait for `via LAN · Connected` with its switch on and `4 routes`. Expand Routes to verify two LAN addresses and a Tailscale address say `found automatically`, alongside T3 Connect; collapse the routes again.
3. Start recording. Send `legacy` to the host driver. Wait for the old tunnel to become reachable. Navigate General > Environments > List to remount discovery (the same refresh as closing/reopening Settings). Confirm `LAN · Client not supported`, switch unchecked and `aria-disabled=true`.
4. Send `current` to the same host driver. Confirm the real descriptor reports protocol 2. Remount discovery with the exact same navigation. Install `browser-driver.js` through preview_evaluate, then use `await proof.refresh(environmentId)` to perform that navigation and read the actual app discovery state. It does not change any compatibility or connection state.
5. Observe the received relay status is `online`, has a new `checkedAt`, and its descriptor protocol is 2. Do not touch the environment switch. On base it stays `LAN · Client not supported`, off and disabled for more than three minutes. On head it automatically turns on and returns to `via LAN · Connected` with four routes.
6. For still captures, take two screenshots at least 500 ms apart and compare the cropped images; both pairs were pixel-identical. Recordings show the transition and refreshes. Images and videos are cropped to the header and tested row, with the host name masked for privacy. The public status, route count, and switch remain unchanged.

## Deliberately disabled check on head

After successful reconnect, switch the host off explicitly. Repeat `legacy`, refresh to receive protocol 1, `current`, refresh to receive protocol 2. In this extra pass, the historical host reused a deleted tunnel token, so its normal `connect unlink` / `connect link --headless` flow was used, and the upgrade home was copied from that relinked synthetic home before the real upgrade. The client environment was neither removed nor enabled during this repair. Confirm compatibility clears, the switch becomes available, and its checked state remains false.

The scenario runner was not used because this starting state depends on a separately linked real relay host and a historical-server upgrade, rather than project/thread seeding. The Python driver controls real host processes and the browser driver navigates the real client.
