fix: require instance type machine capabilities#2949
Conversation
Signed-off-by: Hasan Khan <hasank@nvidia.com>
WalkthroughEnforces ChangesmachineCapabilities Required Validation
Site Explorer metadata API
Observability metric documentation
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Signed-off-by: Hasan Khan <hasank@nvidia.com>
🔐 TruffleHog Secret Scan✅ No secrets or credentials found! Your code has been scanned for 700+ types of secrets and credentials. All clear! 🎉 🕐 Last updated: 2026-06-28 02:09:26 UTC | Commit: a3eb2d0 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@crates/api-core/src/tests/instance_type.rs`:
- Line 158: The test setup is using an invalid value for InstanceTypeId in
create_instance_type, so the request fails during ID parsing before it reaches
the empty desired_capabilities branch. Update the seeded id in the instance_type
tests to a valid InstanceTypeId value and keep the empty capabilities payload to
exercise the intended handler path in create_instance_type and the later
valid-create assertion.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: ae9eda83-6728-4cc1-8216-4d6c1fb75351
⛔ Files ignored due to path filters (2)
rest-api/sdk/standard/model_instance_type.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_instance_type_create_request.gois excluded by!rest-api/sdk/standard/model_*.go
📒 Files selected for processing (6)
crates/api-core/src/handlers/instance_type.rscrates/api-core/src/tests/instance_type.rsrest-api/api/pkg/api/handler/instancetype_test.gorest-api/api/pkg/api/model/instancetype.gorest-api/api/pkg/api/model/instancetype_test.gorest-api/openapi/spec.yaml
Signed-off-by: Hasan Khan <hasank@nvidia.com>
Signed-off-by: Hasan Khan <hasank@nvidia.com>
🔍 Container Scan Summary
Per-CVE detail lives in the per-service |
|
@coderabbitai review |
✅ Action performedReview finished.
|
Description
Require each instance type to declare at least one
machineCapabilitiesentry. This prevents instance types with no provider-supplied capability constraints from being created or updated.This change:
CreateInstanceTypeandUpdateInstanceTyperequests;machineCapabilitieslist when creating an instance type through REST;Related issues
Closes #2350
Type of Change
Breaking Changes
CreateInstanceTypecallers and RESTPOST /v2/org/{org}/nico/instance/typeclients must now provide a non-emptymachineCapabilitieslist. Direct API Core updates must also include desired capabilities; REST partial updates may omit the field but cannot provide an empty list. Generated REST SDK constructors now require capabilities where the OpenAPI contract does.Testing
Passed in GitHub CI:
test-release-container-services, including the database-backed instance-type coverageLint and Test / Test (api), including model and handler coverage for missing and empty capabilitiescore-ci-passandrest-ci-passAdditional Notes
The OpenAPI breaking-change allowlist records the intentional contract changes:
machineCapabilitiesis required and has a minimum of one item for instance-type creation, and an explicitly supplied list on update must also contain at least one item.The REST generated protobuf snapshots on
mainwere already stale for the Site Explorer change from #2591 and the DHCP lease status enum change from #2877. The regeneration commit includes that deterministic baseline; all protobuf-generated files were produced bycargo make --no-workspace generate-rest-core-proto, not edited by hand.The
carbide_site_explorer_last_run_statusrow indocs/observability/core_metrics.mdis emitted by the existing Core metrics-doc generator and predates this behavior change.