# PR worktree local-commit reproduction

Both sides run the real web client and server from their respective commits, with separate fresh T3 homes, no live database seeding, the replay provider selected, a light theme and a 1280 by 800 CSS viewport. No agent turn is needed for this checkout operation.

1. Run `python3 seed.py <disposable-project-directory>`. This fetches the open same-repository fixture PR's branch, adds a synthetic `LOCAL-WORK.txt` commit without pushing, records its SHA, and returns to `main`. No worktree has the PR branch checked out.
2. Add the prepared repository through `node apps/server/src/bin.ts project add <disposable-project-directory> --title 'Local commit preservation' --base-dir <isolated-home>`.
3. Pair the browser with that isolated server. Open Pull requests, search for `35618`, and select the result.
4. Start recording. Choose Check out, then In a separate worktree. Capture the resulting notification. Stop recording.
5. Independently inspect `git rev-parse perf/server-test-shards`, the new worktree's `git rev-parse HEAD`, and `git branch --contains <recorded-SHA>`.
6. In the app's terminal for the new worktree, run the following, substituting the recorded local SHA. Use a neutral shell prompt to keep hostnames and internal paths out of evidence.

```sh
clear
printf 'Recorded unpublished commit: <recorded-SHA>\n\nWorktree HEAD:\n'
git --no-pager log -1 --format='%h %s'
printf '\nBranches containing the recorded commit:\n'
git branch --contains <recorded-SHA>
printf '\nLocal file: '
if test -f LOCAL-WORK.txt; then echo PRESENT; else echo MISSING; fi
```

7. Blur the terminal. Take two screenshots at least 500 ms apart and compare them pixel-for-pixel; retain the second only when identical. Both retained terminal captures passed with zero differing pixels.

Fixture: [#35618](https://github.com/pingdotgg/t3code/pull/35618), branch `perf/server-test-shards`, published head `e5b851c968844bc637b835e395d20dc018d3edca`. The PR being fixed is a fork PR; this fixture exercises the requested same-repository case without any forge writes.

Base: [0bc993ac09](https://github.com/pingdotgg/t3code/commit/0bc993ac09be75c679c7c3a3c9ddbf9a4024477d). App reports Checked out; branch and worktree move to the published head; no branch contains the recorded local commit; LOCAL-WORK.txt is missing.

Head: [20acbb718f](https://github.com/pingdotgg/t3code/commit/20acbb718fc2eedc7d6282ea5c76e64dd41a2d7c). App reports Checked out, but not confirmed on the latest commit; branch and worktree retain the recorded local commit; LOCAL-WORK.txt is present.

AI-assisted; verified with the tests and tools listed above.
