Reordering history can accidentally "merge" an intermediate PR in `--direct` mode
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Reproduce the failure with the supplied foo.sh script, using ghstack --direct and repeated interactive reordering against origin/main. Trace the stack update and GitHub PR status changes involved in the reordering; done means swapping the second and third commits repeatedly no longer marks an intermediate PR as merged.
Written by the indexing model from the issue text.
Description
Haven't put a lot of time into understanding this one, was just trying to evaluate ghstack for work on LLVM. The issue was that while editing and reordering commits, one of their PRs was automatically marked "Merged", when I had not merged anything. I assume this is due to the lack of an atomic way to update base branches for several PRs at once, but unsure the exact cause.
Simplest way to reproduce turned out to be to just swap the position of two commits in a stack repeatedly:
#!/bin/bash
stack() {
ghstack --direct || return 1
# attempt to rule out racing against a slow GH or something, doesn't seem to
# matter, and I hit the bug originally while just using the tool by-hand
#sleep 10
}
swap2() {
# swap the 2nd and 3rd `pick` lines in the interactive rebase buffer
GIT_EDITOR='printf "%s\n" 2y 2d x w | ed -s' git rebase -i origin/main
}
init() {
for n in $(seq 4); do
echo $n >> $n && git add -A && git commit -m $n || return 1
done
}
whirl() {
# seems to pretty regularly break on round 3, but add plenty to be sure.
# not actually clear to me if this is deterministic or not
for n in $(seq 10); do
stack && swap2 || {
printf 'failed on round %d\n' $n
return 1
}
done
}
main() {
init && whirl
}
"$@"
Can run as foo.sh main to have it build a short stack and then start swapping and restacking until it breaks.
If there is more info I can share, let me know. I only spent enough time to be sure I wasn't just holding it wrong.
- Dominant language
- Python
- Stars
- 1k
- Forks
- 84
- Avg merge
- 10m
- Merged PRs (30d)
- 1
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ezyang/ghstack
-
Difficulty 4/5 3-5 days Newbie friendliness 28/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
raullenchai/Rapid-MLX#4042 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
LearningCircuit/local-deep-research#7067 ·
Maintainers usually reply within 1 day
-
#bug
Difficulty 1/5 Under an hour Newbie friendliness 92/100
apache/superset#44923 · 1 comment ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
lawndoc/stack-back#123 ·