← Back to Pull requests

Fix flaky min-scale assertions #16745

Closed
unknown closed this pull request without merging on Nov 06, 2026 22:03 UTC
View on GitHub
unknown unknown commented on Nov 06, 2026 02:38 UTC
Author

The min-scale tests count ready endpoints, but KPA counts ready pods. A revision can become Ready before EndpointSlices catch up, causing TestMinScaleTransition to fail before the transition starts.

Use the deployment's ready replica count in both scale helpers instead. Endpoints originally matched KPA's implementation (#6783), but KPA switched to counting pods in #8616.

Reproduce

On a kind cluster with Serving, ingress and the test images installed:

1. Add --endpointslice-updates-batch-period=5s to kube-controller-manager's arguments in /etc/kubernetes/manifests/kube-controller-manager.yaml inside the control-plane node. Kubelet will restart it.

This batches pod-triggered EndpointSlice updates for up to 5 seconds. Pods can become ready and KPA can mark the revision Ready while the service's endpoints are still catching up. The delay widens this existing race so it reproduces reliably on kind; it doesn't change pod readiness or autoscaler logic.
2. Run:

   go test -v -tags=e2e -count=3 ./test/e2e \
     -run '^TestMinScaleTransition$'
   

Use the cluster's usual kubeconfig, ingress and test image tag flags.

This widens the gap between pod readiness and endpoint publication. Before this change, all three runs failed with endpoint counts of 0, 0 and 3 instead of 4.

With the same delay, TestMinScaleTransition, TestMinScale and TestMinScaleAnnotationChange all passed with this change. Validated on kind/Kubernetes 1.34 with the minimum-version guard overridden.

``release-note
NONE
``

Diff: 193 lines (+144 / -49) across 2 files Reviewer: dsimansk Review duration: 1164m
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.36) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 193 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%
56%
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.315
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #16745"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 56.8% 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.0% (MEDIUM) · Higher = larger blast radius
36.0%
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: 56.8% · Lower = rushed or shallow review
56.8%
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: 15.6% · Safe to merge
15.6%