โ† Back to Pull requests

๐Ÿ› Don't try to resolve machine on delete if cluster not ready #2006

Closed
unknown closed this pull request without merging on Apr 11, 2024 12:39 UTC
View on GitHub
unknown unknown commented on Apr 09, 2024 14:27 UTC
Author

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

Diff: 201 lines (+150 / -51) across 2 files Reviewer: dulek Review duration: 2771m
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
0.36
Model 2 ยท Review Depth (DistilBERT)
Depth Score: 0.17 ยท 1 substantive comment(s)
0.17
Model 3 ยท Review Timing & Attention
Session adequacy: 100% ยท Reviewer familiarity: 35%
60%
Bedrock Claude 3 ยท Risk Narration
(disconnected)
Groq
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
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk ยท Model 1 (XGBoost)
Predicted defect probability (0.00โ€“1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 36.2% (MEDIUM) ยท Higher = larger blast radius
36.2%
Review Confidence
Review Confidence ยท Models 2 & 3
Scrutiny score (0.00โ€“1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% ยท Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk ยท Core Equation
Residual = Change ร— (1 โˆ’ Confidence)
Unmitigated risk surviving review. โ‰ฅ 0.65 triggers an automated re-queue to protect production.
Score: 14.3% ยท Safe to merge
14.3%