Repository navigation
Polish UX for sandbox commands - #4
Conversation
|
I was able to reproduce that too by making my terminal window narrower. So it seems that the spinner library (yacspin) doesn't work properly when you try to print a message that doesn't fit in the terminal. I don't see an issue for that library, but the other popular Go spinner library seems to have the same issue. It appears to be a common challenge for spinners, though potentially solvable. As a quick workaround, perhaps we could truncate the message to fit in the terminal while the spinner is running, and then print the full message only at the end when the spinner stops. |
|
@scott-cotton I implemented the above workaround. PTAL. |
scott-cotton
left a comment
There was a problem hiding this comment.
Regarding the print package, it seems to me that it is starting to scatter the consolidation of a command implementation under internal/command/
Would it be possible to have things like print.{ClusterTable, SandboxDetails} in its own file and function under internal/command/? In this scenario I would consider what's remaining in print to be minor helper functionality such as making the json more like the yaml, and it seems it would retain the nice property of the current organisation in this PR of breaking out individual cases when they start to become more cumbersome in the switch statement.
Looks like that will work, great. At the same time, I'd personally have preferred being more conservative about the packages we import, as often enough the dependencies + such workarounds end up taking more time in the long run than building directly what we need, starting with minimal features. A spinner seems like a it may be such a case. |
Good point. I moved the command-specific printers back into the same package as the rest of each command's implementation.
I thought so too so I started without a spinner at all and just trying to rewrite the status line. I started running into terminal nuances and at some point I decided it would be a better use of my time to just pick an off-the-shelf library because I don't know enough about this terminal magic. |
foxish
left a comment
There was a problem hiding this comment.
LGTM aside from the one comment
| } | ||
| status := result.Payload.Status | ||
| if status.Ready { | ||
| spin.Message("Waiting for sandbox to begin terminating.") |
There was a problem hiding this comment.
seems like a weird error message - maybe we group this under "Waiting for sandbox to terminate"?
…rnings) Address findings #3, #4, #5, #6 from the versioned-resource-plugins UX pass. #4 — apply immutable-version error: the previous code matched on *ApplyResourcePluginConflict, but the go-sdk's transport middleware (FixAPIErrors) intercepts every 4xx/5xx response before the per-endpoint typed reader runs, so that type is never in the error chain and the catch-and-rewrite was dead code. Users saw the generic '409 Conflict: plugin version already exists'. Switch to errors.As against *transport.APIError + Code==409 (the same pattern used in planexec/logs). Also #11 — branch the message text on the bare-name vs. concrete-version case: a bare-name author has no '@semver' suffix to bump, so the 'bump the version field' advice was a dead end; now they get a concrete 'add an @<semver> suffix to publish a new revision (e.g. [email protected])'. #5 — apply success line: previously stayed silent on the version for bare-name authors ('Created resource plugin my-plugin') while explicit-version authors saw '@0.0.1'. The asymmetry hid the versioning rule from exactly the population that most needed to learn it. Always echo the explicit version on the apply success line (rendering '@0.0.0' for bare publishes). The list/table/get-yaml output continues to bare the default version for backward compatibility with pre-versioning clients — this one message is explicit on purpose, as a teaching moment. #3 — bare-form delete: previously silently removed only the latest version with no indication that others remained, a footgun for users who assumed 'delete my-plugin' meant 'delete the plugin'. Resolve the latest version explicitly before the delete (one List call), then report which version was removed and how many remain, e.g. 'Deleted resource plugin [email protected]. 1 other version(s) remain (use 'signadot resourceplugin versions my-plugin' to list).' #6 — delete-in-use: previously surfaced the server's generic '400 Bad Request: plugin is currently in use' with no hint about which sandbox(es) were holding the version. Enrich client-side: on that specific 400 we GET the plugin and surface Status.Resources sandbox names: 'resource plugin [email protected] is still referenced by sandbox(es): a, b'. Falls back to the original error if the enrichment can't be done. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

Uh oh!
There was an error while loading. Please reload this page.