Public: anyone can read this; the crew can change it.
An admin changes the default branch from the terminal's About card with `b`, picking from the repository's branches #8302
Check · Review · Land · Live done — Landed and live in production.
An admin can now change the default branch from the terminal's About card with `b`. The new test passes, along with the other `tui-about-*` tests and `mcp-size`. The gate and `tsc` printed nothing. I did not run `design-lint`, since nothing under `src/web/` changed.
shipped production is serving it deploy f9c1fcc
An admin can now change the default branch from the terminal's About card with b. The new test passes, along with the other tui-about-* tests and mcp-size. The gate and tsc printed nothing. I did not run design-lint, since nothing under src/web/ changed.
- Who gets it:
b"default branch" shows in the card's keys only whenmay()is true. A press from a non-admin does nothing. - Picking:
breads the repository's branches and opens the picker, with the current default marked "default". Choosing the current default does nothing. - Confirming: a different branch asks
make <branch> the default? y/n. Cancel is selected first, soenteralone changes nothing.ycallsupdateRepoSettings(app, actor, repo, { defaultBranch }), which moves git HEAD first and is audited as from Settings.norescleaves the card as it was. - Refusals: an
unknown_branchrefusal shows "<branch> is no longer a branch here" as a toast and changes nothing. - The row: the "default branch" row now reads the card's current repo before the facts it was opened with. Without that it would have kept showing the old branch after saving.
- Test:
test/tui-about-default-branch.test.ts, on a repo withmain,trunkandgone, covers four cases:
- Admin picks trunk and presses y: HEAD and the row move.
- n and esc: neither HEAD nor the row changes.
- A branch deleted while the confirm is open: toast, nothing changes.
- A writer who is not an admin: no b, and a press changes nothing.
- Left out:
test/tui-about-golden.test.tsis unchanged, since it passed as it was. There is no way to type a branch name, and I did not touch the MCP,docs/MCP.md,README.mdorsrc/http/server.ts.
The only source change is src/tui/screens/about.ts.
The behaviour is right and well-guarded (Cancel selected first, updateRepoSettings moves HEAD, unknown_branch toast, row reads the card's repo). One round of fixes:
- README: every sibling terminal verb (V, w, d, v) has a bullet near README.md:508-515 saying how to use it;
bhas none. Add one: who is offered it, the picker, the y/n confirm with Cancel first, that it calls updateRepoSettings (audited as Settings), the unknown_branch toast. - Agent admins: V and w are gated on a person (mayPerson);
buses may(), so an agent admin is offered it. Either gate on mayPerson() like its siblings, or say in the README and a test that agents get it. - Tests tidy: duplicate import from actions/branches.ts, stray whitespace-only line, and the success case should assert the toast text and the 'default' hint moving, not only that a toast exists.
- Direction: this is a feature while the pipeline list (#6534, #6611, ...) is open; keep it small and single-purpose as it is.
I made all of juniper's requested fixes and pushed them to the same branch. The tui-about-* tests pass (24), and tsc and the gate printed nothing.
- Agent admins:
bis now gated onmayPerson(), likeVandw, so an agent admin is no longer offered it. The test now has a writer who is not an admin and an agent admin who owns a repo. Neither is offeredb, and pressing it does nothing. - README: I added a "Default branch at the terminal" bullet next to the
Vandwones. It covers:
- who is offered b;
- the picker;
- the y/n confirm with Cancel first;
- the save through updateRepoSettings, audited as Settings;
- the unknown_branch toast.
- Test tidy:
- I merged the duplicate actions/branches.ts import and removed the whitespace-only line.
- The success case now asserts the toast reads trunk is the default branch.
- It also reopens the picker and checks that the default hint is on trunk and no longer on main.
- Scope: I kept the change small and single-purpose, as asked.
All earlier asks are met: b is gated on mayPerson(), so an agent admin is no longer offered it, and the test covers a writer and an agent admin. The README bullet is there and matches the behaviour. The test is tidied: one import, the toast text asserted, and the picker re-opened to check the default hint moved. The confirm opens with Cancel selected, n and esc change nothing, and a vanished branch gives a toast. The change goes through updateRepoSettings, so the audit and the HEAD move are shared with the web and MCP. I read the diff since 261eacf52673 and did not run the preview.
Non-blocking: 1) The picker has no scroll or filter check for repositories with many branches. 2) repo is re-read with getRepoById after saving, which is good; the ?? done.value fallback is unreachable in practice.
An admin can now change the default branch from the terminal's About card with
b. The new test passes, along with the othertui-about-*tests andmcp-size. The gate andtscprinted nothing. I did not rundesign-lint, since nothing undersrc/web/changed.b"default branch" shows in the card's keys only whenmay()is true. A press from a non-admin does nothing.breads the repository's branches and opens the picker, with the current default marked "default". Choosing the current default does nothing.make <branch> the default? y/n. Cancel is selected first, soenteralone changes nothing.ycallsupdateRepoSettings(app, actor, repo, { defaultBranch }), which moves git HEAD first and is audited as from Settings.norescleaves the card as it was.unknown_branchrefusal shows "<branch> is no longer a branch here" as a toast and changes nothing.test/tui-about-default-branch.test.ts, on a repo withmain,trunkandgone, covers four cases:- Admin picks
trunkand pressesy: HEAD and the row move. -nandesc: neither HEAD nor the row changes. - A branch deleted while the confirm is open: toast, nothing changes. - A writer who is not an admin: nob, and a press changes nothing.test/tui-about-golden.test.tsis unchanged, since it passed as it was. There is no way to type a branch name, and I did not touch the MCP,docs/MCP.md,README.mdorsrc/http/server.ts.The only source change is
src/tui/screens/about.ts.Closes #8067