Skip to content

fix(cli): accept the short stack id from stack list in --stack-id - #6967

Open
avallete wants to merge 2 commits into
developfrom
avallete/stack-id-short-form-bdf76d
Open

avallete wants to merge 2 commits into
developfrom
avallete/stack-id-short-form-bdf76d

Conversation

@avallete

@avallete avallete commented Oct 2, 2026

Copy link
Copy Markdown
Member

Summary

TL;DR: supabase stack list prints an 8-character stack ID, but every --stack-id flag rejected it and required the full 64-character id. Every stack command now accepts the short ID from the list, or any unique prefix of at least four characters, the same convention git and docker use. The list table keeps its compact column.

Before

flowchart LR
  L["stack list"] --> S["ID column: 8 chars"]
  S --> D["stack destroy --stack-id abcd1234"]
  D --> E["error: must be a lowercase SHA-256 stack id"]
Loading

After

flowchart LR
  A["--stack-id value"] --> B{"4-64 lowercase hex?"}
  B -->|no| E["flags error + hint"]
  B -->|64 chars| F["exact lookup"]
  B -->|4-63 chars| D["match saved stacks by prefix"]
  D -->|none| N["not found: run stack list"]
  D -->|several| G["ambiguous: lists full ids"]
  D -->|one unreadable| I["read error surfaced"]
  D -->|one| OK["full id used"]
  F --> OK
Loading

Why

Copying the ID column from stack list into stack destroy --stack-id (or stop, status, ...) failed with --stack-id must be a lowercase SHA-256 stack id, so users had to rerun the list with --output-format json to find the real id.

What changed

  • The shared stack target resolver accepts a full id (unchanged exact lookup) or a unique lowercase-hex prefix of 4 or more characters. This covers destroy, stop, start, restart, status, logs, and prepare.
  • A prefix matching several stacks fails with a flags error listing every matching full id. A prefix matching a stack whose saved state is unreadable surfaces the read error instead of reporting it missing.
  • "Not found" and malformed-id errors now point to supabase stack list.
  • The status --env pointer printed by stack start repeats the resolved full id rather than the typed prefix.
  • Flag help, command SIDE_EFFECTS.md files, and docs/stack-commands.md describe prefix selection.

A prefix is resolved by scanning the saved stacks, the same way stack list does, so it costs one identity probe per running stack. A full id keeps the direct lookup.

Linked issue

Closes CLI-2609

🤖 Generated with Claude Code

`stack list` shows an 8-character ID prefix, but every --stack-id
selector required the full 64-character id. The shared stack target
resolver now accepts any unique lowercase-hex prefix of at least four
characters, reports ambiguous prefixes with the matching full ids, and
surfaces unreadable matching state instead of reporting it missing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@avallete
avallete requested a review from a team as a code owner October 2, 2026 20:08
@avallete

avallete commented Oct 2, 2026

Copy link
Copy Markdown
Member Author

/ai-review

@github-actions github-actions Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Superseded by a newer AI review

🤖 AI Review

Both independent reviews were available. Confirmed Claude's single diagnostic nit: prefix lookup discards the original unreadable-state error. Codex reported no findings. Corrected the finding's line range against the checked-out code. No additional issues found; tests were not run.

Findings

Severity Location Category Sources Claim
⚪ NIT apps/cli/src/commands/experimental/stack/stack.shared.ts:150 error-handling claude When a prefix uniquely selects an unreadable saved stack, the resolver preserves only the StateError's message and discards its cause chain, reducing diagnostic detail. The resulting error also has no suggestion.

Stats

Claude findings: 1 · Codex findings: 0 · Confirmed: 1 · Refuted: 0 · Uncertain: 0


Models: claude-opus-5-5 + gpt-6.1-sol · Trigger: auto · Workflow run

This review runs once per PR. A maintainer can request another with a /ai-review comment.

Comment thread apps/cli/src/commands/experimental/stack/stack.shared.ts

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 AI Review

Both independent reviews were available. Code verification confirms Claude’s minor performance concern and test-coverage nit. Codex reported no findings. No functional correctness bug was verified.

Findings

Severity Location Category Sources Claim
🟡 MINOR apps/cli/src/commands/experimental/stack/stack.shared.ts:127 performance claude Prefix resolution probes every saved stack with a leased owner before filtering by prefix, so unrelated owners add HTTP requests and can delay selection.
⚪ NIT apps/cli/src/commands/experimental/stack/start/start.handler.ts:500 test-coverage claude Tests do not cover printing the resolved full ID after starting with a prefix, or rejecting a prefix shared by one readable and one unreadable stack.

Stats

Claude findings: 2 · Codex findings: 0 · Confirmed: 2 · Refuted: 0 · Uncertain: 0


Models: claude-opus-5-5 + gpt-6.1-sol · Trigger: manual · Workflow run

This review runs once per PR. A maintainer can request another with a /ai-review comment.

Comment thread apps/cli/src/commands/experimental/stack/stack.shared.ts Outdated
Comment thread apps/cli/src/commands/experimental/stack/start/start.handler.ts
`discover` takes an `idPrefix` so a prefix lookup observes owners only
for matching stacks. An unreadable prefix match keeps its state error as
the cause and points at the registry. Tests cover a prefix shared by
readable and unreadable stacks, destroying one of several stacks by
prefix, and the start status pointer repeating the full id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant