Skip to content

Remove dead segment-pruning workarounds from collect_stack_segments#13745

Draft
mtsgrd wants to merge 1 commit into
masterfrom
remove-todos
Draft

Remove dead segment-pruning workarounds from collect_stack_segments#13745
mtsgrd wants to merge 1 commit into
masterfrom
remove-todos

Conversation

@mtsgrd
Copy link
Copy Markdown
Contributor

@mtsgrd mtsgrd commented May 11, 2026

Remove five TODOs and ~30 lines of workaround code that pruned
remote-only segments from the front, back, and tail of collected
stacks. Also remove the !is_empty() guard from is_pruned that
special-cased empty segments.

These workarounds were dead code: the graph builder always places
remote refs (e.g. origin/A) on their own graph nodes, separate from
the first-parent path. When commits lack a local ref, their segment
becomes anonymous (ref_info: None), which is_entrypoint_or_local
already treats as local via is_none_or. So remote-only segments
never appeared in positions these workarounds would have caught.

Four new test scenarios confirm this:

  • entrypoint_on_workspace_commit: tag on workspace commit as entrypoint
  • remote_only_stack_top: local branch deleted, only origin/A remains
  • remote_trailing_local_stack: local B stacked on remote-only origin/A
  • remote_ref_as_stack_top: workspace merges a never-local remote ref

All four produce correct graph/workspace output without the old
pruning, verifying the workarounds were unnecessary.

@github-actions github-actions Bot added the rust Pull requests that update Rust code label May 11, 2026
Remove five TODOs and ~30 lines of workaround code that pruned
remote-only segments from the front, back, and tail of collected
stacks. Also remove the !is_empty() guard from is_pruned that
special-cased empty segments.

These workarounds were dead code: the graph builder always places
remote refs (e.g. origin/A) on their own graph nodes, separate from
the first-parent path. When commits lack a local ref, their segment
becomes anonymous (ref_info: None), which is_entrypoint_or_local
already treats as local via is_none_or. So remote-only segments
never appeared in positions these workarounds would have caught.

Four new test scenarios confirm this:
- entrypoint_on_workspace_commit: tag on workspace commit as entrypoint
- remote_only_stack_top: local branch deleted, only origin/A remains
- remote_trailing_local_stack: local B stacked on remote-only origin/A
- remote_ref_as_stack_top: workspace merges a never-local remote ref

All four produce correct graph/workspace output without the old
pruning, verifying the workarounds were unnecessary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant