Skip to content

Enforce pinning invariant and group contiguity on tab restoration#12677

Merged
johnturcoo merged 2 commits into
masterfrom
johnturco/app-4746-restoring-a-pinned-tab-should-land-in-pinned-region
Jun 16, 2026
Merged

Enforce pinning invariant and group contiguity on tab restoration#12677
johnturcoo merged 2 commits into
masterfrom
johnturco/app-4746-restoring-a-pinned-tab-should-land-in-pinned-region

Conversation

@johnturcoo

Copy link
Copy Markdown
Contributor

Description

There are a few bugs with tab restoration (closing a tab and then using "restore session") that this PR solves:

  • a pinned tab that is restored could land outside the pinned region
  • an unpinned tab that is restored could land inside the pinned region
  • a tab that is restored to its original index could split a group (land in the middle without being owned by the group)

With the changes in this PR, restored tabs now respect the pinned invariant (pinned items appear before unpinned items) and will not land within a group.

How it works

Modified restore_closed_tab logic as follows

  • If the restored tab is not in a group (or the group no longer exists), use the new helper index_for_restored_tab
  • The helper does the following:
    • if the tab was pinned and the original index is within the pinned region, place it there. Otherwise append to the pinned region
    • if the tab was not pinned and the original index is outside the pinned region, place it there. Otherwise place after the pinned region
    • if the index produced from the logic above is within a group, place it after the groups last member

Linked Issue

https://linear.app/warpdotdev/issue/APP-4746/restoring-a-pinned-tab-should-land-in-pinned-region

Testing

  • I have manually tested my changes locally with ./script/run

Screenshots / Videos

Demo of bug

Demo of fix

@cla-bot cla-bot Bot added the cla-signed label Jun 16, 2026
@oz-for-oss

oz-for-oss Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

@johnturcoo

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overview

This PR updates closed-tab restoration so ungrouped restored tabs are clamped to the correct pinned/unpinned region and avoid landing in the middle of an existing group. The PR includes user-facing visual evidence via Loom links, and I found no security-specific concerns or spec drift because no approved spec context was provided.

Concerns

  • No blocking concerns found.
  • One inline suggestion asks for automated coverage of the new restore-index paths so the pinned-region and group-contiguity invariants do not regress.

Verdict

Found: 0 critical, 0 important, 1 suggestions

Approve with nits

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread app/src/workspace/view.rs
/// If the tab was pinned, it must land at it's original index or the end of
/// the pinned region. If the tab is not pinned, it must land at it's original
/// index or after all pinned items.
fn index_for_restored_tab(&self, tab: &TabData, original_index: usize) -> usize {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 [SUGGESTION] Add automated coverage for the new restore-index paths (pinned tab restored outside the pinned prefix, unpinned tab restored inside it, and restoration that would split an existing group). These are distinct behavior paths and currently only have manual/Loom coverage.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you could just Warp this but idrc, non-blocking

@vkodithala vkodithala self-requested a review June 16, 2026 18:37

@vkodithala vkodithala left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

makes sense, nice improvement 🚀

Comment thread app/src/workspace/view.rs
/// If the tab was pinned, it must land at it's original index or the end of
/// the pinned region. If the tab is not pinned, it must land at it's original
/// index or after all pinned items.
fn index_for_restored_tab(&self, tab: &TabData, original_index: usize) -> usize {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you could just Warp this but idrc, non-blocking

@vkodithala vkodithala left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

forgot to click approve ;)

@johnturcoo johnturcoo merged commit 1cdb479 into master Jun 16, 2026
42 of 44 checks passed
@johnturcoo johnturcoo deleted the johnturco/app-4746-restoring-a-pinned-tab-should-land-in-pinned-region branch June 16, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants