Fix the finalizer writes on Modules and their plugin Pods #1343
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 · 187 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.313
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1343"
general
weight: 0.35
yevgeny-shnaidman
This is the first of the smaller pieces of #1342, which @TomerNewman asked me to split up. It carries the two finalizer-write fixes the rest of that work rests on, and nothing else.
What goes wrong
metadata.finalizersis a list, and a merge patch sends a list whole.setFinalizerAndStatusandfinalizeModuleboth compute their patch from the Module they were handed, so a write from a read that predates another controller's entry takes that entry off along with its own.deleteFinalizerin the Pod node label reconciler has the same shape when it removesNodeLabelerFinalizerfrom a plugin Pod.Nothing in tree puts a second finalizer on those objects today, which is why this has not been hit. The DRA and device plugin finalizers in #1342 do, and they are the ones that would go.
What this changes
The three writes now carry the resourceVersion they read, so a stale one comes back as a conflict and the next pass starts from a fresh read.
deleteLabelalso reported a Node that had already gone as an error.NodeLabelerFinalizerthen stayed on the Pod for good, and so did anything waiting for that Pod to go. A Node that is not there carries no label, so that reads as done.Testing
Unit tests cover each of the three writes and the missing Node. I checked every one of them by reverting the fix and confirming which spec goes red.
Part of #1331.
---
This PR was written in part with the assistance of generative AI. I have reviewed and tested every change myself.