fix(storage): align prompt fallbacks and TTY handling with CLI#119
Conversation
…tions - Use the shared isInteractive() gate (stdin + stdout TTY, json-aware) instead of stdout-only checks in the zone resolver, link, and zone add - zones update: require field flags whenever non-interactive (json, non-TTY, or --force) instead of only under --output json, and abort the whole interactive edit on a mid-flow cancel rather than applying partial answers - zones update --force now matches zones add: skip prompts and confirmations, use flag values only - storage zone domains commands now resolve the zone like every other storage command: explicit ref, then linked zone, then picker
|
@codex review |
🦋 Changeset detectedLatest commit: bba2541 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Greptile SummaryThis PR standardises TTY detection and non-interactive gate across storage commands by replacing ad-hoc
Confidence Score: 5/5Safe to merge. Changes are scoped to CLI prompt gating and PATCH body construction; no API calls, auth logic, or data-plane code is altered. All changed code paths are straightforward control-flow fixes. The cancellation refactor correctly uses the onCancel flag pattern, the conditional ReplicationZones omission is logically sound, and the isInteractive() consolidation tightens (rather than loosens) the interactive gate. The domains fallback change is additive and mirrors the existing pattern used by every other storage command. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Command invoked] --> B{ref provided?}
B -- yes --> C[resolveStorageZone by name/ID]
B -- no --> D{manifest linked zone?}
D -- yes --> E[fetchStorageZone from manifest]
D -- no --> F{opts.force OR !isInteractive}
F -- yes --> G[throw: A storage zone is required.]
F -- no --> H[Interactive picker]
H --> I{User selects zone?}
I -- cancel --> J[throw: A storage zone is required.]
I -- ok --> K[fetchStorageZone by ID]
C --> L[Zone resolved]
E --> L
K --> L
L --> M{hasFlags?}
M -- yes --> N[settingsFromFlags]
M -- no --> O{interactive?}
O -- no --> P[throw: No changes requested.]
O -- yes --> Q[promptSettings]
Q --> R{User cancels mid-flow?}
R -- yes --> S[throw: Update cancelled.]
R -- no --> T[Return settings with ReplicationZones=undefined if no new picks]
N --> U{settings.ReplicationZones set?}
T --> U
U -- yes --> V[confirmAddedReplicationRegions]
V --> W{Confirmed or --force?}
W -- no --> X[log Cancelled. return]
W -- yes --> Y[PATCH /storagezone/id]
U -- no --> Y
Y --> Z[Output result]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[Command invoked] --> B{ref provided?}
B -- yes --> C[resolveStorageZone by name/ID]
B -- no --> D{manifest linked zone?}
D -- yes --> E[fetchStorageZone from manifest]
D -- no --> F{opts.force OR !isInteractive}
F -- yes --> G[throw: A storage zone is required.]
F -- no --> H[Interactive picker]
H --> I{User selects zone?}
I -- cancel --> J[throw: A storage zone is required.]
I -- ok --> K[fetchStorageZone by ID]
C --> L[Zone resolved]
E --> L
K --> L
L --> M{hasFlags?}
M -- yes --> N[settingsFromFlags]
M -- no --> O{interactive?}
O -- no --> P[throw: No changes requested.]
O -- yes --> Q[promptSettings]
Q --> R{User cancels mid-flow?}
R -- yes --> S[throw: Update cancelled.]
R -- no --> T[Return settings with ReplicationZones=undefined if no new picks]
N --> U{settings.ReplicationZones set?}
T --> U
U -- yes --> V[confirmAddedReplicationRegions]
V --> W{Confirmed or --force?}
W -- no --> X[log Cancelled. return]
W -- yes --> Y[PATCH /storagezone/id]
U -- no --> Y
Y --> Z[Output result]
Reviews (2): Last reviewed commit: "fix(storage): address review feedback on..." | Re-trigger Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4b5363b18b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Honor --force when resolving the update target: pass it through to resolveStorageZoneInteractive so a missing zone errors instead of opening the picker - Omit ReplicationZones from the interactive editor's settings when no new regions were picked, keeping replication out of the update body - Clarify that flags take full precedence over the interactive editor
--forcenow matches zones add: skip prompts and confirmations, use flag values only