Skip to content

feat(sidebar): open new tabs and split panes from the sidebar - #307

Merged
devswha merged 3 commits into
devswha:mainfrom
piotrchabros:feat/sidebar-tabs-and-splits
Oct 2, 2026
Merged

devswha merged 3 commits into
devswha:mainfrom
piotrchabros:feat/sidebar-tabs-and-splits

Conversation

@piotrchabros

Copy link
Copy Markdown
Contributor

Change

The web UI could only create whole workspaces ("New session"). There was no way to open additional tabs inside a workspace or split a pane, even though herdr 0.9 supports both (tab.create, pane.split).

  • Sidebar: a + button on each workspace header opens a new tab there; single-pane workspaces (which have no header) get it on the pane row instead. Each pane row gets a split button (splits right). The new pane is selected once herdr reports it; failures surface as inline sidebar errors.
  • Server: POST /api/tab/create {workspace_id?, cwd?, label?} -> {tab_id, pane_id} and POST /api/pane/split {pane_id?, direction?, cwd?} -> {pane_id}, with the same JSON error envelope and validation style as the existing routes. Both are reachable through the /api/machines/:id local alias and remote-PC bridges.
  • Contract in shared/protocol.ts (TabCreated, PaneSplit), frontend wrappers in src/lib/api.ts + useMachineApi, changelog entry, ko/ja/zh strings with the same placeholders.

Validation

  • bun run generate:types --check — up to date; bun run typecheck — clean; bun run build — ok.
  • bun run test:unit — 940 pass, 0 fail (was failing until the 6 new strings were added to all three dictionaries).
  • bun test server/api.contract.test.ts — new "creates, splits, and closes tabs in an owned workspace" test passes, extended mutation-body validation passes. One pre-existing failure ("creates, edits, searches…" pane/files mention assertion) reproduces on the pristine checkout, unrelated to this change.
  • Verified live against a scratch workspace on the author's VPS: tab create + pane split via curl, then closed the test tabs.
  • No UI screenshot attached — no desktop browser on this box; happy to add one if CI's browser run needs a reference.

Copilot AI balanced review requested due to automatic review settings October 2, 2026 08:02
@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 579a8676-e58e-46af-8b5b-9e20a645a728

📥 Commits

Reviewing files that changed from the base of the PR and between c3bf7e3 and 5baf20e.

📒 Files selected for processing (10)
  • CHANGELOG.md
  • server/api.contract.test.ts
  • server/herdr/client.ts
  • server/machine-api.ts
  • server/machines.test.ts
  • site/demo/transport.ts
  • src/components/Sidebar.tsx
  • src/lib/i18n.ja.ts
  • src/lib/i18n.ko.ts
  • src/lib/i18n.zh.ts
 _________________________________________________________________________________
< CodeRabbi is my uncle. He's a bit more orthodox. Feel lucky you got me instead. >
 ---------------------------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).

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: 42e7bb79-0b8b-4d3f-9809-a2963cb01914

📥 Commits

Reviewing files that changed from the base of the PR and between 95a6a47 and c3bf7e3.

📒 Files selected for processing (11)
  • CHANGELOG.md
  • server/api.contract.test.ts
  • server/herdr/client.ts
  • server/index.ts
  • shared/protocol.ts
  • src/components/Sidebar.tsx
  • src/lib/api.ts
  • src/lib/i18n.ja.ts
  • src/lib/i18n.ko.ts
  • src/lib/i18n.zh.ts
  • src/lib/machineContext.tsx

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


📝 Summary

Summary by CodeRabbit

  • New Features
    • Create a new tab in a workspace or split a pane to the right from the sidebar.
    • The newly created tab or pane is selected automatically.
    • Errors are shown in the sidebar if an operation fails.

Walkthrough

The change adds machine-scoped endpoints and sidebar actions to create workspace tabs and split panes. It also adds request validation, typed responses, operation feedback, translations, and contract tests.

Changes

Workspace tab and pane creation

Layer / File(s) Summary
Response contracts and Herdr operations
shared/protocol.ts, server/herdr/client.ts
Documents the endpoints and adds response types and Herdr client operations for tab creation and pane splitting.
HTTP endpoints and validation
server/index.ts, server/api.contract.test.ts, CHANGELOG.md
Adds validated POST routes, updates access allowlists, and tests invalid inputs and successful tab creation and pane splitting.
Sidebar actions and machine API
src/lib/api.ts, src/lib/machineContext.tsx, src/components/Sidebar.tsx, src/lib/i18n.*.ts
Adds machine API wrappers and sidebar controls. Successful operations select the resulting pane; failures display inline errors. Adds Japanese, Korean, and Simplified Chinese translations.

Priority: ➖ Normal

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

Change: Feature

Suggested reviewers: devswha

Merge Risk: ⚪ Minimal · up to c3bf7

The new sidebar actions appear ready to merge after normal checks; no actionable issue is established in the supplied evidence.

Security Architecture Review

Security architecture risk: 🔵 Low · up to c3bf7

The new operations use existing machine-control permissions, with no demonstrated authorization bypass. Remote-machine forwarding currently rejects both operations, and recovery after an interrupted mutation remains uncertain.

Retained concerns

  • Low · architecture · observed: The new machine-scoped callers request tab/create and pane/split, but the remote-machine forwarding allowlist admits neither path. Consequently, registered remote-machine requests return 404 before forwarding, despite the intended remote support. This is a cross-boundary contract mismatch, not an authorization bypass: rejection is fail-closed.
Security review details

Security Blast Radius

  • observed — The new HTTP handlers do not accept a socket address or arbitrary destination host. They call wrappers using the environment-configured local Herdr socket. Caller-controlled identifiers and cwd therefore reach that configured daemon; the current central remote proxy rejects these two operations before selecting a remote endpoint.

Trust Boundaries and Controls

  • observed — The new routes pass through the existing full-access or bridge-token gate, mutation Origin checks, and watch-role prohibition. Local-machine aliases additionally require the machine mutation header. Adding tab paths to bridge authorization expands supported operations for an existing credential, not unauthenticated access.

Hardening Proposals

  • proposed — A machine-bound mutation-status or snapshot-reconciliation path could reduce duplicate resource creation after an indeterminate response, without relying on blind repetition. This is a recovery improvement proposal, not an observed vulnerability.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 10 files. (1 skipped:… 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 clearly and concisely describes the main change: adding sidebar controls to open new tabs and split panes.
Description check ✅ Passed The description includes the required Change and Validation sections. It explains the behavior, API changes, tests, live verification, and the known pre-existing failure. It does not include the reque…
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 10 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

Remote routing rejects both new endpoints, and split requests without a direction violate the herdr schema.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity

Open (2)
What changed in this PR

Adds sidebar controls for creating tabs and splitting panes, backed by new server routes and shared API types.

Changes:

  • Adds sidebar actions with pane selection and inline errors.
  • Implements tab creation and pane splitting APIs.
  • Updates translations, contract tests, and release notes.
File Description
src/​lib/​machineContext.tsx Exposes machine-scoped creation actions.
src/​lib/​i18n.zh.ts Adds Chinese action and error strings.
src/​lib/​i18n.ko.ts Adds Korean action and error strings.
src/​lib/​i18n.ja.ts Adds Japanese action and error strings.
src/​lib/​api.ts Adds typed API wrappers.
src/​components/​Sidebar.tsx Adds tab and split controls.
shared/​protocol.ts Defines responses and documents routes.
server/​index.ts Adds validated endpoints and local routing.
server/​herdr/​client.ts Adds herdr RPC wrappers.
server/​api.contract.test.ts Covers mutations and body validation.
CHANGELOG.md Documents the feature.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread server/index.ts Resolved
Comment thread server/herdr/client.ts Resolved

@devswha devswha left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks @piotrchabros, this is a really nice addition, and the contract tests plus the ko/ja/zh strings are much appreciated. I read the whole diff and approved the CI run; typecheck, the unit suite and the build pass locally.

A few things before it can go in:

  1. pane.split needs a direction. herdr's schema requires it (PaneSplitParams.required: ["direction"]); calling /api/pane/split without one gets back invalid_request: missing field 'direction', which the API turns into a 404. Could you either default it to "right" on the server or make it required (missing_direction), update the doc comment in shared/protocol.ts, and add a contract case?
  2. Require pane_id on split? Without one, herdr splits whatever pane is focused on the PC, which may not be the pane the caller meant. The sidebar always sends one anyway.
  3. Demo: site/demo/transport.ts needs answers for /api/tab/create and /api/pane/split (the /api/workspace/create handler is a good template); otherwise both buttons show an error on the public demo.
  4. CHANGELOG: please end the entry with ([#307](https://github.com/devswha/herdr-web-ui/pull/307) by @piotrchabros).
  5. Smaller: on touch screens a single-pane row now shows four always-visible 44px buttons, so please check it still fits a ~360px drawer; on desktop the workspace-header + is always visible while rename only shows on hover; a non-string label answers missing_label where invalid_label would be accurate.

Once 1, 3 and 4 are in I'll take it to final review. Thanks again!

…-splits

Carries the new tab and split buttons onto the folder-grouping sidebar, links the changelog entry, and keeps a late answer from taking the selection after the user picked another pane.
@devswha
devswha merged commit 28a034f into devswha:main Oct 2, 2026
10 of 11 checks passed
devswha added a commit that referenced this pull request Oct 2, 2026
…e on another PC, and a sent dictation leaves the terminal line (#321)

## Change

Two defects a pre-release review found in features merged today and not
yet released, so there is no changelog entry.

- **Sidebar, new tab and split (#307):** the guard that keeps a late
answer from taking the selection compared this PC's selected pane. That
value is `null` for as long as another PC is open, so picking a pane on
PC A after clicking New tab or Split on PC B still switched the app to
PC B. The guard now compares what the app has open on any PC
(`selection`, passed by `MachineSidebar`).
- **Terminal input line, dictation (#231):** a polish that landed
between a send and its acknowledgement changed the line, and the
acknowledgement then kept it as text typed meanwhile, so a sent command
stayed in the line. `send` now forgets a pending polish, as the chat
composer already does.

## Validation

- `bun run typecheck`, `bun run test:unit` (1031 pass), `bun run build`,
`bun run build:site`.
- No new test: both are component code, and this repo has no DOM test
environment. The first needs two PCs and the second a microphone, which
the browser regression cannot stage.
devswha added a commit that referenced this pull request Oct 2, 2026
…b and split buttons (#327)

## Why

0.3.42 added a new tab and a split button to the sidebar (#307). A pane
row went from two actions to three or four, and the actions keep their
width while hidden, so every pane's name and subtitle were cut 34 to 68
px shorter. The maintainer decided to drop both buttons and put the rows
back as they were.

## Change

- The sidebar is the file it was before #307, with folder grouping
(#299) kept: no new tab button on a workspace or a lone pane's row, no
split button.
- `POST /api/tab/create` and `POST /api/pane/split` are removed with
their client wrappers, protocol types, remote-PC allowlist entries,
translations, demo answers and tests. A `remote-v11` bridge still
carries the two routes; nothing calls them.
- The terminal input line fix from #321 stays.

## Validation

- `bun run typecheck`, `bun run test:unit` (1031 pass), `bun run
generate:types --check`, `bun run build`, `bun run build:site`.
- `scripts/directory-groups-regression.ts`: 7 steps pass. Same 1280 px
screenshot before and after: a pane's name reads
`/tmp/herdr-web-ui-cod…` where it read `/tmp/herdr-…`.
- `src/components/Sidebar.tsx` and `MachineSidebar.tsx` have no diff
against the commit before #307.
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.

3 participants