@@ -1233,18 +1233,23 @@ func (h *TestHarness) CreateAllUnmanagedResources(evaluatedJSON string) ([]Creat
12331233 // Strip Formae metadata tags from the resource properties
12341234 h .stripFormaeTags (res )
12351235
1236- // Strip nested empty collections ({}/[]) that PKL renders for unset
1237- // nullable Listing/Mapping fields. Without this, K8S rejects resources
1238- // with empty probe objects (e.g. livenessProbe: {}).
1239- h . stripNestedEmptyCollections ( res )
1240-
1241- // Resolve any resolvable references using previously created resources
1236+ // Resolve any resolvable references using previously created resources.
1237+ // This must happen BEFORE stripNestedEmptyCollections to match the
1238+ // agent's order of operations (resolver.ConvertToPluginFormat then
1239+ // patch.StripNestedEmptyCollections). The resolvable markers ($ res,
1240+ // $label, etc.) must be intact when the resolver runs; stripping first
1241+ // can corrupt the resolvable objects through the json round-trip.
12421242 resolvedProps , err := h .resolveResolvablesInProperties (res .Properties , createdResources )
12431243 if err != nil {
12441244 return createdResources , fmt .Errorf ("failed to resolve resolvables for %s: %w" , res .Label , err )
12451245 }
12461246 res .Properties = resolvedProps
12471247
1248+ // Strip nested empty collections ({}/[]) that PKL renders for unset
1249+ // nullable Listing/Mapping fields. Without this, K8S rejects resources
1250+ // with empty probe objects (e.g. livenessProbe: {}).
1251+ h .stripNestedEmptyCollections (res )
1252+
12481253 // Create the resource with retry on recoverable errors
12491254 label := fmt .Sprintf ("create %s" , res .Label )
12501255 finalProgress , err := h .retryOnRecoverable (label , func () (* pluginOperationResult , error ) {
0 commit comments