Skip to content

change(rest-api): Align REST API with new VpcPrefix lifecycle#2272

Draft
bcavnvidia wants to merge 1 commit into
NVIDIA:mainfrom
bcavnvidia:rest-vpc-prefix
Draft

change(rest-api): Align REST API with new VpcPrefix lifecycle#2272
bcavnvidia wants to merge 1 commit into
NVIDIA:mainfrom
bcavnvidia:rest-vpc-prefix

Conversation

@bcavnvidia
Copy link
Copy Markdown
Contributor

Description

VpcPrefix in the Rust back-end now has a full lifecycle. The REST API still only expects Ready/Deleting. This PR aligns the two, which mostly means a Provisioning state.

Type of Change

  • Add - New feature or capability
  • Change - Changes in existing functionality
  • Fix - Bug fixes
  • Remove - Removed features or deprecated functionality
  • Internal - Internal changes (refactoring, tests, docs, etc.)

Related Issues (Optional)

Breaking Changes

  • This PR contains breaking changes

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • No testing required (docs, internal refactor, etc.)

Additional Notes

@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented Jun 5, 2026

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 5, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 6a5f27c4-dfd9-42a9-8211-19e17158bc41

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
rest-api/openapi/spec.yaml (1)

14351-14358: ⚡ Quick win

Consider enhancing state documentation for API consumers.

The enum values are correct, but the generic description "Status values for VPC Prefix objects" could be more informative. Production APIs benefit from explicit state semantics to reduce integration friction.

Consider documenting:

  • What each state represents (e.g., "Provisioning: Initial state during prefix allocation")
  • Valid state transitions (e.g., "Provisioning → Ready → Deleting → Deleted")
  • Any terminal states (Error, Deleted)

This helps API consumers understand the lifecycle without consulting additional documentation.

📝 Enhanced documentation example
     VpcPrefixStatus:
       title: VpcPrefixStatus
       type: string
-      description: Status values for VPC Prefix objects
+      description: |
+        Status of VPC Prefix lifecycle:
+        - Provisioning: Prefix is being allocated
+        - Ready: Prefix is active and available
+        - Deleting: Prefix deletion in progress
+        - Deleted: Prefix has been removed
+        - Error: Prefix encountered an error during lifecycle operation
       enum:
         - Provisioning
         - Ready
         - Deleting
         - Deleted
         - Error
🤖 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 `@rest-api/workflow/pkg/activity/vpcprefix/vpcprefix.go`:
- Around line 121-123: The current guard in vpcprefix.go that checks "if
vpcPrefix.Status == cdbm.VpcPrefixStatusDeleting && status !=
cdbm.VpcPrefixStatusDeleting { continue }" prevents persisting a transition from
Deleting to Deleted; change the condition to allow the terminal transition by
only skipping updates when the existing status is Deleting and the new status is
neither Deleting nor Deleted (i.e., also check cdbm.VpcPrefixStatusDeleted), so
the Deleting->Deleted transition is permitted; update the condition that
references vpcPrefix.Status and the local variable status accordingly.
🪄 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: 74b06d0f-f73a-449a-beb7-b7e8b1b37102

📥 Commits

Reviewing files that changed from the base of the PR and between 4488ebc and 45e0630.

⛔ Files ignored due to path filters (3)
  • rest-api/workflow-schema/schema/site-agent/workflows/v1/nico_nico.pb.go is excluded by !**/*.pb.go, !rest-api/**/*.pb.go
  • rest-api/workflow-schema/schema/site-agent/workflows/v1/nico_nico_grpc.pb.go is excluded by !**/*.pb.go, !rest-api/**/*.pb.go
  • rest-api/workflow-schema/site-agent/workflows/v1/nico_nico.proto is excluded by !rest-api/workflow-schema/site-agent/workflows/v1/*_nico.proto
📒 Files selected for processing (14)
  • rest-api/api/pkg/api/handler/vpcprefix.go
  • rest-api/api/pkg/api/handler/vpcprefix_test.go
  • rest-api/db/pkg/db/model/vpcprefix.go
  • rest-api/docs/index.html
  • rest-api/openapi/spec.yaml
  • rest-api/sdk/standard/model_interface.go
  • rest-api/sdk/standard/model_interface_create_request.go
  • rest-api/sdk/standard/model_tenant_identity_config_create_or_update_request.go
  • rest-api/sdk/standard/model_vpc_prefix_status.go
  • rest-api/site-workflow/pkg/activity/vpcprefix.go
  • rest-api/site-workflow/pkg/activity/vpcprefix_test.go
  • rest-api/site-workflow/pkg/grpc/client/testing.go
  • rest-api/workflow/pkg/activity/vpcprefix/vpcprefix.go
  • rest-api/workflow/pkg/activity/vpcprefix/vpcprefix_test.go
💤 Files with no reviewable changes (1)
  • rest-api/sdk/standard/model_tenant_identity_config_create_or_update_request.go

Comment on lines +121 to +123
if vpcPrefix.Status == cdbm.VpcPrefixStatusDeleting && status != cdbm.VpcPrefixStatusDeleting {
continue
}
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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Allow Deleting -> Deleted transition instead of skipping all non-deleting updates.

This guard prevents updating a prefix from Deleting to Deleted, so terminal lifecycle state cannot be persisted for already-deleting records.

💡 Proposed fix
-		if vpcPrefix.Status == cdbm.VpcPrefixStatusDeleting && status != cdbm.VpcPrefixStatusDeleting {
+		if vpcPrefix.Status == cdbm.VpcPrefixStatusDeleting &&
+			status != cdbm.VpcPrefixStatusDeleting &&
+			status != cdbm.VpcPrefixStatusDeleted {
 			continue
 		}
🤖 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/workflow/pkg/activity/vpcprefix/vpcprefix.go` around lines 121 -
123, The current guard in vpcprefix.go that checks "if vpcPrefix.Status ==
cdbm.VpcPrefixStatusDeleting && status != cdbm.VpcPrefixStatusDeleting {
continue }" prevents persisting a transition from Deleting to Deleted; change
the condition to allow the terminal transition by only skipping updates when the
existing status is Deleting and the new status is neither Deleting nor Deleted
(i.e., also check cdbm.VpcPrefixStatusDeleted), so the Deleting->Deleted
transition is permitted; update the condition that references vpcPrefix.Status
and the local variable status accordingly.

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.

1 participant