Skip to content

fix(sidebar): pin only the repository workspace row - #1235

Merged
devswha merged 2 commits into
mainfrom
fix/pin-repository-row-only
Oct 16, 2026
Merged

devswha merged 2 commits into
mainfrom
fix/pin-repository-row-only

Conversation

@devswha

@devswha devswha commented Oct 16, 2026

Copy link
Copy Markdown
Owner

Change

  • Pin only the repository workspace row, not its linked worktrees.
  • Leave unpinned worktrees as standalone rows at their group's original position and in their original order.
  • Compute fixed rows from the original groups so these worktrees cannot be dragged, moved with Alt+Up/Down, or used as movable group neighbors. Unpinning restores the group.
  • Preserve independent worktree pins, pin order, keys, synchronization and pruning.
  • Update the sidebar design contract and add a ### Changed changelog fragment.

Coordination: owner devswha / pin-row worker; scope sidebar pin splitting, fixed rows, regression,
design and changelog; branch fix/pin-repository-row-only; worktree /tmp/tmp.m0EeHuAUMy/wt;
start SHA cda4190ffef993dd4c3dc7b46fa4b5ce70f738ff; dependencies none; verification below;
status implemented, ready for review. No merge requested.

Validation

All commands used the task-owned temporary/cache environment:

export TMPDIR=/tmp/tmp.m0EeHuAUMy
export NODE_COMPILE_CACHE="$TMPDIR/node-compile-cache"
export BUN_RUNTIME_TRANSPILER_CACHE_PATH="$TMPDIR/bun-transpiler"

Unit regression: fail before / pass after

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

Before: the new head-pinned expectations against the unchanged implementation at the start SHA:

(fail) sidebar agent pins > hoists only pinned rows and leaves a pinned head's worktrees in their group position
(fail) sidebar agent pins > keeps unpinned worktrees in order between the groups around their pinned head
10 pass
2 fail
Ran 12 tests across 1 file.

The pinned head incorrectly retained its children, and the rest list omitted those children.

After:

12 pass
0 fail
Ran 12 tests across 1 file.

Coverage also checks mixed head/worktree pins, pin order, absent IDs, restoring groups, and fixed IDs for head pins versus worktree-only pins.

Isolated browser regression: fail before / pass after

Command: bun run check run --build bun scripts/sidebar-activity-demo-regression.ts

Both runs used the isolated wrapper and fictional demo transport, never a live user session.

Before:

AssertionError: pinning a repository pins only its own row, not its worktrees
actual:   [ "checkout-api", "pin-first", "pin-second" ]
expected: [ "checkout-api" ]
FAILED run (11.9s)
error: script "check" exited with code 1

After:

PASS 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
PASS workspace right-click scope, pointer anchor and focus; the context-menu key opens the same menu; a workspace pins into a card and returns to herdr's order; an agent pins and unpins from its right-click menu and the key
PASS the Agents list keeps herdr's order through a finish, and an opened DONE keeps its dot
PASS on a phone the ⋯ pins an agent from its sheet; a tap on the row selects it and opens no menu
PASS Activity pins blocked and follows recency; an opened DONE keeps its dot
PASS a workspace made after the demo's last agent closed is listed with herdr's counter

The new scenario creates two linked worktrees, pins the head through the real row menu,
checks card contents and standalone ordering, verifies drag/shortcut restrictions and an
actual Alt+Down attempt, then unpins and verifies nesting is restored on desktop and phone.
Optional screenshots are saved outside the worktree with UI_EVIDENCE_DIR.

Additional checks

  • bun run typecheck — passed (application and critical tooling).
  • bun test ./src/conventions.test.ts ./scripts/conventions.test.ts ./server/conventions.test.ts scripts/changelog-fold.test.ts — 37 pass, 0 fail.
  • Production build through the browser wrapper — passed.
  • git diff --check — passed.

Full integration, the full browser lane and native Windows checks were not run locally;
this change was checked with the targeted isolated browser regression.

Local evidence root: /tmp/tmp.m0EeHuAUMy/ (unit-before.log, unit-after.log,
browser-before.log, browser-after-final.log, typecheck.log, conventions.log).
Final wrapper report:
node_modules/.cache/check/33b1d96f-693f-4f1f-b10c-1c70f87afdb6/report.json
records success, exit code 0, unchanged source and a build made by that run.
The gate-reviewer spawn was refused by this worker's subagent nesting limit; the diff was
self-reviewed, but no independent reviewer approval is claimed.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 12 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4a67f741-2c36-4077-a922-6c962de994c9
📥 Commits

Reviewing files that changed from the base of the PR and between ae2e14e and d28b13c.

📒 Files selected for processing: 8
  • DESIGN.md
  • changelog.d/pin-repository-row-only.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
  • 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.

@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

Review rate limited.

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 8375dd6 into main Oct 16, 2026
9 checks passed
@devswha
devswha deleted the fix/pin-repository-row-only branch October 16, 2026 18:17
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