feat: add per-function vcpu parameter#645
Conversation
✅ Deploy Preview for open-api ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis PR adds optional vCPU configuration support to function deployments. The Swagger schema introduces a new Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
swagger.yml (1)
5558-5581:⚠️ Potential issue | 🔴 CriticalAdd cross-field validation for memory/vcpu mutual exclusivity in FunctionConfig.
The schema documents that
memoryandvcpuare mutually exclusive, but the currentFunctionConfig.Validate()method does not enforce this constraint. The codebase has an established pattern for this (ValidateCrossFieldConstraints()indatabase_compute_settings_request_validate.go). Implement similar validation forFunctionConfigto ensure the server rejects payloads where both fields are set.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@swagger.yml` around lines 5558 - 5581, FunctionConfig.Validate() doesn't enforce the documented mutual exclusivity of memory and vcpu; add a cross-field check similar to ValidateCrossFieldConstraints() in database_compute_settings_request_validate.go that returns an error when both FunctionConfig.memory and FunctionConfig.vcpu are non-nil/set. Update FunctionConfig.Validate() to call the new check (or inline the same logic), ensure the returned error matches existing validation error types/format used elsewhere, and reference FunctionConfig, ValidateCrossFieldConstraints, and FunctionConfig.Validate in your change so reviewers can find the logic easily.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@swagger.yml`:
- Around line 5576-5581: The OpenAPI schema for the vcpu property currently only
documents "0.5–2" in the description; add schema-level numeric constraints to
enforce this by adding minimum: 0.5 and maximum: 2 (keep type: number and
format: float) on the vcpu property so clients and generators can validate the
allowed range for the vcpu field.
---
Outside diff comments:
In `@swagger.yml`:
- Around line 5558-5581: FunctionConfig.Validate() doesn't enforce the
documented mutual exclusivity of memory and vcpu; add a cross-field check
similar to ValidateCrossFieldConstraints() in
database_compute_settings_request_validate.go that returns an error when both
FunctionConfig.memory and FunctionConfig.vcpu are non-nil/set. Update
FunctionConfig.Validate() to call the new check (or inline the same logic),
ensure the returned error matches existing validation error types/format used
elsewhere, and reference FunctionConfig, ValidateCrossFieldConstraints, and
FunctionConfig.Validate in your change so reviewers can find the logic easily.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1542f82e-0337-4b88-ada3-f975e3b90263
📒 Files selected for processing (4)
go/models/function_config.gogo/porcelain/deploy.gogo/porcelain/functions_manifest.goswagger.yml
| vcpu: | ||
| type: number | ||
| format: float | ||
| description: | | ||
| Number of vCPUs to provision for the function. Allowed range is | ||
| 0.5–2. |
There was a problem hiding this comment.
Add schema-level constraints for the vCPU range.
The vcpu field documents an allowed range of 0.5–2 in the description, but the schema lacks minimum and maximum constraints. Adding these constraints will enable client validation, improve generated documentation, and provide clearer API contract enforcement.
📋 Proposed fix to add range constraints
vcpu:
type: number
format: float
+ minimum: 0.5
+ maximum: 2
description: |
Number of vCPUs to provision for the function. Allowed range is
0.5–2.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| vcpu: | |
| type: number | |
| format: float | |
| description: | | |
| Number of vCPUs to provision for the function. Allowed range is | |
| 0.5–2. | |
| vcpu: | |
| type: number | |
| format: float | |
| minimum: 0.5 | |
| maximum: 2 | |
| description: | | |
| Number of vCPUs to provision for the function. Allowed range is | |
| 0.5–2. |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@swagger.yml` around lines 5576 - 5581, The OpenAPI schema for the vcpu
property currently only documents "0.5–2" in the description; add schema-level
numeric constraints to enforce this by adding minimum: 0.5 and maximum: 2 (keep
type: number and format: float) on the vcpu property so clients and generators
can validate the allowed range for the vcpu field.
🤖 I have created a release *beep* *boop* --- ## [2.55.0](v2.54.0...v2.55.0) (2026-05-19) ### Features * add per-function `memory` parameter ([#643](#643)) ([1764a43](1764a43)) * add per-function `vcpu` parameter ([#645](#645)) ([e55927e](e55927e)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: token-generator-app[bot] <82042599+token-generator-app[bot]@users.noreply.github.com> Co-authored-by: token-generator-app[bot] <token-generator-app[bot]@users.noreply.github.com>
No description provided.