Skip to content

fix(app): group sidebar sessions by opened directory - #810

Merged
Astro-Han merged 5 commits into
devfrom
pawwork/fix-806-sidebar-subfolder-groups
May 21, 2026
Merged

fix(app): group sidebar sessions by opened directory#810
Astro-Han merged 5 commits into
devfrom
pawwork/fix-806-sidebar-subfolder-groups

Conversation

@Astro-Han

@Astro-Han Astro-Han commented May 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • Group PawWork sidebar sessions by the opened session directory instead of the parent Git worktree.
  • Preserve project-root labels for root sessions while showing subfolder sessions by their opened folder name.
  • Keep subfolder and sandbox session group renames local to the opened directory label instead of renaming the parent Git project.
  • Review follow-up: sandbox/session-directory group renames now stay local while root project groups still rename the project.
  • Review follow-up: Direct routed subfolder sessions now unhide only the opened directory group so the active session remains visible without restoring a hidden parent root group.

Why

Git subfolder sessions currently appear under the parent repository in the PawWork sidebar, even though the user opened the subfolder as the working directory. This keeps Git root metadata available for technical Git behavior while aligning the sidebar with the user's selected workspace.

Related Issue

Closes #806

Human Review Status

Approved by @Astro-Han

Review Focus

Please check that root project sessions still keep their project names, while Git subfolder sessions use the opened directory as their group identity.

Risk Notes

  • Platform impact is limited to path key normalization already handled by workspaceKey; no native shell, packaging, updater, or permission code changed.
  • No docs, release notes, dependencies, credentials, deletion behavior, generated content, or local file changes are included.

How To Verify

Focused layout tests: 126 passed, 0 failed (`bun test src/pages/layout/`)
App typecheck: passed (`bun run typecheck` in packages/app)
Whitespace check: passed (`git diff --check`)
Visual snap: passed; reviewed `docs/design/preview/screenshots/sidebar.png` from `bun run snap sidebar`

Screenshots or Recordings

Visual check: bun run snap sidebar generated and reviewed docs/design/preview/screenshots/sidebar.png.

Checklist

How to use this checklist:

  • Tick a box by replacing [ ] with [x]. Do not edit, add, or remove items.
  • The bot-applied label items can only be honestly ticked AFTER the PR is opened and the labeler / priority-triage bots have run — return to the PR description and tick them then.
  • Most items are required. The few that are conditional are explicitly marked (conditional); for those, leave unticked if they truly do not apply and explain why in Risk Notes. All other items must be ticked before requesting human review.
  • Type label — this PR carries exactly one of bug, enhancement, task, documentation. Type labels are author-added; the labeler bot does NOT assign them. Add the label in the GitHub UI, then tick this.
  • Routing labels — this PR carries at least one of app, ui, platform, harness, ci. The labeler bot assigns these on PR open based on changed paths. Confirm the bot's choice (or override if wrong), then tick this.
  • Priority label — this PR carries exactly one of P0, P1, P2, P3. The priority-triage bot suggests one on PR open. Confirm or override, then tick this.
  • Human Review Status above is set to Pending, Approved by @<reviewer>, or Not required: <reason> (default is Pending; "not required" is restricted to bot-authored low-risk PRs).
  • I linked the related issue, or stated in Summary why there is no issue.
  • I described the review focus and any meaningful risks.
  • I replaced the example block in How To Verify with the real verification steps and the key result for each.
  • I did not introduce unrelated refactors, dependencies, generated files, or file changes beyond the stated scope.
  • (conditional) I manually checked visible UI or copy changes when needed, with screenshots or recordings. Leave unticked only if no visible UI or copy changed.
  • (conditional) I considered macOS and Windows impact for platform, packaging, updater, signing, paths, shell, or permissions changes. Leave unticked only if no platform/packaging surface was touched.
  • (conditional) I called out docs, release notes, dependencies, permissions, credentials, deletion behavior, generated content, or local file changes when relevant. Leave unticked only if none of those surfaces was touched.
  • I reviewed the final diff for unrelated changes and suspicious dependency changes.
  • I am targeting dev, and my PR title and commit messages use Conventional Commits in English.

Summary by CodeRabbit

Release Notes

  • Improvements

    • Enhanced session sidebar organization with improved project naming and labeling accuracy
    • Refined project rename handling to better determine rename targets
  • Tests

    • Expanded test coverage for sidebar session grouping and labeling functionality

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 21, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR resolves issue #806 by centralizing sidebar project grouping logic. New resolver functions extract project key/label derivation and rename target lookup from inline code, enabling sessions opened in Git subfolders to group under the user-selected directory rather than the repository root.

Changes

Sidebar subfolder grouping and project rename resolution

Layer / File(s) Summary
Data model enrichment for session project context
packages/app/src/pages/layout/pawwork-session-source.ts
ProjectLike gains optional id, name, and sandboxes fields; SidebarRowSessionLike adds an optional project field to carry session project context for label and key derivation.
Resolution helper functions for keys, labels, and rename targets
packages/app/src/pages/layout/pawwork-session-source.ts
Three new exported functions: resolvePawworkSessionProjectKey derives workspace identity from session directory; resolvePawworkSessionProjectLabel computes display labels using optional workspace overrides and project metadata; resolvePawworkProjectRenameTarget maps project keys to projects or workspace directories for rename operations.
Layout module integration and sidebar/rename handling
packages/app/src/pages/layout.tsx
Sidebar rows now use the new resolvers to derive projectKey and projectLabel instead of inline logic; project rename handler dispatches to renameProject or setWorkspaceName via resolvePawworkProjectRenameTarget; hidden-project unhide check corrects key computation to use session directory directly.
Test coverage for resolver integration and sidebar grouping
packages/app/src/pages/layout/pawwork-sidebar-session-rows.test.ts
New test cases verify that buildPawworkSidebarSessionRows groups sessions by opened subfolder vs repository root and preserves/derives project labels according to session directory depth.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Astro-Han/pawwork#517: Implements sidebar project rename and soft-hide/unhide UX that depends on the same resolver helpers and key derivation logic introduced in this PR.

Poem

A rabbit hops through nested trees,
No longer lost in Git degrees,
The folder chosen, not the root,
Now guides the sidebar's daily route.
Grouping by where we work, not where we came,
Subfolders finally get their name! 🐰📁

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(app): group sidebar sessions by opened directory' clearly and concisely describes the main change in the changeset.
Linked Issues check ✅ Passed Code changes fully implement issue #806 requirements: sidebar grouping now uses opened session directory instead of Git root, project labels preserved for root sessions, subfolder renames localized, and Git metadata preserved for VCS operations.
Out of Scope Changes check ✅ Passed All changes are scoped to sidebar session grouping: new helper functions for project/session resolution, updated layout.tsx integration, test coverage expansion, with no unrelated refactors or dependencies.
Description check ✅ Passed The PR description is comprehensive and follows the required template structure with all major sections completed.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pawwork/fix-806-sidebar-subfolder-groups

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added app Application behavior and product flows ui Design system and user interface P2 Medium priority labels May 21, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested priority: P2 (includes user-path files (packages/app/src/pages/layout.tsx, packages/app/src/pages/layout/pawwork-session-source.ts, packages/app/src/pages/layout/pawwork-sidebar-session-rows.test.ts)).

P1/P0 are reserved for maintainer confirmation. Please relabel manually if this is a release blocker, security issue, data-loss risk, or updater/runtime failure.

@Astro-Han Astro-Han added the bug Something isn't working label May 21, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request refactors session project key and label resolution into centralized helper functions and updates the layout to use them. It also adjusts the logic for renaming project groups and opening the home directory to focus on the specific directory rather than the repository root. A reviewer noted that some logic in the project renaming function is redundant and potentially contradicts the PR's goal regarding sandbox renames, suggesting that this logic be centralized to ensure consistency.

Comment thread packages/app/src/pages/layout.tsx Outdated
@github-actions

github-actions Bot commented May 21, 2026

Copy link
Copy Markdown

Perf delta summary

Comparator: pass

Profile / Scenario interaction median interaction worst long task max tbt frame gap p95 frame gap max jank count cls status
default / homepage-cold 40 -> 40 (0) 40 -> 48 (+8) 61 -> 59 (-2) 11 -> 9 (-2) 33.4 -> 50 (+16.6) 100 -> 100 (0) 3 -> 2 (-1) 0 -> 0 (0) pass
default / long-session-input-lag 48 -> 48 (0) 64 -> 48 (-16) 0 -> 0 (0) 0 -> 0 (0) 16.7 -> 16.7 (0) 16.8 -> 16.8 (0) 0 -> 0 (0) 0 -> 0 (0) pass
default / session-streaming-long 48 -> 48 (0) 64 -> 64 (0) 0 -> 0 (0) 0 -> 0 (0) 16.7 -> 16.8 (+0.1) 33.4 -> 33.3 (-0.1) 0 -> 0 (0) 0 -> 0 (0) pass
default / tool-call-expand 24 -> 24 (0) 40 -> 24 (-16) 0 -> 0 (0) 0 -> 0 (0) 16.7 -> 16.7 (0) 16.7 -> 16.7 (0) 0 -> 0 (0) 0 -> 0 (0) pass
default / tool-default-open-heavy-bash 32 -> 32 (0) 40 -> 32 (-8) 63 -> 62 (-1) 13 -> 12 (-1) 50 -> 50 (0) 100 -> 100 (0) 2 -> 3 (+1) 0 -> 0 (0) pass
default / terminal-side-panel-open 48 -> 48 (0) 56 -> 64 (+8) 0 -> 0 (0) 0 -> 0 (0) 33.4 -> 33.4 (0) 33.4 -> 33.4 (0) 0 -> 0 (0) 0 -> 0 (0) pass
default / session-scroll-reading 24 -> 24 (0) 24 -> 24 (0) 0 -> 0 (0) 0 -> 0 (0) 16.8 -> 16.7 (-0.1) 16.8 -> 16.7 (-0.1) 0 -> 0 (0) 0.505 -> 0.505 (0) warn: cls

@Astro-Han
Astro-Han merged commit a1cd5f9 into dev May 21, 2026
28 checks passed
@Astro-Han
Astro-Han deleted the pawwork/fix-806-sidebar-subfolder-groups branch May 21, 2026 04:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app Application behavior and product flows bug Something isn't working P2 Medium priority ui Design system and user interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Sidebar groups Git subfolder work directories under the parent repo

1 participant