# Git status connection / checkout race

This driver talks to an unmodified T3 Code server over authenticated HTTP and
WebSocket RPC, runs real Git checkouts, and records incoming stream events.
It does not use a model, fake provider, server hooks, or a copied database.

Start each side from its own checkout with installed dependencies and a fresh home:

```sh
T3CODE_DEV_SEED=0 vp run dev:server --port <port> --home-dir <fresh-home> --no-seed
node driver.mjs <checkout> <fresh-home> http://127.0.0.1:<port> <new-output-directory> <commit> 30 3000
```

Repeat with `5 20000` for the longer observation batch. The same deterministic
0–120ms delay sequence is used on both commits: `(trial * 37) % 121`.

For each trial the driver checks out first-branch, waits 1.5s without a status
subscriber, starts local-only refresh and a new status subscription, checks out
second-branch after the selected delay, waits 3s (or 20s), and compares retained
stream state to `git rev-parse --abbrev-ref HEAD`. Snapshot/localUpdated replace
the retained branch; remoteUpdated leaves it unchanged, matching the real client's
applyGitStatusStreamEvent behavior for refName. The subscriber closes between trials.
Trials with checkout errors or no initial snapshot are excluded.

`trace.jsonl` is timestamped stdout; `results.json` contains every counted trial
and its event sequence. The MP4 files are visualizations of that captured stdout
at its recorded timestamps, not browser or desktop recordings. The PNG files
summarize a representative completed trial and the batch count. No frontend
rendering is claimed by these server-level captures.

`render.py <output-directory> Before` (or `After`) renders the trace with Pillow
and ffmpeg. The driver uses the Node version pinned by this repository.
