Skip to content

feat: Sort workspace sidebar siblings by tip activity recency - #235

Merged
Ziinc merged 3 commits into
mainfrom
cursor/sidebar-sibling-recency-sort-84bd
Aug 9, 2026
Merged

feat: Sort workspace sidebar siblings by tip activity recency#235
Ziinc merged 3 commits into
mainfrom
cursor/sidebar-sibling-recency-sort-84bd

Conversation

@Ziinc

@Ziinc Ziinc commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Workspace sidebar (and CLI stack view) sorts siblings by working-copy tip activity (last_activity_at), newest first.
  • Stack hierarchy via target_branch is unchanged — only peer order under the same parent (or among roots) changes.
  • Falls back to created_at, then branch name, when tip activity is missing or tied.

Test plan

  • Unit: workspace-tree.test.ts covers root/child sibling recency, hierarchy preservation, created_at fallback, name tie-break
  • Rust: list_workspace_statuses returns last_activity_at reflecting WC tip timestamps
  • App QA screenshot: sidebar-sibling-recency-01-ordered shows feat/root-bfeat/root-afeat/child-newfeat/child-old
  • Manual: create two root workspaces, commit in the older one, confirm it rises above the other without flattening stacks
Open in Web Open in Cursor 

cursoragent and others added 3 commits August 9, 2026 09:13
Keep stack nesting intact and order peers (roots and children under the
same parent) by working-copy tip timestamp, newest first, with created_at
and branch name as fallbacks.

Co-authored-by: Ziinc <Ziinc@users.noreply.github.com>
Also fix workspace-tree test helpers to satisfy max-params lint.

Co-authored-by: Ziinc <Ziinc@users.noreply.github.com>
Co-authored-by: Ziinc <Ziinc@users.noreply.github.com>
Comment thread src-tauri/src/jj.rs
.map_err(|e| JjError::IoError(format!("Failed to load working-copy commit: {}", e)))?;
let (branch_name, bookmark_has_conflicts) =
branch_name_for_workspace_commit(repo.as_ref(), workspace_name.as_str(), &wc_commit);
let last_activity_at = commit_author_timestamp_rfc3339(&wc_commit);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Activity comes from the WC tip we already load during discovery (commit_author_timestamp_rfc3339).

  • Avoids a second repo walk just for sidebar ordering
  • Updates when the workspace tip moves (edits/commits), not on blanket refreshed_at sync stamps
  • Optional so older clients / missing tips degrade to created_at

Comment thread src/lib/workspace-tree.ts
* Hierarchy is unchanged — only peer order within a parent (or among roots).
* Equal timestamps fall back to branch name for stability.
*/
function sortTreeByRecency(nodes: WorkspaceTreeNode[]): void {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Replaced alphabetical sibling sort with tip-recency ordering in sortTreeByRecency.

  • Hierarchy edges (target_branch) are untouched — only peer arrays shuffle
  • Prefer last_activity_at, then created_at, then branch name for stable ties
  • Same helper runs at every depth so stacks stay nested while siblings re-order

pub has_conflicts: bool,
/// Working-copy tip author timestamp (RFC3339) for sibling recency ordering.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub last_activity_at: Option<String>,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Threaded onto WorkspaceSidebarStatus instead of persisting a new DB column.

  • Sidebar list path already discovers WC tips; map by workspace_path after sync
  • Keeps Workspace rows free of ephemeral tip noise
  • serde(default) so partial clients still deserialize

.unwrap_or(status.current.created_at.as_str())
}

fn compare_sidebar_recency(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CLI stack dump mirrors the UI sibling rule via compare_sidebar_recency.

  • Same newest-first + branch-name tie-break as the React tree
  • Prevents treq status stack order drifting from the sidebar

@Ziinc Ziinc changed the title Sort workspace sidebar siblings by tip activity recency feat: Sort workspace sidebar siblings by tip activity recency Aug 9, 2026
@Ziinc
Ziinc marked this pull request as ready for review August 9, 2026 11:05
@Ziinc
Ziinc merged commit 55e4b07 into main Aug 9, 2026
11 of 13 checks passed
@Ziinc
Ziinc deleted the cursor/sidebar-sibling-recency-sort-84bd branch August 9, 2026 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants