# Phase 3 User Test (Copilot CLI orchestrator)

Optional, interactive. Lets the user test the code before the PR. The prompt MUST say
that yes **removes the worktree and checks the branch out locally**, or the side effect
is implicit. Pickers follow `$HOME/.claude/multi-agent-refs/picker-contract.md`.

0. **Test Gap Report (advisory)**  -  before the local-checkout prompt run `node $HOME/.claude/scripts/test-gap-scan.mjs --base "$BASE_BRANCH" --stack <ios|android|python|node>` to surface public symbols added in this branch that have no paired test. Heuristic, deterministic, sub-second, never gates by default. iOS `*View.swift` / Android `@Composable` symbols default to `important` severity; other public API additions to `suggestion`. Optional gating via `prefs.testGap.blockingThreshold` (loops back to Phase 2 rework when the important+blocking count exceeds the threshold). Disabled when `prefs.testGap.enabled = false`.
1. **Ask** with a native `AskUserQuestion` picker (never a typed y/N prompt). The options MUST make the local-checkout side effect explicit  -  testing removes the worktree and checks the branch out into the main repo:
   - `question`: "Check out locally to test now?" (rendered in `outputLanguage`)
   - `header`: "Test" (English, <=12 chars)
   - `options`:
     - `{ label: "Test now", description: "Removes the worktree and checks the branch out into the main repo for Xcode / manual test" }`
     - `{ label: "Skip", description: "Stay in the worktree and go to Phase 4" }`
   - **Skip** → go to Phase 4
   - **Test now** → continue:
2. **Remove the worktree and switch to the branch** (automatic):
   ```bash
   cd {project-root}
   git worktree remove .worktrees/PROJ-{id}
   git checkout {branch-name}
   ```
3. **Give test instructions**:
   ```
   🧪 Switched to branch: {branch-name}

   To test:
     • SourceTree → check the commits and diff
     • Xcode → open the app's `.xcworkspace` → Cmd+B → Cmd+U
     • Manual test on the Simulator

   ✅ "tamam" → proceeds to Phase 4
   ❌ "fix: ..." → worktree is recreated, returns to Phase 2
   ```
4. **Pause and wait**: Wait for the user's response
5. **If a fix is needed**:
   - Recreate the worktree: `git worktree add .worktrees/PROJ-{id} {branch-name}`
   - Return to Phase 2
6. Log: `🧪 Phase 3: Review (user test)  -  {result}`

> ⚠️ Commits live on the branch  -  removing the worktree does NOT delete the commits.
