Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
…mote tracking branches
Caleb-T-Owens
approved these changes
Feb 6, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes incorrect workspace projections caused by sibling_segment_id being overloaded for both “remote tracking branch linkage” and other post-processing/workspace reconstruction purposes. It introduces a dedicated remote_tracking_branch_segment_id and updates graph post-processing, projections, debug output, and fixtures to use the new field.
Changes:
- Add
remote_tracking_branch_segment_idto graph/projection segment types and route remote-tracking linkage through it. - Update workspace projection and debug/visualization helpers to prefer
remote_tracking_branch_segment_idoversibling_segment_id. - Add a regression scenario + test reproducing #12146 and update affected snapshots/fixtures.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/but-workspace/src/ref_info.rs | Adjusts destructuring to accommodate the new segment field. |
| crates/but-testsupport/src/graph.rs | Updates debug tree rendering to prefer the new remote-tracking linkage field. |
| crates/but-graph/tests/graph/vis.rs | Updates visualization test data to use remote_tracking_branch_segment_id instead of sibling_segment_id. |
| crates/but-graph/tests/graph/init/with_workspace.rs | Updates snapshots and adds regression test for #12146. |
| crates/but-graph/tests/graph/init/mod.rs | Updates debug snapshots for new debug formatting/fields. |
| crates/but-graph/tests/fixtures/scenarios.sh | Adds fixture repo for reproducing #12146. |
| crates/but-graph/src/segment.rs | Adds remote_tracking_branch_segment_id to Segment and updates Debug formatting. |
| crates/but-graph/src/projection/workspace/init.rs | Uses remote_tracking_branch_segment_id when deriving target refs and marking remote reachability. |
| crates/but-graph/src/projection/stack.rs | Propagates the new field into stack projection segments and debug string output. |
| crates/but-graph/src/init/post.rs | Updates post-processing to maintain the new remote-tracking linkage separately from sibling_segment_id. |
| crates/but-graph/src/init/mod.rs | Updates graph initialization to set the new remote-tracking linkage field appropriately. |
| crates/but-graph/src/debug.rs | Extends debug string helpers to incorporate the new linkage field. |
| crates/but-graph/src/api.rs | Adds an API helper to look up the remote-tracking-branch segment directly. |
Byron
added a commit
that referenced
this pull request
Feb 6, 2026
Problem: When add_stack_with_segments declared "A" as a segment within the "B" stack, the workspace conversion produced two separate segments both named "A": - :5:A with only the remote commit - :0:A (anonymous, borrowing A's identity via sibling) with both remote and local commits Root cause: In collect_first_parent_segments_until, the stop condition (line 227) unconditionally stops at anonymous segments with sibling_segment_id. This prevents the anonymous segment from being collected together with its named counterpart, even when the named segment is the direct predecessor in the first-parent chain. Fix (workspace/init.rs:470): Override the stop condition when the anonymous segment's sibling is already in the collected output. This merges the anonymous segment's commits into the same StackSegment as its named counterpart, producing a single "A" segment with both the remote tracking commit and the local commits. Co-authored-by: Claude <noreply@anthropic.com>
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.
The issue roughly is related to some special handling of the
sibling_segment_idwhich is used to associatetips with stack tips.
While the feature is meant for one specific case, it also triggers in the place to be reproduce here which
causes bad workspace projections.
A fix might be either in the graph post-processing, in the workspace projection, or both.
Tasks
Fixes #12146
Follow-up
Reproduction
tsbs.tar.gz
Experiment: Can Opus 4.6 figure it out?
I knew what's causing this but not much more than I stated in the prompt.
Within minutes I found the post-process that sets up the 'bad' link:
gitbutler/crates/but-graph/src/init/post.rs
Line 850 in 40175a8
I had to point it at that to focus its solution search and it came up with something that worked in this case, but not the other tests.
In any case, from there I just took it upon myself as I had arrived in the right 'mind-space' to know what has to be done and what the problem is.
Overall, definitely useful, but it's possible to get lost in prompting when becoming too reliant - I'd always want to be able to do the thinking, and just use Claude to get there faster.