Skip to content

Commit 24b8f86

Browse files
cliffhallclaude
andcommitted
docs(pr-flow): catch up and re-test before merging when v2/main moved
AGENTS.md gains the rule: a PR is caught up and re-tested before it merges when v2/main moved in a way that can interact with it, with a definition of "can interact" that is cheap to check. pr-flow step 10 gains the recipe: list what the PR's head lacks, decide, merge origin/v2/main into the branch, gate, push, wait for CI, plus the fan-out ordering note. Also corrects step 6's pointer to the close-out step (9 -> 10) and adds a trigger eval case for the new step; the description is unchanged. Closes #5589 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: cliffhall <cliff@futurescale.com>
1 parent 7f383a8 commit 24b8f86

3 files changed

Lines changed: 120 additions & 1 deletion

File tree

‎.claude/skills/pr-flow/SKILL.md‎

Lines changed: 103 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ gh pr view "$PR" --repo modelcontextprotocol/servers \
252252
```
253253

254254
The link does **not** make the issue close on merge into `v2/main`; that is
255-
still done by hand in step 9.
255+
still done by hand in step 10.
256256

257257
Then move the card to **In Review** (`/board-ops`). The PR itself never goes on
258258
the board.
@@ -407,6 +407,108 @@ the PR shows why the loop ended.
407407
408408
Merging is a maintainer's decision. Do not merge on your own initiative.
409409
410+
### Before the merge: catch up if `v2/main` moved
411+
412+
The rule is in `AGENTS.md` **Issue-driven work style**: a PR is caught up and
413+
re-tested before it merges when `v2/main` moved in a way that can interact
414+
with it. CI here runs on **push**, on the branch's head commit, and the gate
415+
ran in your worktree, so neither has seen anything that landed on `v2/main`
416+
after the branch last took it in. GitHub's "no conflicts with the base branch"
417+
compares text and tests nothing: #5564 and #5567 were each green and cleanly
418+
mergeable, merged ten minutes apart, and left `v2/main` failing `ruff check`
419+
(#5569).
420+
421+
**1. List what the PR's head lacks.** From any checkout of this repo:
422+
423+
```sh
424+
PR=<PR>
425+
git fetch origin v2/main "refs/pull/$PR/head"
426+
HEAD_SHA=$(gh pr view "$PR" --repo modelcontextprotocol/servers \
427+
--json headRefOid --jq .headRefOid)
428+
429+
# Commits on v2/main that the head does not hold. Nothing printed: the PR was
430+
# tested on the current tip, so there is nothing to catch up.
431+
git log --oneline "$HEAD_SHA..origin/v2/main"
432+
433+
# The files each side changed since the two diverged.
434+
LANDED=$(git diff --name-only "$HEAD_SHA...origin/v2/main")
435+
MINE=$(git diff --name-only "origin/v2/main...$HEAD_SHA")
436+
437+
# Check A: servers that both sides touched.
438+
comm -12 <(grep -oE '^src/[^/]+/' <<<"$LANDED" | sort -u) \
439+
<(grep -oE '^src/[^/]+/' <<<"$MINE" | sort -u)
440+
441+
# Check B: repository-wide configuration, on either side: a root manifest,
442+
# lockfile, config file or dotfile, scripts/, or a workflow.
443+
WIDE='^([^/]+\.(json|js|mjs|cjs|ts|toml|ya?ml)|\.[^/]+|scripts/.*|\.github/workflows/.*)$'
444+
grep -E "$WIDE" <<<"$LANDED" | sed 's/^/landed: /'
445+
grep -E "$WIDE" <<<"$MINE" | sed 's/^/mine: /'
446+
```
447+
448+
**2. Decide.**
449+
450+
| The listing shows | Then |
451+
| --- | --- |
452+
| No commits | Nothing to do. Merge on green CI |
453+
| Commits, and checks A and B both print nothing | What landed cannot interact with the PR. No catch-up needed |
454+
| Check A prints a server, or check B prints any path | **Catch up** (below) |
455+
| Anything you are unsure of | **Catch up**. The checks are deliberately coarse, and a gate run is cheaper than a red `v2/main` |
456+
457+
A server's own configuration (`pyproject.toml`, `uv.lock`, `tsconfig.json`,
458+
`vitest.config.ts`) is inside its directory, so check A covers it: that is the
459+
#5569 case, where a `requires-python` bump changed which lint rules applied to
460+
code another PR was adding.
461+
462+
**3. Catch up**, in the PR's worktree:
463+
464+
```sh
465+
git fetch origin v2/main
466+
git merge --no-edit origin/v2/main
467+
npm install # the merge may have moved package-lock.json
468+
npm run local:gate; echo "EXIT=$?"
469+
git push
470+
```
471+
472+
- **Merge, never rebase.** A rebase rewrites the commits that were reviewed,
473+
outdates every review thread and needs a force-push. The merge commit is
474+
exempt from the DCO check (step 3).
475+
- **The gate runs on the merged tree before the push**, as before any push
476+
(step 4). A red stage here is the interaction this step exists to find: fix
477+
it on the branch, signed off, and run the gate again.
478+
- **Then wait for CI on the new head**, with one backgrounded command, as
479+
`AGENTS.md` **Waiting on long-running work** says. The `sleep` gives the push
480+
runs time to register; `--watch` on a head with no checks yet exits at once.
481+
482+
```sh
483+
sleep 60; gh pr checks "$PR" --repo modelcontextprotocol/servers \
484+
--watch --interval 30; echo "EXIT=$?"
485+
```
486+
487+
- **A catch-up that merged without conflicts and passed the gate unchanged
488+
needs no new Copilot round.** Nothing the PR adds changed. One that needed a
489+
conflict resolved or a fix pushed changed the PR, so request a round (step 9).
490+
- **If `v2/main` moves again before the merge, run step 1 again.** It costs
491+
one fetch, and most of the time it prints nothing that interacts.
492+
493+
**Fan-outs.** When several PRs for one server are open at once, a PR that
494+
changes that server's **configuration** (a language floor, lint or compiler
495+
settings, a dependency major) interacts with every one of them. Merge it
496+
**last**, after catching it up on the others, or merge it first and catch up
497+
and re-test each of the others after it. The open PRs that touch a server:
498+
499+
```sh
500+
gh pr list --repo modelcontextprotocol/servers --base v2/main --state open \
501+
--limit 200 --json number,title,files \
502+
--jq '.[] | select(any(.files[]; .path | startswith("src/fetch/")))
503+
| "\(.number) \(.title)"'
504+
```
505+
506+
Nothing enforces this step: `v2/main`'s ruleset requires no status checks, so
507+
it is done by hand by whoever merges. Whether a merge queue or a required
508+
up-to-date check should take it over is #5588.
509+
510+
### After the merge
511+
410512
**On merge into `v2/main`, close the issue by hand and move its card to
411513
Done**, since auto-close does not fire there:
412514

‎.claude/skills/pr-flow/evals/evals.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
"prompt": "My PR into v2/main just merged. What do I still need to do to close it out?",
2424
"expect": "pr-flow"
2525
},
26+
{
27+
"prompt": "My PR is green and GitHub says it has no conflicts, but another PR for the same server merged into v2/main ten minutes ago. What do I have to do before it can merge?",
28+
"expect": "pr-flow"
29+
},
2630
{
2731
"prompt": "What does this regex match? /^[a-z]+$/",
2832
"expect": null

‎AGENTS.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,19 @@ here.
600600
declined finding that is worth doing gets its own issue, linked in the
601601
reply. The rule is under
602602
[Responding to code reviews](#responding-to-code-reviews).
603+
- **Before a PR merges, it is caught up and re-tested if `v2/main` moved in a
604+
way that can interact with it.** GitHub reporting no conflicts is not that
605+
test: it compares text, and the gate and CI ran on the PR's head, which
606+
holds nothing that landed on `v2/main` after the branch last took it in. Two
607+
fetch PRs that were each green left `v2/main` red that way (#5569). What
608+
landed **can interact** when it touches a server directory
609+
(`src/<server>/`) the PR also touches, or when either side touches
610+
repository-wide configuration: a root manifest, lockfile or configuration
611+
file, `scripts/`, or `.github/workflows/`. When in doubt, re-test. Catching
612+
up is a merge of `origin/v2/main` into the branch, never a rebase, then the
613+
gate, a push, and green CI on the new head. `v2/main`'s ruleset requires no
614+
status checks, so this is on whoever merges. The recipe is the `pr-flow`
615+
skill (step 10).
603616
- **If new tasks are discovered during development, create issues** for them
604617
and put them on the board, rather than widening the current PR.
605618

0 commit comments

Comments
 (0)