# Workflow refresh performance capture

Run on Linux x86_64 with Node v26.14.0, using each revision's real T3 Code server, migrations, file-backed SQLite database, CLI workflow starts, and authenticated `workflows.subscribe({changes:true})` WebSocket stream. No database rows are inserted by the driver and no provider is simulated.

Revisions:
- Before: b77fb7ebacbd072d36705ab280475ad1cefb90ac (merge-base of origin/main and the head)
- After: cd045b0a8b1eb4acd6cae9c8d0420256513e30b3

For each checkout, install dependencies with `vp i`, run `python3 instrument.py CHECKOUT`, copy `driver.ts` to `CHECKOUT/apps/server/bench-driver.ts`, and from `CHECKOUT/apps/server` run `node bench-driver.ts NEW_OUTPUT_DIRECTORY ABSOLUTE_PATH_TO_BENCH_WORKFLOW_TS`. Run the sides sequentially on the same machine. The output directory must be fresh. The driver stops its captured server process when finished.

`instrument.py` adds the same timing probes to both revisions: snapshot calculation starts at evaluation of `snapshot` and ends when its workflows/runs/questions result resolves; query timing starts at evaluation of `WorkflowStore.progress` and ends after SQL returns. Snapshot timing includes the query probe's logging cost. Neither timing includes the watch debounce, serialization/delta calculation, network transit, or browser rendering. Queries are unmodified. The server's stdout instrumentation is parsed into `measurement.json` without publishing startup logs or credentials.

The seed is 59 finished workflows cycling through 3, 6, 12, 24 code steps; 5 skipped after 3 steps; 3 waiting for answers after 3 steps; 1 paused after 3 steps and a failing step; the completed seed workflow; and 1 active workflow running consecutive one-second code steps. This is 70 listed runs. After recording that phase, a second seed adds 434 finished and 245 skipped workflows, plus itself, yielding exactly 750 listed runs. Fresh databases are created by each revision's own server. Workflows are enabled only in that fresh synthetic state.

For each size the driver takes the initial snapshot and 90 subsequent refreshes. It records the first full progress query separately, then captures every refresh and its progress query's ID count and elapsed time. Five consecutive batches of 18 refreshes provide independent median summaries. The active run continues accumulating steps during both phases, just as in the reported reproduction.

Behavior checks are performed against real RPC updates: each change touches only the active run; no static run is removed or updated; no question is opened or closed; active completed-step counts increase monotonically. The report generator also compares the full normalized static run results and state counts between revisions.

`report.py DIRECTORY` reads `base-run-final/measurement.json` and `head-run-final/measurement.json` under DIRECTORY, compares the results, and creates the two PNG summaries and `comparison.json` using ImageMagick. Raw per-refresh observations are included in each `measurement.json`.

A preliminary head run used the RPC's legacy whole-list mode. A preliminary incremental-mode base run captured 70 runs but encountered the paused run's normal automatic retry at five minutes during the 750-run phase. Those partial/preliminary measurements are supplied separately for transparency. The final runs use 90 refreshes per size to finish before that retry, preserving the intended one-changing-run condition. Only the final incremental-mode runs are used in the comparison.
