Skip to content

[5/n][sl][github][gh stacks] wire up gh stacks to sl pr submit - #1396

Open
raydatray wants to merge 5 commits into
facebook:mainfrom
raydatray:pr1396
Open

[5/n][sl][github][gh stacks] wire up gh stacks to sl pr submit#1396
raydatray wants to merge 5 commits into
facebook:mainfrom
raydatray:pr1396

Conversation

@raydatray

@raydatray raydatray commented Jul 31, 2026

Copy link
Copy Markdown

ctx

actually links the submitted PRs into a native github stack and deals with the various constraints github puts on stacked diffs

changes made

  • after submit, diffs are linked via the stacks API: create the stack on first submit, then append new diffs when the local stack extends it
  • the remote stack is queried before any mutations:
    • if it diverged from the local stack (reorder or dropped diffs), abort before updating bases or pushing. new --restack flag dissolves and recreates it (since the gh API has no reorder operation). tell the user to do this as a ui hint
    • base branches of diffs already in a stack are never updated via the API (since gh rejects that, the stack manages bases on its own). body/title rewrites use the "base-less" mutation from [2/n][sl][github][gh stacks] add support for stack endpoint #1393
  • new diffs are created directly against the head branch below them instead of being created against main and re-based afterwards (this is impossible to do once diffs are stacked on gh). falls back to default base for forks, where gh native stacks are not supported and a warning is printed (i wanted to submit this stack with my patch to show it works but alas i cant :( )

test plan

  • test-ext-github-submit-stacked.t covers the initial submit, extending an existing stack, diverged stack with/without --restack and with/without local changes to push
  • tested live on my own machine/repo
sl config --local extensions.github=/Users/ray/sapling/eden/scm/sapling/ext/github/__init__.py
sl config --local extensions.signing_shim=/Users/ray/.sl-signing-shim.py
sl config --local github.pr-workflow=stacked
  • create a stack here [1/n][stacks] test raydatray/rusty-mcrouter#197
  • submit 197 and 198 - it creates a stack
  • then add 200 locally and submit again - it extends the stack
  • then add 202 locally and submit again - it extends the stack
  • go down to 198 and amend the diff locally. restack locally and resubmit - modifies only 198 and the stack is updated
Screenshot 2026-07-31 at 3 42 08 PM

Stack created with Sapling. Best reviewed with ReviewStack.

@meta-codesync

meta-codesync Bot commented Jul 31, 2026

Copy link
Copy Markdown

This pull request has been imported. If you are a Meta employee, you can view this in D114402728. (Because this pull request was imported automatically, there will not be any future comments.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant