Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ and listed with their assets on the
runs once per machine, in the main working tree only. `lanes = false`
still works and means the same; `devstack check` reports it as
deprecated.
- **Every lane has the same view, `main` included** (ADR-0081): the main
working tree is the lane `main`, with the same header, actions and start
card as any lane; what has no meaning for it (Cold, Discard data, Remove
worktree, Move, Share, a start in the pool, another profile) is shown
disabled, with the reason. *Serve main ports* is the same button in
every lane that does not hold them. *Stop stack* now stops every lane and
the daemon; `main`'s own Stop stops the main working tree only.
- **The lane is in the URL**: `#/s/<stack>/l/<lane>/...` (`main` for the
main working tree), in the links of `devstack status`, `up`, `ui
--link`, notifications and the tray too. Links of the form
`#/s/<stack>/services/api?lane=feat` still open that lane.

### Deprecated

Expand All @@ -30,6 +41,15 @@ and listed with their assets on the

- **`/v1/lanes/main/v1/...`** answers as the main working tree's `/v1/...`
(ADR-0080), so a client addresses every tree as a lane.
- **A stack has a page of its own** (ADR-0081), above its lanes, at
`#/s/<stack>` (the sidebar's stack row): its daemon (pid, port, uptime)
and the restart banner, Start, Stop and Restart stack, who serves the
main ports and the control to give them to another lane or back to
main, its lanes with branch, place, state, port offset and what each
uses, and the services that run once per machine. A stopped stack's page
shows its start and its worktrees.
- **`ServiceView.singleton`** (ADR-0080, ADR-0081): whether a service runs
once per machine, in the main working tree only.

## [0.32.0] - 2026-10-30

Expand Down
4 changes: 4 additions & 0 deletions crates/devstack-daemon/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ pub struct ServiceView {
pub hot_reload: bool,
/// The stack file gives it a hot-reload mode.
pub hot_reload_available: bool,
/// It runs once per machine, in the main working tree only (`singleton
/// = true`, or the deprecated `lanes = false`, ADR-0080): the stack
/// page lists it as the stack's, not a lane's. Older daemons omit it.
pub singleton: bool,
/// Where its last `prepare` outputs came from (ADR-0062): the store or
/// a run. Since this daemon started; none before its first `prepare`.
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down
1 change: 1 addition & 0 deletions crates/devstack-daemon/src/supervisor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ impl Supervisor {
rebuild: None,
hot_reload: false,
hot_reload_available: svc.hot_reload.is_some(),
singleton: svc.singleton(),
prepare: None,
last_action: None,
},
Expand Down
2 changes: 1 addition & 1 deletion crates/devstack-desktop/src/notify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub struct Note {
/// Whose: the stack, and the lane.
pub context: String,
pub body: String,
/// The dashboard's route a click shows (`/#/s/<id>?lane=`).
/// The dashboard's route a click shows (`/#/s/<id>/l/<lane>`).
pub route: String,
/// The `devstack://open` link that shows it (`devstack open-url`).
pub link: String,
Expand Down
2 changes: 1 addition & 1 deletion crates/devstack-hub/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ fn from_own_page(h: &HeaderMap, method: &Method, path: &str, own: &[String]) ->
#[derive(Deserialize)]
struct CodeQuery {
code: String,
/// Where to go once paired: a dashboard route (`/#/s/<id>?lane=`), the
/// Where to go once paired: a dashboard route (`/#/s/<id>/l/<lane>`), the
/// stack a notification is about (ADR-0045). Anything else goes home.
next: Option<String>,
}
Expand Down
17 changes: 7 additions & 10 deletions crates/devstack-hub/src/notify/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,20 @@ pub(crate) struct Target {
}

impl Target {
/// The dashboard's route for it (hash history). `lane=` (empty) shows
/// the main working tree, whichever lane was shown last.
/// The dashboard's route for it (hash history): the lane view
/// (ADR-0081), `main` for the main working tree.
pub fn path(&self) -> String {
if self.pool {
return "/#/pool".into();
}
let Some(stack) = &self.stack else {
return "/#/".into();
};
let mut p = format!("/#/s/{}", enc(stack));
let lane = self.lane.as_deref().filter(|l| !l.is_empty());
let mut p = format!("/#/s/{}/l/{}", enc(stack), enc(lane.unwrap_or("main")));
if let Some(s) = &self.service {
p.push_str(&format!("/services/{}", enc(s)));
}
p.push_str(&format!(
"?lane={}",
enc(self.lane.as_deref().unwrap_or(""))
));
p
}

Expand Down Expand Up @@ -609,7 +606,7 @@ mod tests {
let shown = shown.lock().unwrap();
assert_eq!(shown.len(), 4);
assert_eq!(shown[3].context, "shop · lane feat-x");
assert_eq!(shown[3].route, "/#/s/ab12/services/api?lane=feat-x");
assert_eq!(shown[3].route, "/#/s/ab12/l/feat-x/services/api");
assert_eq!(
shown[3].link,
"devstack://open?stack=ab12&lane=feat-x&service=api"
Expand Down Expand Up @@ -723,7 +720,7 @@ mod tests {
service: Some("api".into()),
pool: false,
};
assert_eq!(t.path(), "/#/s/ab12/services/api?lane=feat%20x");
assert_eq!(t.path(), "/#/s/ab12/l/feat%20x/services/api");
assert_eq!(
t.link(),
"devstack://open?stack=ab12&lane=feat%20x&service=api"
Expand All @@ -732,7 +729,7 @@ mod tests {
stack: Some("ab12".into()),
..Target::default()
};
assert_eq!(main.path(), "/#/s/ab12?lane=");
assert_eq!(main.path(), "/#/s/ab12/l/main");
assert_eq!(main.link(), "devstack://open?stack=ab12");
assert_eq!(Target::default().path(), "/#/");
assert_eq!(Target::default().link(), "devstack://open");
Expand Down
19 changes: 13 additions & 6 deletions crates/devstack/src/hubcmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@ pub fn pairing_url() -> Result<String> {

/// Where the dashboard shows a stack, on a lane or its main working tree.
pub struct DashboardLinks {
/// The hash route: `/#/s/<id>?lane=<lane>`.
/// The hash route: `/#/s/<id>/l/<lane>`, `main` for the main working
/// tree (ADR-0081).
pub route: String,
/// The page, for a browser paired before.
pub page: String,
Expand All @@ -341,7 +342,10 @@ pub fn dashboard_links(main_file: &Path, lane: Option<&str>) -> DashboardLinks {
let abs = std::path::absolute(main_file).unwrap_or_else(|_| main_file.to_path_buf());
let id = devstack_daemon::registry::id_for(&devstack_proc::long_path(&abs));
let lane = crate::client::enc(lane.unwrap_or(""));
let route = format!("/#/s/{id}?lane={lane}");
let route = format!(
"/#/s/{id}/l/{}",
if lane.is_empty() { "main" } else { &lane }
);
DashboardLinks {
page: format!("http://127.0.0.1:{}{route}", devstack_hub::port()),
link: if lane.is_empty() {
Expand All @@ -358,7 +362,7 @@ pub fn dashboard_line(main_file: &Path, lane: Option<&str>) -> String {
format!("dashboard: {}", dashboard_links(main_file, lane).page)
}

/// Open the dashboard at `route` (a hash route, `/#/s/<id>?lane=`), paired
/// Open the dashboard at `route` (a hash route, `/#/s/<id>/l/<lane>`), paired
/// like `devstack ui`: a click on a notification (`devstack://open`).
pub fn open_dashboard(route: &str) -> Result<()> {
let url = format!(
Expand Down Expand Up @@ -557,13 +561,16 @@ mod tests {
let id = devstack_daemon::registry::id_for(&devstack_proc::long_path(&file));
let port = devstack_hub::port();
let main = super::dashboard_links(&file, None);
assert_eq!(main.route, format!("/#/s/{id}?lane="));
assert_eq!(main.page, format!("http://127.0.0.1:{port}/#/s/{id}?lane="));
assert_eq!(main.route, format!("/#/s/{id}/l/main"));
assert_eq!(
main.page,
format!("http://127.0.0.1:{port}/#/s/{id}/l/main")
);
assert_eq!(main.link, format!("devstack://open?stack={id}"));
let lane = super::dashboard_links(&file, Some("feat-x"));
assert_eq!(
lane.page,
format!("http://127.0.0.1:{port}/#/s/{id}?lane=feat-x")
format!("http://127.0.0.1:{port}/#/s/{id}/l/feat-x")
);
assert_eq!(lane.link, format!("devstack://open?stack={id}&lane=feat-x"));
}
Expand Down
9 changes: 5 additions & 4 deletions crates/devstack/src/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,12 @@ fn dashboard_route(query: &str) -> Result<String> {
if !stack.chars().all(|c| c.is_ascii_hexdigit()) {
return Err(anyhow!("`{stack}` is no stack id"));
}
let mut route = format!("/#/s/{stack}");
// The lane view (ADR-0081): no lane named is the main working tree, the
// lane `main`; no lane is ever named so (ADR-0080).
let mut route = format!("/#/s/{stack}/l/{}", lane.as_deref().unwrap_or("main"));
if let Some(s) = service {
route.push_str(&format!("/services/{s}"));
}
route.push_str(&format!("?lane={}", lane.unwrap_or_default()));
Ok(route)
}

Expand Down Expand Up @@ -222,9 +223,9 @@ mod tests {
fn an_open_link_names_a_dashboard_route_and_nothing_else() {
assert_eq!(
dashboard_route("stack=ab12&lane=feat-x&service=api").unwrap(),
"/#/s/ab12/services/api?lane=feat-x"
"/#/s/ab12/l/feat-x/services/api"
);
assert_eq!(dashboard_route("stack=ab12").unwrap(), "/#/s/ab12?lane=");
assert_eq!(dashboard_route("stack=ab12").unwrap(), "/#/s/ab12/l/main");
assert_eq!(dashboard_route("").unwrap(), "/#/");
assert_eq!(dashboard_route("page=pool").unwrap(), "/#/pool");
assert!(dashboard_route("page=settings").is_err());
Expand Down
9 changes: 5 additions & 4 deletions crates/devstack/src/tray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,15 @@ fn plural(n: u64, one: &str) -> String {
}
}

/// `/#/s/<id>?lane=`, and with a service its page.
/// `/#/s/<id>/l/<lane>` (`main`: the main working tree, ADR-0081), and
/// with a service its page.
fn route(stack: &str, lane: Option<&str>, service: Option<&str>) -> String {
let enc = crate::client::enc;
let mut r = format!("/#/s/{}", enc(stack));
let lane = lane.filter(|l| !l.is_empty()).unwrap_or("main");
let mut r = format!("/#/s/{}/l/{}", enc(stack), enc(lane));
if let Some(s) = service {
r.push_str(&format!("/services/{}", enc(s)));
}
r.push_str(&format!("?lane={}", enc(lane.unwrap_or(""))));
r
}

Expand Down Expand Up @@ -463,7 +464,7 @@ mod tests {
assert!(find(&m.entries, "stop:ab12").is_some());
assert!(find(&m.entries, "start:ab12").is_none());
assert!(find(&m.entries, "start:cd34").is_some());
assert!(find(&m.entries, "open:/#/s/ab12/services/api?lane=feat%20x").is_some());
assert!(find(&m.entries, "open:/#/s/ab12/l/feat%20x/services/api").is_some());
assert!(find(&m.entries, "hub-start").is_none());
assert!(find(&m.entries, QUIT).is_some());
}
Expand Down
105 changes: 105 additions & 0 deletions docs/adr/0081-a-stack-has-a-page-every-lane-the-same-view.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# ADR-0081: A stack has a page of its own; every lane, `main` included, has the same view

- **Status:** Accepted (card in the pull request)
- **Date:** 2026-10-30
- **Deciders:** project owner
- **Related:** [ADR-0024](0024-a-lane-is-a-supervisor-in-the-main-trees-daemon.md) (a worktree is a lane), [ADR-0047](0047-the-dashboard-makes-a-lane-from-a-branch.md) (the branch picker), [ADR-0067](0067-a-change-at-runtime-says-who-made-it.md) (who serves the main ports, set how), [ADR-0070](0070-a-review-card-comes-before-the-code-an-adr-records-what-was-built.md), [ADR-0076](0076-a-pool-machine-has-one-page-the-pool-area-has-tabs.md) (the URL style of the pool area), [ADR-0078](0078-the-hub-follows-every-stacks-worktrees.md) (a stopped stack's worktrees), [ADR-0080](0080-the-main-tree-answers-as-a-lane-shared-is-deprecated.md) (the main tree answers as the lane `main`; `singleton`), [#387](https://github.com/nuetzliches/devstack/issues/387) (several stacks on one machine)

## Context

The dashboard showed a stack as its main working tree with its lanes
beside it. The main tree's view differed from a lane's in many places: its
header had Start and Stop stack and the daemon's pid, port and uptime, a
lane's had its own actions, Serve main ports, Move and Share; the start
card, the branch picker and the command palette each told the two apart.
What belongs to the stack (its daemon, the main ports, the services that
run once per machine) had no place of its own and sat in the main tree's
view. The lane shown was store state, not in the URL (`?lane=` was read
once and dropped).

ADR-0080 made the main tree answer as the lane `main`, so a client can
address every tree the same way. The daemon is unchanged: the main tree is
still its own tree.

## Decision

The owner approved the points in the conversation on **2026-10-30**:

| Category | Point | Beats | Reversing costs |
|---|---|---|---|
| concept | Every lane, `main` (the main working tree) included, has the same view and the same switches. The UI distinguishes only whether a lane holds the main slot (the fixed ports), not where it comes from. | A main tree's view of its own, and texts that address the main tree and a lane separately. | UI only. |
| concept | A stack has a page of its own above its lanes: its lanes, the main slot, its singleton services, need and usage (later: a port graph and a port shift, #387). | The stack's things in the main tree's view, and no place for what spans its lanes. | UI only; a route less. |
| contract | Stack-level actions (start, stop and restart the stack, give the main slot to lane X) live on that page; a lane's actions live in the lane view only. | Stack and lane actions mixed in one header. | UI only. |

What was built:

1. **Routes.** `#/s/<stack>` is the stack's page; `#/s/<stack>/l/<lane>/...`
a lane's views, with the tabs as before (overview, a service, a
container, infrastructure, commands, usage, activity), `main` for the
main working tree. The store's lane follows the route, and the route the
store when it shows another lane by itself (a lane made from a branch,
`main` after a lane's worktree went). Older links still work:
`#/s/<stack>?lane=x` and `#/s/<stack>/services/...`, `/infra...`,
`/commands`, `/usage`, `/events` go to the same tab of the lane named,
else of the lane shown last, else of `main`. The CLI's links
(`devstack status`, `up`, `ui --link`), the notifications', the
`devstack://open` route and the tray's use the new form.
2. **One lane view.** The main tree is a lane entry in the dashboard:
name `main`, at the repository, its branch, offset 0, holding the main
ports unless a lane does, started unless nothing of it runs. The header,
the start card, the branch picker and the command palette treat it as
any lane. Its actions map to what its daemon offers: Start is its
`POST /v1/up`, Stop its `POST /v1/down?infra=true` (its services and
containers; the daemon and the other lanes keep running), Restart and
Rebuild restart (rebuild) each of its running services at the same time,
as a lane's warm restart does, since the daemon has no restart of the
whole main tree. Shown disabled, each with a one-line reason: Cold,
Discard data, Remove worktree, Move, Share, a start in the pool and a
profile other than the daemon's. *Serve main ports* is the same button
in every lane that does not hold them; in `main` it takes them back. A
`main` with nothing running shows the start card, as a lane not started
does.
3. **The stack's page.** Its name, repository, the daemon's state (pid,
port, uptime; idle; offline) and version, the restart banner (another
devstack installed, a changed stack file); Start stack, Stop stack
(every lane and the daemon, `POST /hub/stacks/{id}/down?all=true`, the
confirmation listing the lanes that stop) and Restart stack; who serves
the main ports, since when and set how, with a control to give them to
another started lane or back to `main`; the lanes (`main` first, then by
name: branch, here or the node, state, port offset, the main-ports mark,
CPU and memory from each lane's own `/v1/usage`, read every 10 seconds),
a row opening the lane's views; and the services that run once per
machine. A stopped stack's page shows Start stack and its worktrees as
the hub lists them. It follows the main tree's stream without making
`main` the lane an older link opens.
4. **`ServiceView.singleton`**: the daemon says whether a service runs
once per machine (`Service::singleton()`, `singleton = true` or the
deprecated `lanes = false`); an older daemon omits it, and the page says
it does not know.
5. **Sidebar, switcher, palette.** The sidebar's stack row opens the
stack's page; the trees under it, `main` first and always listed, open
their lane views on the tab shown last; the highlight follows the route.
The stack switcher opens a stack's page and a lane's view. The command
palette offers the stack's actions and its lanes on the stack's page,
the lane's actions, views, services and commands in a lane view. The
sidebar's per-stack menu keeps Start and Stop (every lane).

Decided by the agent alone (not asked): main's Restart and Rebuild as
per-service restarts of what runs; the main tree's Stop without a
confirmation, as a lane's; the stack page's "need" left at usage (no API
gives a stack's need without a pool); the main tree shown with the start
card when nothing of it runs; Move and Share shown disabled for `main` only
where the pool offers nodes, as they are shown for a lane only then; the
sidebar listing `main` under every stack, also one without worktrees.

## Consequences

- One view to change for every lane; the main tree's exceptions are a
list of disabled items with their reasons, in one place
(`ui/src/lib/laneActions.ts`).
- A link names the lane it shows; a bookmark and a notification open the
same lane again, whichever was shown last.
- Stop stack means the whole stack now; stopping only the main tree is
`main`'s Stop.
- The stack's page is where a port graph and a port shift for several
stacks on one machine (#387) go.
1 change: 1 addition & 0 deletions docs/adr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,4 @@ stay.
| [0078](0078-the-hub-follows-every-stacks-worktrees.md) | The hub follows every stack's worktrees; a stopped stack's lane can be started from the dashboard | Accepted (card in the pull request) |
| [0079](0079-skills-local-to-a-working-tree.md) | Skills local to a working tree: a pool's project skills bound to their repository, devstack's own untracked | Accepted (card in the pull request) |
| [0080](0080-the-main-tree-answers-as-a-lane-shared-is-deprecated.md) | The main working tree answers as the lane `main`; `singleton` replaces `lanes = false`; `shared` is deprecated | Accepted (card in the pull request) |
| [0081](0081-a-stack-has-a-page-every-lane-the-same-view.md) | A stack has a page of its own; every lane, `main` included, has the same view | Accepted (card in the pull request) |
Loading