Repository navigation
fix: align CLI requests with the v3 OpenAPI spec - #9
Merged
Merged
Conversation
Validate every command's request against https://api.sevalla.com/v3/openapi.json and fix the mismatches: wrong paths (process metrics), wrong or missing body fields (processes, domains, TCP proxies, private ports, IP restrictions, internal connections, load balancer destinations, CORS policies, object delete, backups, password reset, pipeline promote and preview), required fields that were optional flags, and pagination params sent to endpoints that don't accept them. Also handle empty 202 responses in the API client, fix the duplicated /v3 prefix in the unused endpoint helpers, and make the e2e suite runnable (CLI path, workflow paths, deployment statuses) with coverage for every changed command. Fixes #8
- object-storage objects delete now needs --confirm like every other delete - --enabled on ip-restriction updates accepts only true/false - pipeline preview boolean flags reject values other than true/false - e2e: state-dependent asserts now require a real API refusal (not a crash, timeout or auth error), and custom-domain tests use a domain the team owns
kristofdombi
approved these changes
Oct 18, 2026
|
🎉 This PR is included in version 1.10.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8. Thanks @netlemur for the detailed report.
What changed
I checked every command against the v3 OpenAPI spec: each command ran against a local server that captured its request, and the method, path, query and body were validated against the spec's schemas. Besides the seven commands in the issue, this found commands with wrong paths, missing required bodies, and fields the API ignores.
Requests the API rejected or misrouted
apps processes metrics cpu-usage|cpu-limit|memory-usage|memory-limit|instance-count/processes/(404)apps processes createdisplay_name,entrypoint,resource_type_id,scaling_strategy.--resource-typeis now required and--instancesdefaults to 1. New--schedule(cron) and--job-start-policy(job) flagsapps processes updatename,command,resource_type,instanceswere ignoredapps|static-sites|load-balancers domains addnameinstead ofdomain_namedomain_nameapps|static-sites|load-balancers domains update--nameapps tcp-proxies create,apps private-ports createprocess_idmissing,protocolnot in spec--process-id, removed--protocolapps deployments rollback--deployment-idapps|static-sites deployments triggertagis not in the spec--tagapps clonedisplay_nameis required--display-nameis requiredapps ip-restriction update--type,--ip-list,--enabledare required;--enabledaccepts onlytrueorfalsedatabases ip-restriction updateallow,deny,enabled--type,--ip-list,--enableddatabases connections internal-createapplication_id--target-id(required) and--target-type(defaultapp)databases reset-password--new-passworddatabases backups createdisplay_namemissing--namedatabases backups restoredatabases metrics all-storage|used-storage{ value }, but the CLI sentfrom/to/intervaland printed a time seriesload-balancers destinations createapplication_idandport,service_typemissing--service-type(required),--service-id,--url,--weight,--latitude,--longitudeobject-storage cors-policies create|updateoriginsandmethodsare requiredobject-storage objects deletekeyssent as a string--keys, sent as an array. Now that it really deletes, it also requires--confirm, like every other deletepipelines promote--source-app-idand--target-app-idspipelines preview enable|updateenablesent no body;updatesentbranchandauto_deploy--repo-url,--auto-create-app,--delete-stale-apps,--stale-app-days; the boolean flags accept onlytrueorfalsepipelines stages create,projects update,projects services addPagination
List commands sent
limitandoffsetto every endpoint. These endpoints don't define them:resources clusters|db-types|process-types|rbac-permissions|rbac-roles,users list,git providers,databases backups list,databases connections internal-list,object-storage cors-policies listandobject-storage objects list. The list factory now takespaginated: false, and those commands no longer send the parameters or show--page/--per-page.Other fixes
object-storage deletecrashed withUnexpected end of JSON input: the endpoint returns 202 with an empty body, and the client parsed every non-204 response as JSON. The client now returnsundefinedfor an empty body.src/client/endpoints/applications.tsbuilt/v3/v3/...paths, as noted in the issue.BASEis now/applications. Nothing importssrc/client/endpoints, so a follow-up could remove it.tests/e2e/helpers/cli.tspointed attests/dist/index.js, and the workflow matrix usede2e/tests/...paths. Fixed both, and added the fourapplication-*suites that were missing from the matrix. The e2e cleanup helpers also looked for deployment statuses the API doesn't use (in_progressand others instead ofwaiting/inProgress), so they never cancelled running deployments before deleting.Breaking changes
None of these flags ever produced a valid request, but scripts that pass them will now get an "unknown option" error:
apps deployments rollback --deployment-idapps|static-sites deployments trigger --tagapps private-ports create --protocoldatabases ip-restriction update --allow/--deny(use--typeand--ip-list)databases connections internal-create --application-id(use--target-id)load-balancers destinations create --application-id/--port(use--service-typeand--service-id)pipelines preview update --branch/--auto-deploySome commands also have new required flags; see the table above.
Tests
databases backups restoreis skipped when the database has no backup to restore.paginated: false, the empty 202 response, and the preview body.npm run typecheck,npm run lint,npm run format:checkand the unit tests pass. The full e2e suite was run against a Sevalla test account: 165 passed, 1 skipped (backup restore, as the test cluster has no backups), 0 failed.Follow-ups
object-storage objects listlists only the first page: the endpoint uses cursor pagination (cursor,prefix,limit), which the CLI doesn't support yet.databases reset-password --new-passwordputs the password in shell history; reading it from stdin or an env var would avoid that.src/client/endpointshelpers.