[2/n][sl][github][gh stacks] add support for stack endpoint - #1393
Open
raydatray wants to merge 2 commits into
Open
[2/n][sl][github][gh stacks] add support for stack endpoint#1393raydatray wants to merge 2 commits into
raydatray wants to merge 2 commits into
Conversation
This was referenced Jul 31, 2026
|
This pull request has been imported. If you are a Meta employee, you can view this in D114402654. (Because this pull request was imported automatically, there will not be any future comments.) |
|
@raydatray has updated the pull request. You must reimport the pull request before landing. |
### ctx
github added native stacked pull requests, it would be nice to add native support to it for sapling!
this stack lets `sl pr submit` and `sl pull` via a new `github.pr.workflow = stacked` mode
### changes made
- `github_gh_cli.make_request` accepts custom headers (`-H`, needed for the `X-GitHub-Api-Version` preview header)
- `_format_param` supports list values using the `gh api` repeated-field syntax (`pull_requests[]=101`)
- an empty list is passed explicitly as `key[]` without a value (per the gh api manual) rather than dropped, since an empty array and a missing field can mean different things to an endpoint
- mock_utils: `MockGitHubServer` now tracks which expectations were consumed; tests can opt in via `wrap_with_consumption_check` to fail when an expected request silently stops happening (closes the old TODO)
### test plan
doctests in `_format_param` (registered in test-doctest.py, including the empty-array case), existing github .t suite. verified the empty-array wire format empirically: `gh api -F "pull_requests[]" --verbose` sends `{"pull_requests": []}`
### ctx basic plumbing for github native stacks REST API ### changes made - `gh_submit`: `StackDetails` dataclass + `get_stack_for_pull_request`, `create_stack`, `add_prs_to_stack`, `unstack`, all pinned to the `2026-03-10` preview API version - `unstack` returns the remaining stack when dissolution is partial (merged/queued diffs cannot be unstacked) so callers can react instead of assuming success - `update_pull_request` now takes `base: Optional[str]`: github rejects `updatePullRequest` mutations that include `baseRefName` for PRs in a native stack, so `base=None` uses a new mutation variant (`GRAPHQL_UPDATE_PULL_REQUEST_NO_BASE`) that only touches title/body ### test plan CI (doctest on `_parse_stack_from_dict`), and dogfooded on my own computer via a patch raydatray/rusty-mcrouter#198 <img width="905" height="468" alt="Screenshot 2026-07-31 at 3 20 04 PM" src="https://github.com/user-attachments/assets/bbe461a5-4128-4c75-b603-8ef4e012bb05" />
|
@raydatray has updated the pull request. You must reimport the pull request before landing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ctx
basic plumbing for github native stacks REST API
changes made
gh_submit:StackDetailsdataclass +get_stack_for_pull_request,create_stack,add_prs_to_stack,unstack, all pinned to the2026-03-10preview API versionunstackreturns the remaining stack when dissolution is partial (merged/queued diffs cannot be unstacked) so callers can react instead of assuming successupdate_pull_requestnow takesbase: Optional[str]: github rejectsupdatePullRequestmutations that includebaseRefNamefor PRs in a native stack, sobase=Noneuses a new mutation variant (GRAPHQL_UPDATE_PULL_REQUEST_NO_BASE) that only touches title/bodytest plan
CI (doctest on

_parse_stack_from_dict), and dogfooded on my own computer via a patch raydatray/rusty-mcrouter#198Stack created with Sapling. Best reviewed with ReviewStack.