# Real-app route recovery proof drivers

Use a fresh checkout of each recorded commit and install its dependencies. Copy the four TypeScript files beside the repository's scripts/scenarios/t3.ts and start-app.ts helpers. Keep the generated metadata and token files local; they contain pairing credentials.

## Web comparison

1. Set T3CODE_DEV_SEED=0. Start start-app.ts in web mode on 127.0.0.1:47511 with its own fresh scenario home. Set T3_SCENARIO_APP_DIR to the checkout being tested.
2. Run stale-route-manual.ts with PROOF_META pointing to a local JSON output file. It starts a second real T3 server bound to the machine's Tailscale IPv4 address, registers the existing multi-turn replay model, and seeds a project and thread through T3's CLI/RPC.
3. Open the primary pairing URL from the metadata. In Settings > Environments, pair the second server using its hostname and code. Select List and verify Connected / 2 routes. No forwarding server is used.
4. Open the seeded remote thread. Install the upload observer from browser-observer.js. Paste its synthetic PNG through the real composer. Verify a 204 upload at the paired hostname, then remove the draft attachment.
5. Change the OS hosts entry for stale-route-proof.ts.net from the real Tailscale IPv4 address to 127.0.0.2. This makes fresh hostname connections fail while preserving the already-established host socket. The host remains bound to its Tailscale address and its learned IP route remains available.
6. Leave HTTP idle for at least 110 seconds: T3's server retains idle HTTP connections for 95 seconds. Check that a real browser fetch to the hostname fails, and curl to the learned IP returns 200.
7. Send 'second' in chat and observe the recorded replay reply over the live socket. Paste the same PNG. On base the upload fails at the hostname; retrying about 2.5 minutes later fails at the same hostname. On head the failed hostname upload triggers a verified IP reconnect and an automatic 204 retry; another fresh attachment after 2.5 minutes also uploads at the IP.
8. Record Settings after the fault: both runs still show Connected / 2 routes. Do not reload or reconnect during the fault.

For independent authenticated HTTP coverage, restore the hostname, remove/re-pair the disposable environment, and create a scoped test client with the auth session issue CLI. Open Sharing & access on that environment and expand Authorized clients. Install the HTTP observer, repeat the hostname fault and idle period, then revoke that synthetic client. Retry once after route recovery has had time to finish. Base sends both failed requests to the hostname. Head verifies and reconnects to the IP; the second revoke returns 200 there and removes the client.

## Session retention on head

fault-control.py accepts the local web metadata file and all, once, or restore. It affects only new TCP connections to that test server's exact address and port. Established sockets are not blocked.

- all: after HTTP idle expiry, make an authenticated HTTP request. Both origin checks fail and no replacement WebSocket is created. Restore the fault and retry: HTTP succeeds at the original hostname without replacing the live socket.
- once: after HTTP idle expiry, refuse only the first new TCP connection. The authenticated request fails, the supervisor's immediate original-origin probe returns 200, and no replacement WebSocket is created. The subsequent user retry succeeds.

## Native iOS comparison

Run the cached T3 dev client on a leased iPhone 18 Pro, iOS 27.2, with Metro from the checkout under test. Reinstall the app for each side and pair a new fresh server. iOS retained the base catalog in Keychain on reinstall; the head run also contains that disconnected base entry, while only the newly paired head server serves the seeded thread. Run stale-route-native-manual.ts: it starts a real dual-stack T3 host and seeds the same replay thread. Pair the native app to its Tailscale IPv6 literal, retaining the advertised IPv4 route as an alternate.

Start native-wire.py with the native metadata and an output JSONL file before picking the stock Photos image IMG_0111.jpg. The filter retains only HTTP methods, sanitized paths, address-family route labels, and response status. It never retains authorization headers, upload grants, or bodies.

Observe the baseline native upload return 204 over IPv6, then remove the draft attachment. native-fault.py <metadata> block drops only new IPv6 TCP connections to that exact test host port. Existing WebSockets and IPv4 remain available. Wait at least 110 seconds, send 'second' and observe its reply, then choose the same stock photo again. Base remains at 0% for the 2.5-minute observation window. Head's stall check must reconnect and complete the native transfer over IPv4; confirm its actual POST/204 in the wire log. The head recording continues after completion; its upload completes in about 20 seconds, so the failing base observation window is longer. This native fault exercises a silent upload stall; the web comparison separately covers stale hostname resolution.

Always run each fault script with restore, stop retained server/Metro sessions, and release the device. The observers and fault scripts supply diagnostics; the recordings of the actual app supply the behavior evidence.
