Skip to content

Conversation

@naxty
Copy link
Contributor

@naxty naxty commented Jan 9, 2026

Summary

  • Add early return in updateResourceUpdateFromProgress to skip property updates when progress hasn't finished successfully
  • Add comprehensive test for the intermediate progress self-cannibalization bug

Problem

During create operations with long-running cloud resources, the plugin returns intermediate progress updates with OperationStatusInProgress and empty properties {}. When these empty properties were merged with user properties, arrays containing $ref structures (used for dependency tracking) were being wiped out.

The self-cannibalization bug:

  1. User creates a resource with properties containing $ref structures in arrays (e.g., disks[].source.$ref, networkInterfaces[].network.$ref)
  2. First progress update arrives with InProgress status and empty properties {}
  3. Merge logic uses plugin properties as base, wiping out user's arrays
  4. Second progress update arrives with Success status and full properties
  5. But the $ref structures are already lost - they can never be recovered

Solution

Skip property updates entirely when the progress hasn't finished successfully. The fix adds an early return in resource update.

// Only update properties when the operation has finished successfully.
// Intermediate progress updates may have empty/partial properties which would
// wipe out $ref structures needed for dependency tracking.
if !progress.FinishedSuccessfully() {
    return nil
}

This ensures that:

  • State, NativeID, and timestamps are still updated during intermediate progress
  • Properties are only merged when the operation completes with OperationStatusSuccess
  • $ref structures survive the entire create/update lifecycle

Test scenario:

  1. Create ResourceUpdate with properties containing disks and networkInterfaces arrays with $ref structures
  2. Record intermediate progress (InProgress status) with empty properties {}
  3. Verify arrays and $ref structures are still intact
  4. Record final progress (Success status) with full properties including $ref objects
  5. Verify $ref structures are preserved and $value fields are correctly populated

@naxty naxty requested a review from JeroenSoeters January 12, 2026 17:23
@naxty naxty marked this pull request as ready for review January 12, 2026 17:23
@naxty naxty enabled auto-merge (squash) January 12, 2026 17:23
@naxty naxty changed the title PR: Fix $ref structure preservation during intermediate progress updates fix: $ref structure preservation during intermediate progress updates Jan 14, 2026
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.

2 participants