Skip to content

Stack Entry: Carry associated review information#12367

Merged
estib-vega merged 1 commit intomasterfrom
stack-entry-reviews
Feb 16, 2026
Merged

Stack Entry: Carry associated review information#12367
estib-vega merged 1 commit intomasterfrom
stack-entry-reviews

Conversation

@estib-vega
Copy link
Contributor

Stack entries also know the associtated forge review ID.

This makes it easier to check whether a branch has an associated PR already.

@estib-vega estib-vega requested a review from krlvi as a code owner February 16, 2026 10:26
Copilot AI review requested due to automatic review settings February 16, 2026 10:26
@vercel
Copy link

vercel bot commented Feb 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
gitbutler-web Ready Ready Preview, Comment Feb 16, 2026 4:13pm

Request Review

@github-actions github-actions bot added rust Pull requests that update Rust code CLI The command-line program `but` labels Feb 16, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends legacy stack/branch UI data to carry associated forge review information (e.g. PR/MR number) so CLI flows can more reliably determine whether a branch already has an associated review.

Changes:

  • Add an optional review_id field to StackHeadInfo and populate it from branch metadata / segment metadata.
  • Update PR creation flow to treat branches with an existing associated review as “not eligible” even if there are no currently-open reviews in the cached review map.
  • Add metadata helper to read the associated forge PR/MR number from virtualbranches.toml metadata.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.

File Description
crates/but/src/command/legacy/forge/review.rs Updates “branches without PRs” selection logic to also consider stack head associated review info.
crates/but-workspace/src/legacy/ui.rs Adds new StackHeadInfo field to expose associated forge review data to consumers.
crates/but-workspace/src/legacy/stacks.rs Populates the new field from stack branches/segments and metadata.
crates/but-api/src/legacy/virtual_branches.rs Ensures newly-created stack entries include the new associated review field.

@estib-vega estib-vega marked this pull request as draft February 16, 2026 10:33
@estib-vega
Copy link
Contributor Author

Sorry for the reviewers, this was supposed to be a draft

@estib-vega estib-vega marked this pull request as ready for review February 16, 2026 14:59
Copilot AI review requested due to automatic review settings February 16, 2026 14:59
name: &gix::refs::FullNameRef,
meta: &VirtualBranchesTomlMetadata,
) -> anyhow::Result<Option<usize>> {
let ref_meta = meta.branch(name)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this use meta.branch_opt. just .branch will error if there isn't a corresponding virtual_branches.toml entry.

Since it seems like the only time we call this function is in the case where we haven't already found the virtual_branches.toml entry, it seems quite likely that this will cause unexpected errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooh didn't know that, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed 👍

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

// no associated reviews.
// Check whether there's an associated forge review.
if head.review_id.is_none() {
// If there's no associated review, the append the branch
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in comment: "the append" should be "then append".

Suggested change
// If there's no associated review, the append the branch
// If there's no associated review, then append the branch

Copilot uses AI. Check for mistakes.
Stack entries also know the associtated forge review ID.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

branches_without_prs.push(branch_name);
// This means that there are no associated reviews that are open, but that doesn't mean that there are
// no associated reviews.
// Check whether there's an associated forge review.
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment says "Check whether there's an associated forge review" but the code is checking for a PR/MR number (stored in review_id, which should be named pr_number). The comment should say "Check whether there's an associated PR/MR number" to be more accurate.

Suggested change
// Check whether there's an associated forge review.
// Check whether there's an associated PR/MR number.

Copilot uses AI. Check for mistakes.
// no associated reviews.
// Check whether there's an associated forge review.
if head.review_id.is_none() {
// If there's no associated review, the append the branch
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a typo in the comment: "the append the branch" should be "then append the branch".

Suggested change
// If there's no associated review, the append the branch
// If there's no associated review, then append the branch

Copilot uses AI. Check for mistakes.
@estib-vega estib-vega merged commit a6696a4 into master Feb 16, 2026
34 checks passed
@estib-vega estib-vega deleted the stack-entry-reviews branch February 16, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLI The command-line program `but` rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants