Skip to content

fix(cloud-runpod): reject non-decimal sizing options#809

Merged
ralyodio merged 1 commit into
profullstack:masterfrom
aiirvizionz:clientkit/runpod-decimal-options
Jul 22, 2026
Merged

fix(cloud-runpod): reject non-decimal sizing options#809
ralyodio merged 1 commit into
profullstack:masterfrom
aiirvizionz:clientkit/runpod-decimal-options

Conversation

@aiirvizionz

Copy link
Copy Markdown
Contributor

Summary

  • reject non-decimal RunPod sizing strings before provisioning
  • prevent surprising Number() inputs like 1e2 and 0x10 for volume, disk, CPU, and memory controls
  • add focused RunPod adapter coverage to ensure invalid values fail before the API call

Verification

  • vitest run packages/cloud/runpod/src/index.test.ts (25 passed)
  • tsc -p packages/cloud/runpod/tsconfig.json --noEmit
  • git diff --check

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.

Copilot AI review requested due to automatic review settings July 21, 2026 22:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens input validation in the RunPod cloud adapter to reject non-plain-decimal sizing strings (e.g., scientific notation and hex) before any provisioning API call, and adds focused unit coverage to prevent regressions.

Changes:

  • Replace Number(...) parsing for sizing fields with a new plainDecimalNumber(...) validator.
  • Reject non-decimal numeric strings (e.g., 1e2, 0x10) for volume/disk/CPU/memory sizing.
  • Add a RunPod adapter test ensuring invalid sizing values fail before fetch is invoked.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/cloud/runpod/src/index.ts Introduces plainDecimalNumber and routes sizing parsing through it to block scientific/hex string inputs.
packages/cloud/runpod/src/index.test.ts Adds a regression test to ensure invalid sizing strings are rejected before provisioning triggers network calls.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +442 to +449
function plainDecimalNumber(value: Numberish, label: string): number {
if (typeof value === 'number') return value;
const text = value.trim();
if (!/^(?:0|[1-9]\d*|0?\.\d+|[1-9]\d*\.\d+)$/.test(text)) {
throw new Error(`RunPod ${label} must be a plain decimal number`);
}
return Number(text);
}
@github-actions

Copy link
Copy Markdown

🤖 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: git fetch upstream master && git rebase upstream/master.

3 similar comments
@github-actions

Copy link
Copy Markdown

🤖 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: git fetch upstream master && git rebase upstream/master.

@github-actions

Copy link
Copy Markdown

🤖 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: git fetch upstream master && git rebase upstream/master.

@github-actions

Copy link
Copy Markdown

🤖 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: git fetch upstream master && git rebase upstream/master.

@ralyodio
ralyodio merged commit e5bb5fb into profullstack:master Jul 22, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants