feat: Sort workspace sidebar siblings by tip activity recency - #235
Merged
Conversation
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>
| .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); |
There was a problem hiding this comment.
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_atsync stamps - Optional so older clients / missing tips degrade to
created_at
| * 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 { |
There was a problem hiding this comment.
Replaced alphabetical sibling sort with tip-recency ordering in sortTreeByRecency.
- Hierarchy edges (
target_branch) are untouched — only peer arrays shuffle - Prefer
last_activity_at, thencreated_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>, |
There was a problem hiding this comment.
Threaded onto WorkspaceSidebarStatus instead of persisting a new DB column.
- Sidebar list path already discovers WC tips; map by
workspace_pathafter sync - Keeps
Workspacerows free of ephemeral tip noise serde(default)so partial clients still deserialize
| .unwrap_or(status.current.created_at.as_str()) | ||
| } | ||
|
|
||
| fn compare_sidebar_recency( |
There was a problem hiding this comment.
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 statusstack order drifting from the sidebar
Ziinc
marked this pull request as ready for review
August 9, 2026 11:05
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.
Summary
last_activity_at), newest first.target_branchis unchanged — only peer order under the same parent (or among roots) changes.created_at, then branch name, when tip activity is missing or tied.Test plan
workspace-tree.test.tscovers root/child sibling recency, hierarchy preservation,created_atfallback, name tie-breaklist_workspace_statusesreturnslast_activity_atreflecting WC tip timestampssidebar-sibling-recency-01-orderedshowsfeat/root-b→feat/root-a→feat/child-new→feat/child-old