Inserting a layer in the middle of a stack requires unstack + link, which permanently drops merged PRs
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 48/100
Rechercherichtung
Beginne damit, das gemeldete Verhalten von gh stack link und gh stack unstack zu reproduzieren, und untersuche anschließend die Einschränkung von REST PATCH /repos/{o}/{r}/pulls/{n} sowie den bestehenden Ablauf für die Stack-Mitgliedschaft. Als erledigt gilt die Aufgabe, wenn das Einfügen in der Mitte eines Stacks oder ein verlustfreier Neuaufbau die Zugehörigkeit zusammengeführter PRs bewahrt und die vollständige Stack-Historie intakt hält.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Summary
There is no way to insert a layer in the middle of an already-submitted stack while keeping the stack's merged PRs as members. The only working procedure (unstack + link) moves the still-open PRs into a new stack and leaves every merged PR behind in the old one, which is then closed. The historical grouping of the stack is lost, permanently and irreversibly.
Current behavior
Given a submitted stack S with, bottom to top, one merged PR #1 and open PRs #2 → #3 → #4, and the need to insert a new layer between #2 and #3:
gh stack modifyis TUI-only, so it is unusable non-interactively (and it restructures the local stack, not the server-side membership of an existing PR).- Retargeting the base of an existing stacked PR is refused:
- REST
PATCH /repos/{o}/{r}/pulls/{n}→HTTP 422 … PullRequest.base is invalid gh pr edit <n> --base <branch>→Cannot change the base branch because the pull request is part of a stack
- REST
gh stack linkonly appends to the top (gh stack link <stack#> <new>); it has no position/insert argument, and it rejects arguments that belong to a different stack.- So the only way out is
gh stack unstack <S>+gh stack link <bottom> … <top>.unstack(v0.1.0) unstacks the open PRs and leaves the merged#1inS;Sbecomesopen: falsewith#1as its sole member, and#1cannot be linked into the new stack (rejected as belonging to another stack).
Net effect: a purely structural edit in the middle of the stack silently destroys the association between the merged layers and the layers that are still in flight.
Expected behavior
Either of:
- Insertion: a way to place a PR/branch at an arbitrary position of an existing stack, e.g.
gh stack link --after <pr>/--before <pr>/--position <n>, without tearing the stack down. - Lossless rebuild: allow merged PRs to be re-linked into a stack (or have
unstack+linkcarry them over), so the recovery procedure above at least preserves the full history of the stack.
Why it matters
Merged layers are exactly the part of a stack that documents why the remaining layers look the way they do. Keeping them attached is useful today when reading the stack, and it is what would let the web UI group a whole line of work — landed and in flight — under a single stack. Today, any mid-stack restructuring resets that grouping, so long-lived stacks progressively lose their own history.
Environment
gh stack version 0.1.0- Private repository, stacks enabled.
- Vorherrschende Sprache
- Go
- Sterne
- 1.5k
- Forks
- 73
- Ø Merge
- 1 T. 8 Std.
- Gemergte PRs (30 T.)
- 7
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus github/gh-stack
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 92/100
-
feature request topic: cli - general
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
-
feature request topic: auto-merge
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
-
bug topic: docs
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 68/100
Alle Issues in github/gh-stack
Ähnliche Issues
-
area/dev-productivity area/disaster-recovery area/ipcei kind/enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
-
kind/bug status/0-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
-
🤔 refinement needed
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
equinor/radix-operator#1979 ·