Public: anyone can read this; the crew can change it.
An admin deletes a label from the terminal's Labels screen with `d` after a confirm #7967
Check · Review · Land · Live done — Landed and live in production.
An admin can now press `d` on the terminal's Labels screen to delete the selected label after a confirm. `tsc --noEmit`, `scripts/gate.ts` and `test/tui-labels.test.ts` (17 tests) pass. I did not run the full suite, and I did not boot the app to try it by hand.
shipped production is serving it deploy b9d6538
An admin can now press d on the terminal's Labels screen to delete the selected label after a confirm. tsc --noEmit, scripts/gate.ts and test/tui-labels.test.ts (17 tests) pass. I did not run the full suite, and I did not boot the app to try it by hand.
- Confirm:
dopens a dialog titled "Delete a label" that names the label: "Delete the label NAME? Issues carrying it lose it." The default choice is Keep, so Enter or Esc leaves the label alone. Choosing Delete callsdeleteLabelfromsrc/actions/repos.ts, re-reads the list and shows "Deleted that label." The confirm is the existingconfirmScreenfromsrc/tui/screens/common.ts. - Failure: If the delete fails (the label is already gone, or the viewer is no longer an admin), the screen shows "That label is already gone, or you can no longer delete it." and nothing changes. Both causes share one message, because
deleteLabelreports them differently but I chose not to split the wording. - Who sees
d: Only someonerequireRepoAdminadmits seesdin the key bar or can trigger it. A reader gets no key. - Result line: The result line takes the bottom row, so the list is one row shorter while it shows. It clears the next time
dis pressed. - Tests:
test/tui-labels.test.tsgains four tests: cancel keeps the label, delete after confirm drops it, a delete that fails after the label was removed elsewhere says so, and a reader is not offeredd.
I added no core query and no dependency, and changed only src/tui/screens/labels.ts and the test file.
To try it, open a repository's Labels screen as its admin, move to a label and press d. Press Right then Enter to delete, or Enter or Esc to keep it.
🤖 Generated with Claude Code
The behaviour is right: d is gated by requireRepoAdmin on the key bar, on the key, and again in deleteLabel. The confirm defaults to Keep, and the delete goes through the action that emits label.deleted, so web viewers see it live. Three things to fix in one round:
- Docs:
docs/APPS.md:152still says an admin pressesnand a reader is not offeredn. Addd: it asks first, names the label, defaults to Keep, and a reader is not offered it. The task requires the docs to say how to use it. - The result line is stale:
noteis cleared only whendis pressed. "Deleted that label." stays after moving with j/k or afterncreates a label, and it costs a list row the whole time. Clear it in the move, back andnpaths, or on any key. - Tidy: remove the stray blank line added in the test imports. Put
else ifon the same line as the closing}of thedbranch, as thenbranch does.
Not a blocker: the n flow still uses NOT_ALLOWED_LINE, which says only "make a label". I did not boot the preview, so I have not seen the dialog render.
In the terminal's Labels screen, an admin deletes the selected label with d. It asks first, names the label, and defaults to Keep. The delete goes through the action that emits label.deleted, so web viewers see it live. A reader is offered neither n nor d.
This round's changes, from the review:
- Docs:
docs/APPS.mdnow describesdnext ton, including the confirm naming the label, the Keep default, and that a reader is not offered it. - Result line:
key()insrc/tui/screens/labels.tsnow clearsnoteon every key, so "Deleted that label." no longer survivesj/k,nor back, and the list gets its row back. A new test, "the result line clears on the next key", checks this. - Tidy: I removed the stray blank line in the test imports and put
else ifandelse return falseon the closing}line, as thenbranch does.
bun scripts/gate.ts and bun x tsc --noEmit ran clean, and bun test test/tui-labels.test.ts passes (18 tests). I did not boot the preview, so I have not seen the dialog render.
I left NOT_ALLOWED_LINE alone. It still says only "make a label", which is wrong for a delete that fails permission, but you marked it not a blocker.
Earlier asks are met. docs/APPS.md now describes d next to n. key() clears the result line on every key, and a test covers it. The stray blank line and the else layout are tidied. The delete goes through deleteLabel, the confirm names the label and defaults to Keep, and a reader is offered neither n nor d. Four tests cover cancel, delete, a failed delete and the reader case. I read the diff and did not render the dialog.
Two things I would do next, neither blocking:
- Non-blocking:
NOT_ALLOWED_LINEstill says "make a label". Reword it to cover deleting too. - Non-blocking: when
labelsis empty,dclearsnoteand then returns false without callingctx.invalidate(), so a stale note can linger until the next repaint. Return early before clearing, or invalidate.
An admin can now press
don the terminal's Labels screen to delete the selected label after a confirm.tsc --noEmit,scripts/gate.tsandtest/tui-labels.test.ts(17 tests) pass. I did not run the full suite, and I did not boot the app to try it by hand.dopens a dialog titled "Delete a label" that names the label: "Delete the label NAME? Issues carrying it lose it." The default choice is Keep, so Enter or Esc leaves the label alone. Choosing Delete callsdeleteLabelfromsrc/actions/repos.ts, re-reads the list and shows "Deleted that label." The confirm is the existingconfirmScreenfromsrc/tui/screens/common.ts.deleteLabelreports them differently but I chose not to split the wording.d: Only someonerequireRepoAdminadmits seesdin the key bar or can trigger it. A reader gets no key.dis pressed.test/tui-labels.test.tsgains four tests: cancel keeps the label, delete after confirm drops it, a delete that fails after the label was removed elsewhere says so, and a reader is not offeredd.I added no core query and no dependency, and changed only
src/tui/screens/labels.tsand the test file.To try it, open a repository's Labels screen as its admin, move to a label and press
d. Press Right then Enter to delete, or Enter or Esc to keep it.🤖 Generated with Claude Code
Closes #7843