fix(cloud-exe-dev): reject non-decimal numeric options#808
Conversation
There was a problem hiding this comment.
Pull request overview
This PR tightens the exe.dev cloud adapter’s handling of CPU/memory/disk sizing inputs by rejecting non-decimal numeric option strings (instead of silently falling back), and adds adapter-level tests to lock in the intended behavior.
Changes:
- Update exe.dev sizing parsing to validate numeric inputs and surface explicit errors for invalid formats.
- Plumb clearer error labels (
cpu,memory,disk) into validation to improve diagnostics. - Add Vitest coverage for accepted decimal strings and rejected non-decimal strings.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/cloud/exe-dev/src/index.ts | Adds labeled numeric validation to reject non-decimal strings and avoid silent fallback. |
| packages/cloud/exe-dev/src/index.test.ts | Adds focused tests for accepted/rejected numeric option inputs and dry-run provisioning behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const text = value.trim(); | ||
| if (!/^(?:[1-9]\d*|0?\.\d+|[1-9]\d*\.\d+)$/.test(text)) { | ||
| throw new Error(`exe.dev ${label} must be a positive decimal number`); | ||
| } |
| const cpu = positiveNumber(spec.cpu ?? config.defaultCpu, 2, 'cpu'); | ||
| const memory = positiveNumber(spec.memory ?? config.defaultMemoryGb, 4, 'memory'); | ||
| const disk = positiveNumber(spec.storage ?? config.defaultDiskGb, 20, 'disk'); |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
3 similar comments
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
|
🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: |
Summary
Verification
Note: running through pnpm in this workspace currently triggers an unrelated lockfile policy failure for @profullstack/autoblog@0.4.0 missing tarball integrity, so I ran the local Vitest and TypeScript binaries directly.