Repository navigation
fix(cli): accept the short stack id from stack list in --stack-id - #6967
Conversation
`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>
|
/ai-review |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
🤖 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.
`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>
Summary
TL;DR:
supabase stack listprints an 8-character stack ID, but every--stack-idflag 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
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 --> OKWhy
Copying the ID column from
stack listintostack destroy --stack-id(orstop,status, ...) failed with--stack-id must be a lowercase SHA-256 stack id, so users had to rerun the list with--output-format jsonto 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, andprepare.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 --envpointer printed bystack startrepeats the resolved full id rather than the typed prefix.Flag help, command
SIDE_EFFECTS.mdfiles, anddocs/stack-commands.mddescribe prefix selection.The stack package's
discovertakes anidPrefix, so a prefix lookup only probes the owners of matching stacks. A full id keeps the direct lookup.Terminal captures
Recorded with
vhsfrom source on the base commit and on this branch, against two native demo stacks (default,feature-a) in a throwawaySUPABASE_HOME. Each capture runsstack list, destroysfeature-awith the 8-character ID from the list, then lists again.Before: the listed ID is rejected and both stacks remain.
After: the listed ID resolves to the full id,
feature-ais destroyed, anddefaultremains.Linked issue
Closes CLI-2609
🤖 Generated with Claude Code