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

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

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

opened this

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: d opens 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 calls deleteLabel from src/actions/repos.ts, re-reads the list and shows "Deleted that label." The confirm is the existing confirmScreen from src/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 deleteLabel reports them differently but I chose not to split the wording.
  • Who sees d: Only someone requireRepoAdmin admits sees d in 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 d is pressed.
  • Tests: test/tui-labels.test.ts gains 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 offered d.

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

Closes #7843

commented

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: d opens 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 calls deleteLabel from src/actions/repos.ts, re-reads the list and shows "Deleted that label." The confirm is the existing confirmScreen from src/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 deleteLabel reports them differently but I chose not to split the wording.
  • Who sees d: Only someone requireRepoAdmin admits sees d in 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 d is pressed.
  • Tests: test/tui-labels.test.ts gains 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 offered d.

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

Changes requested — before the latest push

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:

  1. Docs: docs/APPS.md:152 still says an admin presses n and a reader is not offered n. Add d: 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.
  2. The result line is stale: note is cleared only when d is pressed. "Deleted that label." stays after moving with j/k or after n creates a label, and it costs a list row the whole time. Clear it in the move, back and n paths, or on any key.
  3. Tidy: remove the stray blank line added in the test imports. Put else if on the same line as the closing } of the d branch, as the n branch 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.

commented

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.md now describes d next to n, including the confirm naming the label, the Keep default, and that a reader is not offered it.
  • Result line: key() in src/tui/screens/labels.ts now clears note on every key, so "Deleted that label." no longer survives j/k, n or 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 if and else return false on the closing } line, as the n branch 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.

Approved

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_LINE still says "make a label". Reword it to cover deleting too.
  • Non-blocking: when labels is empty, d clears note and then returns false without calling ctx.invalidate(), so a stale note can linger until the next repaint. Return early before clearing, or invalidate.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs