One-PR stack: submit reports success, but merge says the stack was not submitted
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 76/100
Hướng nghiên cứu
Bắt đầu trong cmd/submit.go bằng cách đọc syncStack và hàm gọi nó, sau đó so sánh kiểm tra remote-stack trong cmd/merge.go. Tái hiện luồng one-PR bằng các lệnh trong issue; hoàn tất có nghĩa là submit báo cáo chính xác remote-stack bị thiếu và merge đưa ra kết quả có thể sử dụng hoặc lệnh tiếp theo mà không yêu cầu người dùng lặp lại một lần gửi đã thành công.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
A local stack can contain one branch and one pull request. gh stack submit reports success for this stack:
✓ Pushed and synced 1 branches
However, GitHub does not create a remote stack object. A remote stack requires at least two pull requests.
gh stack merge then rejects the local stack:
✗ this stack has not been submitted to GitHub yet; run `gh stack submit` first
A second gh stack submit does not fix the problem. It reports success again.
Reproduction
- Create a branch from the trunk branch.
- Commit a change on the new branch.
- Initialize a local stack that contains only the new branch.
- Run
gh stack submitand create the pull request. - Run
gh stack submitagain. - Run
gh stack merge --squash.
Example output:
$ gh stack submit
Checking stack state...
Pushing to origin...
PR #30 for close-clinkr-cli-entry-point is up to date
✓ Pushed and synced 1 branches
$ gh stack sync
✓ Fetched latest main from origin
✓ Trunk main is already up to date
Pushing 1 branch to origin...
✓ Pushed 1 branches
Syncing PRs ...
✓ PR #30 (close-clinkr-cli-entry-point) — Open
✓ Branches synced
Stacked on main (69c442c)
$ gh stack merge --squash
✗ this stack has not been submitted to GitHub yet; run `gh stack submit` first
The pull request exists and is open. In this reproduction, GitHub also reported the pull request as mergeable and clean.
Expected behavior
The commands should not give conflicting results.
gh stack submit should state that it published a regular pull request but did not create a remote stack object. Alternatively, it should explain that a remote stack requires at least two pull requests.
gh stack merge should handle a local stack with one pull request. It can merge the pull request directly, or it can show an actionable command such as gh pr merge.
Actual behavior
gh stack submit reports that it pushed and synchronized the one-branch stack. It exits successfully.
gh stack merge reports that the same stack was not submitted. It tells the user to repeat the command that already reported success.
Source context
The behavior is also present on the current github/gh-stack main branch at commit ab00aa4a3f2dddc51aa65849c68b391a1b079311.
In cmd/submit.go, syncStack returns false when the stack has fewer than two pull requests:
// The API requires at least 2 PRs to form a stack.
if len(prNumbers) < 2 {
return false
}
The caller does not use this result:
if stacksAvailable {
syncStack(cfg, client, s)
clearPendingModifyState(cfg, gitDir)
}
The command then prints the success message:
cfg.Successf("Pushed and synced %d branches", len(s.ActiveBranches()))
In cmd/merge.go, the merge command requires a remote stack ID or number:
if s.ID == "" && s.Number == 0 {
cfg.Errorf("this stack has not been submitted to GitHub yet; run `gh stack submit` first")
return nil, ErrNotInStack
}
Thus, the submit command knows that it did not create a remote stack object. However, it discards that result and reports success.
Environment
gh stack version 0.1.0
Darwin 25.6.0 arm64
Deviations: none.
- Ngôn ngữ chính
- Go
- Star
- 1.5k
- Fork
- 73
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 7
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của github/gh-stack
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
-
feature request topic: cli - general
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
feature request topic: auto-merge
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
bug topic: docs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
Tất cả issue của github/gh-stack
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
NVIDIA/gpu-operator#2955 ·
-
agentic-workflows
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Broadcast Documentation Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
kovidgoyal/kitty#10516 ·
-
CVE-2024-24786 CPE mismatch Đang mởbug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
cisagov/vulnrichment#337 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100