Skip to content

feat(sidebar): reorder pinned workspace groups within their card - #1233

Merged
devswha merged 2 commits into
mainfrom
feat/pinned-reorder
Oct 16, 2026
Merged

devswha merged 2 commits into
mainfrom
feat/pinned-reorder

Conversation

@devswha

@devswha devswha commented Oct 16, 2026

Copy link
Copy Markdown
Owner

Change

Pinned workspaces stood in their card in pin order and could not be moved: canLift and the drag source refused every pinned row (fixedIds), so the only way to reorder was to unpin and pin again.

A pinned workspace group can now be dragged (desktop) or lifted with a long press (touch) within the pinned card, and moved with the keyboard as the other rows. The drop rewrites the pin order (reorderWorkspacePins in src/lib/sidebarPins.ts, synced as pins already are), not herdr's workspace order. A pinned repository's worktrees move with it and are not moved on their own inside the card; a drop across the card's edge changes neither order. Unpinned rows reorder through herdr exactly as before. Pinned agents are unchanged: agent rows have no list reordering at all.

DESIGN.md and changelog.d/pinned-workspace-reorder.md say so.

Validation

  • bun test src/lib/sidebarPins.test.ts: new cases for reorderWorkspacePins, pass.
  • bun run check fast: exit 0.
  • bun run check run --build bun scripts/workspace-touch-reorder-demo-regression.ts: exit 0. Covers desktop drag and touch long-press reordering inside the pinned card, the saved pin order surviving a reload, a pinned repository's worktree child moving with it, a drop across the pinned/unpinned edge being refused, and herdr's workspace order staying unchanged; the existing unpinned touch and keyboard cases still pass.
  • Rebased onto main (cda4190) afterwards: typecheck and sidebarPins/conventions tests pass; CI reruns the rest.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 231a56a3-c737-4476-8a1a-c5508ac96046
📥 Commits

Reviewing files that changed from the base of the PR and between cda4190 and ba10d46.

📒 Files selected for processing: 7
  • DESIGN.md
  • changelog.d/pinned-workspace-reorder.md
  • scripts/sidebar-activity-demo-regression.ts
  • scripts/workspace-touch-reorder-demo-regression.ts
  • src/components/Sidebar.tsx
  • src/lib/sidebarPins.test.ts
  • src/lib/sidebarPins.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

📝 Summary

Summary by CodeRabbit

  • New Features
    • Reorder pinned workspaces within their card by dragging, touch-screen long-press, or Alt+Up/Down.
    • Reordering pins does not change herdr’s workspace order. Repository worktrees remain grouped with a pinned repository, while pinned worktrees can move out of their repository group without removing the group.
    • Children stay with a pinned parent, and items cannot be moved between pinned and regular lists.

Pinned workspace groups can now be reordered by dragging, touch long-press, or Alt+↑/↓. Their order changes independently of server workspace order. Worktree children stay with pinned parents, and drops cannot cross between pinned and regular lists.

Changes: Pinned workspace reordering

Layer / File(s) Summary
Pin order transformation
src/lib/sidebarPins.ts, src/lib/sidebarPins.test.ts
reorderWorkspacePins reorders workspace pin slots for one machine. Tests cover moves in both directions, unchanged slots, input immutability, and no-op cases.
Sidebar pinned-drop handling
src/components/Sidebar.tsx, scripts/*reorder-demo-regression.ts, DESIGN.md, changelog.d/pinned-workspace-reorder.md
Sidebar drag and touch drops route pinned groups through pin reordering. Regression scripts check pinned order, worktree placement, pin boundaries, server workspace order, and reload persistence. Documentation describes the interaction and constraints.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Suggested reviewers: jiunshinn, vibewriter-hand

Merge Risk: ⚪ Minimal · up to ba10d

Pinned workspace groups can be reordered by drag, touch long-press, or keyboard, and the change only affects pin order. No actionable merge-blocking risk was identified.

Pre-merge checks: Passed 5
Check name Status Explanation
Docstring Coverage Passed Docstring coverage is 88.89% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 5 files. (2 skipped: 2 u…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely describes the primary change: reordering pinned workspace groups within the sidebar card.
Description check Passed The description includes the required Change and Validation sections. It explains the behavior, implementation, scope, and reported test results. It does not link a maintainer-approved issue for this …
Full details: Docstring Coverage

Explanation

Docstring coverage is 88.89% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 5 files. (2 skipped: 2 unsupported.)

Full details: Description check

Explanation

The description includes the required Change and Validation sections. It explains the behavior, implementation, scope, and reported test results. It does not link a maintainer-approved issue for this feature, but the description is otherwise complete.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

The pin-order reorder made pinned workspace rows draggable; the sidebar activity regression still expected them not to be.
@devswha

devswha commented Oct 16, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@devswha
devswha merged commit ae2e14e into main Oct 16, 2026
9 checks passed
@devswha
devswha deleted the feat/pinned-reorder branch October 16, 2026 18:04
devswha added a commit that referenced this pull request Oct 16, 2026
## Change

Workspace pins are favorites: add a childless shortcut in the pinned
card, but keep the full
repository tree below unchanged, including pinned heads and pinned
worktrees.

- Keep drag, touch long-press and Alt+Up/Down reordering inside the
card; cross-card drops do nothing.
- Let every tree row reorder through herdr normally, regardless of
favorites.
- Give shortcuts separate DOM/reorder identities while keeping the
underlying workspace and selection
shared. Restore focus to the originating row, or its surviving tree row
when unpinning a shortcut.
- Keep shortcuts visible when their repository is collapsed, and open
rename only on the row used.
- Preserve pin keys, pin order, pruning and preference sync.
- Update DESIGN.md and consolidate the unreleased #1233/#1235 notes into
one final-behavior
  `### Changed` fragment.

Owner: pins-favorites worker. Branch: `fix/pins-as-favorites`.
Worktree: `/tmp/tmp.IJc2hmd83H/wt`.
Start SHA: `811a4b9c`. Dependencies: none. Status: implemented and
locally verified.

## Validation

Every command used a private temporary/cache environment:

```sh
export TMPDIR=/tmp/tmp.IJc2hmd83H
export NODE_COMPILE_CACHE="$TMPDIR/node-compile-cache"
export BUN_RUNTIME_TRANSPILER_CACHE_PATH="$TMPDIR/bun-transpiler"
cd "$TMPDIR/wt"
```

### Unit: fail before / pass after

Updated the existing split expectations before changing the
implementation.

Command:
```sh
bun test src/lib/sidebarPins.test.ts
```

Before, on the original implementation at `811a4b9c`:
```text
(fail) adds favorite shortcuts without removing pinned heads or worktrees from the tree
(fail) keeps the full repository tree in source order when its head is a favorite
(fail) reorders favorite shortcuts and unpins a head without changing the original tree
11 pass
3 fail
UNIT_BEFORE_EXIT=1
```

After:
```text
14 pass
0 fail
33 expect() calls
Ran 14 tests across 1 file.
```

### Browser regressions: fail before / pass after

Both scripts ran exclusively through the isolated wrapper, with
`CHECK_MAX_RUNS=3`.
They build the real client over disposable demo fixtures, not the user's
live session.

```sh
CHECK_MAX_RUNS=3 bun run check run --build bun scripts/sidebar-activity-demo-regression.ts
CHECK_MAX_RUNS=3 bun run check run --build bun scripts/workspace-touch-reorder-demo-regression.ts
```

Before, with the new intact-tree assertions on the original
implementation:
```text
sidebar-activity-demo-regression.ts:
AssertionError: favorites keep the complete repository tree unchanged
FAILED run (7.9s)
ACTIVITY_BEFORE_EXIT=1

workspace-touch-reorder-demo-regression.ts:
AssertionError: favorites keep every repository head in the normal tree
actual:   [ "w2t", "w1E", "w1F", "w1G", "w2s" ]
expected: [ "w1D", "w1C", "w1E", "w1F", "w1G", "w2s" ]
FAILED run (9.3s)
REORDER_BEFORE_EXIT=1
```

After, on the final source:
```text
sidebar-activity-demo-regression.ts:
PASS repository favorites add only a shortcut and preserve the full movable tree on desktop and phone
ok     build (5.5s)
ok     run (37.7s)
ACTIVITY_AFTER_EXIT=0

workspace-touch-reorder-demo-regression.ts:
PASS touch long press and Alt+Up/Down reorder favorites within the card, preserve the complete tree and herdr order, and survive reload
PASS desktop drag and Alt+Up/Down reorder favorites within the card, preserve the complete tree and herdr order, and survive reload
ok     build (6.9s)
ok     run (17.9s)
REORDER_AFTER_EXIT=0
```

The activity regression additionally covers pinned worktrees staying
nested, shortcut reorder,
collapsed-tree shortcuts, shared selection/aria-current, distinct DOM
IDs, pin/unpin focus return,
normal sibling reorder, and no duplicate rename editors. It runs the
favorite scenario in dark and
light themes at 1280px desktop and 390px phone widths.

The reorder regression covers touch and desktop card reorder, both
directions across the card edge,
normal tree reorder of a favorite repository with its worktree,
unchanged shortcut order during tree
moves, and saved pin order after reload.

Both final wrapper reports have `status: success`, exit code `0`,
`verification.status: verified`,
`source.unchanged: true`, and matching source fingerprints:
`ca8c8902503bebee7ed8c89389698e393204e4ee283bdadc4ab32c52c7f39435`.
Report IDs: `c46725d8-fd97-40a0-84bf-eb80bdccf25e` and
`644af18e-15f8-4d64-ae40-dad2875e6513`.
The scripts independently build their demo client from source; the
wrapper's generic
`browserCurrentSource` field is `not-claimed`.

### Other checks

```sh
bun run typecheck
bun test src/lib/sidebarPins.test.ts src/conventions.test.ts server/conventions.test.ts scripts/conventions.test.ts scripts/changelog-fold.test.ts
git diff --check
```

```text
$ tsc --noEmit && tsc --noEmit -p tsconfig.tools.json
FINAL_CHECKS_EXIT=0
51 pass
0 fail
123 expect() calls
Ran 51 tests across 5 files.
```

Screenshots inspected directly: `/tmp/tmp.IJc2hmd83H/evidence/`
(desktop/phone, light/dark,
plus card reorder). Full command logs:
`/tmp/tmp.IJc2hmd83H/{unit,activity,reorder}-{before,after}.log`
and `final-tests.log`. Native gate-review spawning was unavailable
because this worker is already
at the session's maximum subagent depth; the final diff was reviewed
directly instead.
Full CI and native Windows checks were not run locally. The production
build retains its existing
large-chunk warning.

Context decisions: a removed shortcut returns focus to its tree row; if
that worktree was hidden,
expand its repository to make the focus target visible. Preserve the
existing group-move contract
that moves a repository's worktrees alongside it in herdr order.
devswha added a commit that referenced this pull request Oct 16, 2026
## Change

Workspace pins move again instead of acting as favorites. #1237 kept
every pinned workspace in the
tree and added a shortcut to the card, so a pinned worktree showed
twice. Paseo, Codex and T3 Code
all move a pinned item into the pinned section, and the pin unit here is
one herdr workspace, as a
thread is in T3 Code.

This reverts #1237 only, which restores the #1235 behavior:

- A pinned workspace leaves the tree and shows only in its PC's pinned
card, in pin order.
- Pinning a repository workspace moves only its row. Its unpinned
worktrees stay at the group's
  position, in order and fixed, until the repository is unpinned.
- A pinned worktree leaves its repository's group, which stays.
- Drag, touch long-press and Alt+Up/Down still reorder the card by pin
order (#1233).

DESIGN.md, the unit tests, both browser regressions and the changelog
fragments
(`pin-repository-row-only.md`, `pinned-workspace-reorder.md`) return to
their #1235 state;
`workspace-favorites.md` is removed. The revert applied cleanly on top
of #1241.

## Validation

- `bun run typecheck`: pass.
- `bun test src/lib/sidebarPins.test.ts src/conventions.test.ts
server/conventions.test.ts scripts/conventions.test.ts
scripts/changelog-fold.test.ts`: 52 pass, 0 fail.
- `CHECK_MAX_RUNS=3 bun run check run --build bun
scripts/sidebar-activity-demo-regression.ts`: 8 PASS, including "a
repository pin keeps only its row in the card; its worktrees stay
outside, fixed and ordered, and regroup on unpin, on desktop and phone".
- `CHECK_MAX_RUNS=3 bun run check run --build bun
scripts/workspace-touch-reorder-demo-regression.ts`: 4 PASS (touch and
desktop card reorder, unpinned worktrees fixed outside, reload).
- `git diff --check`: clean.

The browser regressions ran on demo fixtures before the rebase onto
#1241, which touches none of
these files; typecheck and unit tests were re-run after it. Full CI and
native Windows were not run
locally.
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.

1 participant