# Verify a GitHub pull request in a disposable worktree

These commands require Git and access to the GitHub repository. Replace `123` with
the pull-request number. Run the commands from the main repository checkout.

## 1. Fetch the pull-request revision

```bash
git fetch origin pull/123/head:refs/remotes/origin/pr/123
```

## 2. Create a detached worktree

```bash
git worktree add --detach ../verify-pr-123 refs/remotes/origin/pr/123
cd ../verify-pr-123
git status --short
```

The final command must produce no output. If it lists files, stop and resolve the
unexpected state before verification.

## 3. Optionally isolate Docker Compose services

Use these commands only when the repository already has a Docker Compose test
environment.

```bash
docker compose -p verify-pr-123 up -d --wait
docker compose -p verify-pr-123 ps
```

The project name isolates Compose containers, networks, and named volumes. It does
not isolate fixed host ports or external databases. Assign unique host ports and a
separate database before running concurrent sessions.

## 4. Run the independent verification prompt

Start a new coding-agent session inside `../verify-pr-123`. Paste the contents of
`independent-review-prompt.md`. Use the repository's real focused test and local CI
commands in the prompt.

Common full-suite commands are shown below. Use only the command that the repository
defines as its gate.

```bash
go test ./...
npm test
python -m pytest
```

## 5. Remove the disposable environment

Run this inside the worktree if Docker Compose was started:

```bash
docker compose -p verify-pr-123 down -v
```

Return to the main checkout, then remove the worktree:

```bash
cd ../your-main-checkout
git worktree remove ../verify-pr-123
git worktree prune
```

Do not add `--force`. A refusal to remove the worktree can indicate that the
verifier did not restore its deliberate change.
