๐ Don't try to resolve machine on delete if cluster not ready #2006
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 ยท 201 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.318
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #2006"
general
weight: 0.35
dulek
This fixes a bug where if we created a machine for a cluster which never became ready, we would never be able to 'resolve' the machine and therefore never delete it. We address this situation in several layers:
Firstly, we move the point in the machine controller at which we add the finalizer in the first place. We don't add the finalizer until we're writing resolved, so this situation can never occur for newly created machines. This makes sense because we don't create resources until we've observed that both the finalizer has been added and resolved is up to date, so we don't need the finalizer to protect resources which can't have been created yet.
Secondly, we shortcut the delete flow if the cluster is not ready. This is safe for the same reason as above, but is only relevant to machines created before v0.10.
Lastly we surface and restrict the circumstances in which 'Resolved' is required on delete anyway. On closer inspection, this is only required in the very specific circumstance that the machine has volumes defined, and we are deleting it without the machine having been created. To make this more obvious we split volume deletion out of DeleteInstance and only resolve the machine spec in the event that it's required.
2 other factors make this change larger than it might otherwise be.
We hit a cyclomatic complexity limit in reconcileDelete(), requiring a refactor.
We remove the DeleteInstance tests which, after separating out DeleteVolumes, are quite trivial, and replace them with much more comprehensive set of tests for reconcileDelete.
Fixes #1792
/hold