Skip to content

feat: a lane from a branch, in the dashboard (ADR-0047) - #189

Merged
7schmiede merged 4 commits into
mainfrom
feat/lane-from-branch
Oct 21, 2026
Merged

7schmiede merged 4 commits into
mainfrom
feat/lane-from-branch

Conversation

@7schmiede

Copy link
Copy Markdown
Member

Implements ADR-0047 (accepted in #187). Relates to #184.

What

The branch in the stack header now opens a branch picker in place of the lane picker; the sidebar still switches lanes.

  • Branches are listed local first, then remote-tracking ones, each group newest first. Each shows its state: main tree, lane · running, lane · not started, main ports, or new lane. A filter field and a Fetch button sit on top.
  • Click: a branch with a worktree shows its lane (or the main tree). A branch without one gets a lane: the hub runs git worktree add, the daemon finds the worktree, and the page shows the new lane, not started.
  • +: makes a new branch from the chosen one, plus a lane on it.
  • Trash: shown for a stopped lane's worktree, or for any worktree while the stack is down. It runs git worktree remove without --force, after a confirmation; git refuses a worktree with changes.
  • The main working tree's checkout is never changed. Someone else's lane (shared, read only) shows the branch but no picker.

Serve main ports is no longer offered for a stack of Compose containers only: the daemon's StackView says no_main_ports (#184, follow-up to #188).

Hub

New module crates/devstack-hub/src/branches.rs, with these routes:

  • GET /hub/stacks/{id}/branches
  • POST .../worktrees {branch, new?}
  • POST .../worktrees/remove {path}
  • POST .../fetch

Safeguards:

  • The page may only name a branch the hub listed, and only a path that is a linked worktree of the stack (never the main tree).
  • New branch names must pass git check-ref-format --branch, and a leading - is refused. Refs go after --.
  • The folder is chosen by the hub: beside the repository's most recently added worktree, else <repo>.worktrees/ beside the repository. It is named as the lane will be (lane_name), with -2, -3 if the name is taken.
  • git runs with GIT_TERMINAL_PROMPT=0 and GCM_INTERACTIVE=never, without a window, and with a time limit (30 s, 120 s for fetch). Both pipes are drained while it runs.
  • Errors: 400 for what the page got wrong, 409 with git's message.

Docs

docs/dashboard-api.md, docs/plan.md §3.5, an "as built" note in ADR-0047 ({branch, new?} instead of base; fetch is a fourth route), and the CHANGELOG.

Tests

  • Rust: five new tests in branches.rs, run against real git repositories:
    • a lane goes beside the repository, named by its branch;
    • a branch already checked out is refused;
    • a new branch goes beside the existing worktrees;
    • removing works, and removing the main tree is refused;
    • a remote branch gets a local branch that tracks it;
    • names the page makes up are refused;
    • an existing worktree location is followed.
  • Rust checks: cargo clippy --workspace --all-targets -- -D warnings and cargo fmt --check pass; daemon (114) and hub (52) unit tests pass.
  • UI: three new store tests: a new lane is selected once the daemon lists it, matched by path across \ and /; removal asks first and then shows the main tree; a shared lane sends no branch requests. typecheck passes and all 49 tests pass.
  • Seen in the browser: the picker in mock mode (headless Chrome screenshots), with the filter, Fetch, local and remote groups, lane states and the new-branch form.

🤖 Generated with Claude Code

7schmiede and others added 4 commits October 21, 2026 18:08
The branch in the stack header opens the repository's branches, local and
remote-tracking, each with its worktree's lane. A click shows a branch's
lane or makes one; `+` makes a new branch from one and a lane on it; a
stopped lane's worktree can be removed; Fetch runs `git fetch --all
--prune`. The main working tree's checkout is never changed.

The hub runs git (`crates/devstack-hub/src/branches.rs`): the page names a
branch the hub lists, new names pass `git check-ref-format`, refs go after
`--`, the folder is the hub's (beside the repository's newest worktree,
else `<repo>.worktrees/`), git runs without a prompt or window and within
a time limit. Routes: GET /hub/stacks/{id}/branches, POST .../worktrees,
.../worktrees/remove, .../fetch.

The daemon's StackView says `no_main_ports` for a stack of Compose
containers only, and the header offers no "Serve main ports" there (#184).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	CHANGELOG.md
#	docs/dashboard-api.md
…t compares folders, not spellings

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@7schmiede
7schmiede merged commit 61fbb43 into main Oct 21, 2026
@7schmiede 7schmiede mentioned this pull request Oct 21, 2026
@7schmiede
7schmiede deleted the feat/lane-from-branch branch October 21, 2026 19:08
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