fix(cli): reject off-tier template cpu/memory pairs before the API - #96
Merged
Merged
Conversation
Follow-up to #94. The backend only accepts PUBLISHED vCPU/memory pairs (xs 1/2048, small 2/4096, medium 4/8192, large 8/16384, xl 16/32768); disk is a free-form floor. `templates create` previously forwarded any --cpu/--memory combination, so an off-tier pair like --cpu 4 --memory 4gb (4 vCPU / 4 GB) was sent and rejected by the platform with a shape-mismatch 500 after the Dockerfile upload. Now `templates create` resolves resources locally: a --cpu/--memory pair must match a published shape. An off-tier pair fails fast before any API call with an actionable message naming the nearest size (e.g. "cpu/memory 4/4096 isn't a supported pair; nearest is medium (4 vCPU / 8192 MiB); pass --size medium"). A pair that conflicts with an explicit --size is also rejected. --disk stays free-form and --size <name> is always safe. When no cpu/memory pins are given, resources are still omitted so the server picks its default. No version bump. tsc clean; 431 tests pass, incl. a new off-tier rejection test.
Merged
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.
Follow-up to #94 (already merged), addressing coordinator feedback on the
templates createresource flags.Problem
The backend only accepts published vCPU/memory pairs:
Disk is a free-form floor. After #94,
templates createforwarded any--cpu/--memorycombination, so an off-tier pair like--cpu 4 --memory 4gb(4 vCPU / 4 GB) was sent and rejected by the platform with a shape-mismatch 500 — after the Dockerfile upload.Fix
templates createnow resolves resources locally (resolveTemplateResources) and refuses off-tier pairs before any API call:--cpu/--memorypair must match a published shape; a missing member is filled from--size(orsmall).cpu/memory 4/4096 isn't a supported pair; nearest is medium (4 vCPU / 8192 MiB); pass --size medium--sizeis rejected (match large, not --size small).--diskstays free-form;--size <name>alone is always safe; with no cpu/memory pins the fields are omitted so the server defaults.Verification
npm run build(tsc): clean.npm test: 431 pass (67 files), incl. a new off-tier rejection test; the prior test updated to a validmediumpair (4 vCPU / 8 GB).4/4gband3/6gbfail locally with nearest-size hints;8/16gb --size smallreports the conflict; valid2/4gband--size largepass validation and proceed to the API. All emit clean JSON.No version bump.