# Checkpoint baseline read: real-server measurement

Use macOS with Node and this repository's `vp` toolchain. Create two independent checkouts named `base` and `head` inside a new run directory, and run `vp i` in each. Base is [54140c6f17](https://github.com/pingdotgg/t3code/commit/54140c6f179fde39248d6b74b2499e105562e985); head is [d35cd69b6e](https://github.com/pingdotgg/t3code/commit/d35cd69b6e2dd44fda32937987772953a040ff56).

Place these scripts together outside the checkouts. Run:

```sh
python3 drive.py RUN_DIRECTORY/base RUN_DIRECTORY/base-full 1400
python3 continue.py RUN_DIRECTORY
```

`continue.py` runs the same fresh 1,400-turn workload on head, then alternates six independently restarted server processes in base/head/head/base/base/head order. Each restart adds 96 turns to its own existing synthetic history. The first 16 native-query observations in each process are warm-up; each reported process median has 80 samples. Both sides finish with 1,688 turns. No database is transferred between commits.

Every action is a real `t3 thread start` or `t3 thread send --wait` command, against a real source server, using the repository's existing Replay `multi-turn` recording. Each server owns its data directory and a free loopback port. The driver appends one synthetic line to a tracked `history.txt` before each turn and waits for the corresponding persisted checkpoint before proceeding. Debug tracing is enabled identically on both commits. No UI is used.

The initial runs retain the ordinary Effect SQLite spans and full capture spans, including the 769–1,031 and 1,024–1,031 buckets. The restarted runs also load `sqlite-probe.cjs` into the server. That observational preloader forwards the original SQL, arguments, iterator, and results. It measures the real native statement execution and row materialization and records actual returned row counts. For reader-worker queries it times the original SQLite iterator and the existing row-building loop, ending before `parentPort.postMessage`; it does not wrap individual rows or change the iterator. For in-process queries it times `StatementSync.all`. Its clock excludes SQL preparation, IPC, Effect scheduling, and writing the profiling record. The restarted driver brackets actual turn actions in `segments.json`; any startup recovery reads remain in the raw native log and are exported separately as `startup-recovery.ndjson`, outside the timed action windows. A final read-only CLI call drains the server before shutdown. This distinguishes database work from the asynchronous span overhead that affected the earlier capture. It does not claim an end-to-end capture speedup.

`edges.py` creates a separate fresh five-turn history per commit: normal repository; Git metadata temporarily moved away; repository restored; Git config made invalid; config restored. This exercises missing/error checkpoint preservation without fabricating provider responses or writing database rows.

`extract.py` exports selected real server timings and canonical persisted checkpoint/event fields, omitting generated identifiers and timestamps. `verify-git.py` checks every ready checkpoint's actual Git blob against the expected synthetic file content. The unfiltered server logs are intentionally private because they contain local filesystem paths.

To compare exported artifacts and create the measurement charts, place `base-export`, `head-export`, `base-edges-export`, `head-edges-export`, `batches.json`, and `environment.json` in one directory and run:

```sh
python3 compare.py EXPORTED_DIRECTORY
```

This last command requires ImageMagick's `convert`. The JSON files and charts are measurements from the real server, not unit-test results.
