Fix ComposerEnvironment reconciliation loop failure with 400 error #8484
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 190 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.314
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #8484"
general
weight: 0.35
himanigulati01
Description
This PR fixes a reconciliation loop for ComposerEnvironment that causes a the error:- 400: update_mask path not valid error.
The Cloud Composer API assigns certain internal, immutable fields (like composerInternalIpv4CidrBlock and composerNetworkAttachment) upon resource update/reconciliation. Previously, the composer controller used a check for the NodeConfig object. If a user specified any field inside NodeConfig (like a network reference), KCC would skip copying these server-assigned fields from the actual GCP state. This led to a
false drift detection where KCC incorrectly included these immutable fields in the updateMask, resulting in API rejection.
### Changes
Updated pkg/controller/direct/composer/environment_controller.go to implement granular merging for NodeConfig. It now explicitly preserves server-assigned fields from the actual state if
they are missing from the manifest.
Updated mockgcp/mockcomposer/environment.go to simulate the behavior of the real Composer API assigning internal IPs and network attachments.
Added a new permanent test fixture composerenvironmentnodeconfig that mimics the user's reported configuration to verify the fix and prevent regressions.
### Tests
Local reproduced and confirmed the 400 error occurs in MockGCP without the fix.
* Verified that with the fix, the reproducebug (now composerenvironmentnodeconfig) fixture reconciles successfully to a Ready state.
Internal bugID: b/514547354