Closed
Conversation
Add src/api/stack.rs module for discovering PR stacks by walking the base/head branch chain. This enables gh-stack to find related PRs without requiring identifier patterns in titles. New functions: - fetch_pr_by_head: Find PR by head branch name - fetch_prs_by_base: Find all PRs targeting a base branch - fetch_all_open_prs: Get all open PRs in a repo - discover_stack: Walk up/down to find full connected stack - discover_all_stacks: Group all PRs into separate stacks Includes 9 unit tests with mockito for API calls.
This was referenced Dec 29, 2025
Owner
Author
|
Landed via #42 |
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.
Summary
Add stack discovery API for finding PR stacks by walking base/head branch chains.
This enables
gh-stackto find related PRs without requiring identifier patterns in titles - a key foundation for making thelogcommand's identifier optional.Changes
New file:
src/api/stack.rs- Stack discovery module with:fetch_pr_by_head()- Find PR by head branch namefetch_prs_by_base()- Find all PRs targeting a base branchfetch_all_open_prs()- Get all open PRs in a repodiscover_stack()- Walk up/down to find full connected stackdiscover_all_stacks()- Group all PRs into separate stacksModified:
src/api/mod.rs- Export newstackmoduleAlgorithm
discover_stackworks by:Tests
9 new tests including mockito-based API tests:
test_fetch_pr_by_head_found/not_found/rate_limitedtest_fetch_prs_by_base_multiple/emptytest_fetch_all_open_prstest_sort_stack_linear/single/emptyStacked PR Chain: smart-log