chore(rest-api): Infer operating system isCloudInit from userData#3102
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (11)
💤 Files with no reviewable changes (2)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (6)
Summary by CodeRabbit
WalkthroughThis PR removes persisted ChangesIsCloudInit derivation and removal
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
🔍 Container Scan Summary
Per-CVE detail lives in the per-service |
|
🌿 Preview your docs: https://nvidia-preview-pull-request-3102.docs.buildwithfern.com/infra-controller |
🔐 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-07-02 18:50:05 UTC | Commit: 27ab053 |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
rest-api/api/pkg/api/handler/operatingsystem_test.go (1)
1170-1477: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick winCompile break:
IsCloudInitfield no longer exists oncdbm.OperatingSystemCreateInput.Thirteen
osDAO.Create(...)calls in this test (os1 through os13, e.g. lines 1180, 1201, 1222, 1243, 1264, 1298, 1320, 1342, 1363, 1397, 1420, 1443, 1469) still setIsCloudInit: trueoncdbm.OperatingSystemCreateInput. Per this PR's DB model changes (rest-api/db/pkg/db/model/operatingsystem.go), that field has been removed fromOperatingSystemCreateInput. This test file will fail to compile as-is. The siblingdb/pkg/db/model/operatingsystem_test.goin this same PR was correctly updated to drop the field — this file was missed.🛠️ Proposed fix (apply to all 13 occurrences)
cdbm.OperatingSystemCreateInput{ Name: "test-operating-system-1", Description: cutil.GetPtr("Test Description 1"), Org: ipOrg1, TenantID: &tenant1.ID, OsType: cdbm.OperatingSystemTypeIPXE, IpxeScript: cutil.GetPtr("ipxe"), - IsCloudInit: true, AllowOverride: false, EnableBlockStorage: false, PhoneHomeEnabled: false, Status: cdbm.OperatingSystemStatusPending, CreatedBy: user.ID, },🤖 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 `@rest-api/api/pkg/api/handler/operatingsystem_test.go` around lines 1170 - 1477, The `osDAO.Create` setup in `operatingsystem_test.go` still uses the removed `cdbm.OperatingSystemCreateInput.IsCloudInit` field, causing a compile break. Update every `os1` through `os13` test fixture to stop populating `IsCloudInit` in the `OperatingSystemCreateInput` literals, matching the already-updated `operatingsystem_test.go` in the db model package. Keep the rest of each `osDAO.Create` call unchanged so the test data continues to cover the same scenarios.
🤖 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.
Outside diff comments:
In `@rest-api/api/pkg/api/handler/operatingsystem_test.go`:
- Around line 1170-1477: The `osDAO.Create` setup in `operatingsystem_test.go`
still uses the removed `cdbm.OperatingSystemCreateInput.IsCloudInit` field,
causing a compile break. Update every `os1` through `os13` test fixture to stop
populating `IsCloudInit` in the `OperatingSystemCreateInput` literals, matching
the already-updated `operatingsystem_test.go` in the db model package. Keep the
rest of each `osDAO.Create` call unchanged so the test data continues to cover
the same scenarios.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: b4d353bf-f96e-4da6-8853-bd18e41f4b41
📒 Files selected for processing (11)
rest-api/api/pkg/api/handler/operatingsystem.gorest-api/api/pkg/api/handler/operatingsystem_test.gorest-api/api/pkg/api/model/operatingsystem.gorest-api/api/pkg/api/model/operatingsystem_test.gorest-api/cli/tui/commands.gorest-api/db/pkg/db/model/operatingsystem.gorest-api/db/pkg/db/model/operatingsystem_test.gorest-api/db/pkg/migrations/20260702120000_drop_operating_system_is_cloud_init.gorest-api/docs/index.htmlrest-api/openapi/deprecations.mdrest-api/openapi/spec.yaml
💤 Files with no reviewable changes (2)
- rest-api/cli/tui/commands.go
- rest-api/api/pkg/api/handler/operatingsystem.go
27ab053 to
43bc142
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
rest-api/api/pkg/api/handler/operatingsystem_test.go (1)
1995-2012: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winStray
IsCloudInit: trueleft inos6fixture.Every other
OperatingSystemCreateInputliteral in this file (lines 439-466, 507-541, 887-930, 1170-1450, delete-test fixtures) hadIsCloudInit: truestripped, but this one at Line 2005 was missed. Since the dependent DB-model layer removesIsCloudInitfromOperatingSystemCreateInputentirely, this leftover field reference will fail to compile once that change lands.🔧 Proposed fix
os6, err := osDAO.Create( ctx, nil, cdbm.OperatingSystemCreateInput{ Name: "test-operating-system-6", Description: cutil.GetPtr("Test Description 6"), Org: tnOrg3, TenantID: &tenant3.ID, OsType: cdbm.OperatingSystemTypeImage, ImageURL: cutil.GetPtr("https://oldimagepath.iso"), - IsCloudInit: true, AllowOverride: false, EnableBlockStorage: true, PhoneHomeEnabled: false, Status: cdbm.OperatingSystemStatusReady, CreatedBy: tnu.ID, }, )🤖 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 `@rest-api/api/pkg/api/handler/operatingsystem_test.go` around lines 1995 - 2012, Remove the leftover IsCloudInit field from the os6 OperatingSystemCreateInput fixture in operatingsystem_test.go, since OperatingSystemCreateInput no longer includes that property. Update the os6 setup in the Create call to match the other fixtures in this file and ensure the test compiles against the current cdbm.OperatingSystemCreateInput definition.
🤖 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.
Outside diff comments:
In `@rest-api/api/pkg/api/handler/operatingsystem_test.go`:
- Around line 1995-2012: Remove the leftover IsCloudInit field from the os6
OperatingSystemCreateInput fixture in operatingsystem_test.go, since
OperatingSystemCreateInput no longer includes that property. Update the os6
setup in the Create call to match the other fixtures in this file and ensure the
test compiles against the current cdbm.OperatingSystemCreateInput definition.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 46caed31-0bf8-4a41-b2b0-1f5ffe8df5f2
📒 Files selected for processing (11)
rest-api/api/pkg/api/handler/operatingsystem.gorest-api/api/pkg/api/handler/operatingsystem_test.gorest-api/api/pkg/api/model/operatingsystem.gorest-api/api/pkg/api/model/operatingsystem_test.gorest-api/cli/tui/commands.gorest-api/db/pkg/db/model/operatingsystem.gorest-api/db/pkg/db/model/operatingsystem_test.gorest-api/db/pkg/migrations/20260702120000_drop_operating_system_is_cloud_init.gorest-api/docs/index.htmlrest-api/openapi/deprecations.mdrest-api/openapi/spec.yaml
💤 Files with no reviewable changes (2)
- rest-api/cli/tui/commands.go
- rest-api/api/pkg/api/handler/operatingsystem.go
✅ Files skipped from review due to trivial changes (1)
- rest-api/openapi/deprecations.md
🚧 Files skipped from review as they are similar to previous changes (6)
- rest-api/db/pkg/migrations/20260702120000_drop_operating_system_is_cloud_init.go
- rest-api/api/pkg/api/model/operatingsystem.go
- rest-api/openapi/spec.yaml
- rest-api/db/pkg/db/model/operatingsystem.go
- rest-api/api/pkg/api/model/operatingsystem_test.go
- rest-api/db/pkg/db/model/operatingsystem_test.go
43bc142 to
b79de0e
Compare
Historically we have ignored whatever value users have specified for
isCloudIniton an operating system in favor of checking whether there is cloud-init user data to drive OS behavior. This PR formally deprecates the field on the REST API calls to create or update an operating system and removes the database field. We still however will return the value as part of API response, but it will be simply a derived value that reflects system behavior rather than the value of an unused database column.Related issues
#3087
Type of Change
Breaking Changes
Testing
Additional Notes