Skip to content

fix: show human-readable labels in delete confirmation prompts#238

Merged
felipefreitag merged 3 commits intomainfrom
fix/contact-property-delete-confirm-label-2000
Apr 13, 2026
Merged

fix: show human-readable labels in delete confirmation prompts#238
felipefreitag merged 3 commits intomainfrom
fix/contact-property-delete-confirm-label-2000

Conversation

@bukinoshita
Copy link
Copy Markdown
Member

@bukinoshita bukinoshita commented Apr 9, 2026

Summary by cubic

Show human-readable labels in delete confirmations across all CLI delete commands to prevent mistakes. Satisfies BU-653 by showing the selected label plus the ID.

  • Bug Fixes
    • Added pickItem() in prompts to return { id, label }; pickId() now delegates to it for compatibility.
    • Updated 9 delete commands to use pickItem() and display "${label}" with ID: ${id} in confirmation prompts.
    • Added 4 tests for pickItem() covering direct ID, non-interactive, and optional flows.

Written for commit fb55bba. Summary will update on new commits.

…ations

Introduce pickItem() in prompts.ts that returns both the selected item's
ID and its human-readable label. Refactor pickId() to delegate to it.

Update all delete commands (contact-properties, domains, templates,
api-keys, webhooks, contacts, topics, broadcasts, segments) to use
pickItem() instead of pickId(), so the destructive confirmation prompt
displays the label the user selected (e.g. 'plan_name (string)') along
with the UUID, rather than showing only the opaque UUID.

Add tests for pickItem() covering direct-id, non-interactive, and
optional flows.

Fixes BU-653

Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
@bukinoshita bukinoshita marked this pull request as ready for review April 13, 2026 17:02
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 11 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/commands/segments/delete.ts">

<violation number="1" location="src/commands/segments/delete.ts:38">
P2: Escape control characters in `picked.label` before showing it in the delete confirmation prompt.</violation>
</file>

<file name="src/lib/prompts.ts">

<violation number="1" location="src/lib/prompts.ts:272">
P2: Direct ID input still uses the raw ID as `label`, so confirmations show the ID twice instead of a human-readable identifier.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

!!opts.yes,
{
confirmMessage: `Delete segment ${id}?\nContacts will not be deleted, but broadcasts targeting this segment will no longer work.`,
confirmMessage: `Delete segment "${picked.label}"?\nID: ${picked.id}\nContacts will not be deleted, but broadcasts targeting this segment will no longer work.`,
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Escape control characters in picked.label before showing it in the delete confirmation prompt.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/commands/segments/delete.ts, line 38:

<comment>Escape control characters in `picked.label` before showing it in the delete confirmation prompt.</comment>

<file context>
@@ -30,16 +30,16 @@ Non-interactive: --yes is required to confirm deletion when stdin/stdout is not
       !!opts.yes,
       {
-        confirmMessage: `Delete segment ${id}?\nContacts will not be deleted, but broadcasts targeting this segment will no longer work.`,
+        confirmMessage: `Delete segment "${picked.label}"?\nID: ${picked.id}\nContacts will not be deleted, but broadcasts targeting this segment will no longer work.`,
         loading: 'Deleting segment...',
         object: 'segment',
</file context>
Fix with Cubic

Comment thread src/lib/prompts.ts
): Promise<PickedItem | undefined> {
if (id) {
return id;
return { id, label: id };
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Direct ID input still uses the raw ID as label, so confirmations show the ID twice instead of a human-readable identifier.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/lib/prompts.ts, line 272:

<comment>Direct ID input still uses the raw ID as `label`, so confirmations show the ID twice instead of a human-readable identifier.</comment>

<file context>
@@ -249,25 +249,27 @@ export type PickerConfig<T extends { id: string }> = {
+): Promise<PickedItem | undefined> {
   if (id) {
-    return id;
+    return { id, label: id };
   }
 
</file context>
Fix with Cubic

@felipefreitag felipefreitag merged commit 3124566 into main Apr 13, 2026
7 checks passed
@felipefreitag felipefreitag deleted the fix/contact-property-delete-confirm-label-2000 branch April 13, 2026 20:38
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.

3 participants