Skip to content

Commit 1323345

Browse files
committed
Add 'Promoting Stacked PR to Ready for Review' workflow to CLAUDE.md
Document the complete workflow for promoting a draft stacked PR to ready-for-review after its base PR has been merged to main. Includes: - Prerequisites and validation steps - 10-step detailed workflow (verify, rebase, push, update, test) - Full example commands from AIML-224 experience - Common issues and troubleshooting guidance - User experience phrases: 'move stacked PR to ready', 'promote stacked PR', etc. This codifies the process used successfully for PR #25 (AIML-224).
1 parent e02a128 commit 1323345

File tree

1 file changed

+137
-0
lines changed

1 file changed

+137
-0
lines changed

CLAUDE.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,143 @@ EOF
328328
2. This PR is rebased onto main
329329
3. CI/CD passes on the rebased code
330330

331+
### Promoting Stacked PR to Ready for Review
332+
333+
**When user says "move stacked PR to ready for review", "promote stacked PR", or "finalize stacked PR":**
334+
335+
This workflow promotes a draft stacked PR to ready-for-review after its base PR has been merged to main.
336+
337+
**Prerequisites:**
338+
- Base PR must be merged to main
339+
- All tests must be passing on the stacked branch
340+
- PR is currently in draft status targeting the base PR's branch
341+
342+
**Steps:**
343+
344+
**1. Identify PR context:**
345+
- Determine which PR to promote (by PR number or current branch)
346+
- Identify the base PR it depends on
347+
- Example: "Which PR should I promote?" or infer from current branch
348+
349+
**2. Verify base PR is merged:**
350+
```bash
351+
gh pr view <base-pr-number> --json state,mergedAt,baseRefName
352+
```
353+
- Must show `state: "MERGED"`
354+
- Note when it was merged for reference
355+
- If NOT merged, inform user and wait
356+
357+
**3. Fetch and rebase onto main:**
358+
```bash
359+
git fetch origin
360+
git checkout <feature-branch>
361+
git rebase origin/main
362+
```
363+
- Handle conflicts if they arise (pause and ask user for guidance)
364+
- Clean rebase expected for well-structured stacks
365+
366+
**4. Force push safely:**
367+
```bash
368+
git push --force-with-lease origin <feature-branch>
369+
```
370+
- Use `--force-with-lease` (NOT `--force`) for safety
371+
- Prevents overwriting if branch was updated elsewhere
372+
373+
**5. Update PR base branch:**
374+
```bash
375+
gh pr edit <pr-number> --base main
376+
```
377+
- Changes PR from targeting base branch to targeting main
378+
- GitHub will update the diff automatically
379+
380+
**6. Update PR description:**
381+
- Remove "DO NOT MERGE" and dependency warnings
382+
- Remove stacked PR notes about targeting other branches
383+
- Add line confirming rebase: "Rebased onto main after #<base-pr> merged"
384+
- Update test counts if they changed
385+
- Keep all other content (Why/What/How/Testing)
386+
387+
Example:
388+
```bash
389+
# Create updated description in temp file
390+
gh pr view <pr-number> --json body -q .body > /tmp/pr_body.txt
391+
# Edit to remove warnings and add rebase note
392+
gh pr edit <pr-number> --body-file /tmp/updated_pr_body.txt
393+
```
394+
395+
**7. Mark PR ready for review:**
396+
```bash
397+
gh pr ready <pr-number>
398+
```
399+
- Removes draft status
400+
- PR is now visible in review queue
401+
- CI/CD should trigger automatically
402+
403+
**8. Verify tests pass:**
404+
```bash
405+
mvn clean verify
406+
```
407+
- Run full test suite to verify rebase didn't break anything
408+
- Address any failures before proceeding
409+
- Check CI status on GitHub
410+
411+
**9. Update bead (if applicable):**
412+
- Update bead notes with PR status: "Rebased onto main, ready for review"
413+
- Keep bead in `in_progress` status with `in-review` label
414+
- Don't close until PR is merged
415+
416+
**10. Confirm completion:**
417+
- Provide PR URL to user
418+
- Confirm tests passing
419+
- Note CI status
420+
- Summary: "PR #<number> rebased onto main and ready for review"
421+
422+
**Example full workflow:**
423+
```bash
424+
# Check base PR merged
425+
gh pr view 24 --json state,mergedAt
426+
# Output: {"state":"MERGED","mergedAt":"2025-11-12T21:44:33Z"}
427+
428+
# Fetch and rebase
429+
git fetch origin
430+
git checkout AIML-224-consolidate-route-coverage
431+
git rebase origin/main
432+
# Output: Successfully rebased and updated refs/heads/AIML-224-consolidate-route-coverage
433+
434+
# Force push
435+
git push --force-with-lease origin AIML-224-consolidate-route-coverage
436+
437+
# Update PR
438+
gh pr edit 25 --base main
439+
gh pr edit 25 --body-file /tmp/updated_description.txt
440+
gh pr ready 25
441+
442+
# Verify
443+
mvn clean verify
444+
```
445+
446+
**Common Issues:**
447+
448+
**Rebase conflicts:**
449+
- Pause and show user the conflicts
450+
- Ask for guidance on resolution
451+
- Don't attempt to auto-resolve without user input
452+
453+
**Base PR not merged:**
454+
- Inform user: "Base PR #<number> is not yet merged (status: <state>)"
455+
- Wait for user instruction
456+
- Don't proceed with promotion
457+
458+
**Tests fail after rebase:**
459+
- Report failures to user
460+
- Keep PR in draft until tests pass
461+
- Investigate if rebase introduced issues
462+
463+
**CI not triggering:**
464+
- GitHub CI may take a few minutes to start
465+
- Verify workflow configuration targets main branch
466+
- Check `.github/workflows/` for PR triggers
467+
331468
### Landing the Plane
332469

333470
**When user says "let's land the plane":**

0 commit comments

Comments
 (0)