← Back to Pull requests

Stabilize two-child depset folds across interner clears #32585

Open
dzbarsky opened this pull request with 80 lines diff across 3 files
View on GitHub
dzbarsky dzbarsky commented on Nov 11, 2026 03:29 UTC
Author

NestedSetBuilder can give an unchanged action a different key after NestedSetInterner.clear(). Two backing arrays can contain the same immediate child references even when the arrays themselves differ. Compare child references for identity-interned arrays so the two-child fold is stable across commands.

The regression restarts Bazel, preloads one depset with cquery, and checks that aquery reports the same action key and the next build hits the persistent action cache.

The pair comparison stays in buildInternal. addTransitiveImpl can record transitive sets without resolving their deserialization futures. Comparing child arrays there would resolve futures before the caller selects the build's interrupt strategy, and applying it to larger collections would add child-array scans beyond the pair this regression requires.

Diff: 80 lines (+78 / -2) across 3 files Reviewer: justinhorvitz Review duration: 34122m
All Vouch review confidence checks passed
Residual risk 0.05 = Change Risk (0.32) × (1 − Review Confidence (0.85)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.32 · 80 lines diff across 3 files
0.32
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.89 · 3 substantive comment(s)
0.89
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
85%
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.263
Real PR Conversation Timeline
4 items
fmeum fmeum commented on Nov 11, 2026 10:42 UTC
Contributor

@bazel-io fork 10.0.0

fmeum fmeum commented on Nov 11, 2026 10:42 UTC
Contributor

@bazel-io fork 9.4.0

justinhorvitz justinhorvitz commented on code on Nov 12, 2026 20:25 UTC
Code Review
src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSetBuilder.java:1
@@ -252,7 +251,7 @@ && isTransitiveEmpty()) {
       Object c0 = s0.getChildrenInternal(interruptStrategy);
       Object c1 = s1.getChildrenInternal(interruptStrategy);
       if (c0 instanceof Object[] a0 && c1 instanceof Object[] a1) {
-        if (a0 == a1) {
+        if (NestedSetInterner.haveIdenticalChildren(a0, a1)) {

Would it be better to handle this deduplication in addTransitiveImpl instead of just for the 2 child case, or is that too expensive?

Reviewers
Assignees
dzbarsky dzbarsky
Labels
risk: low confidence: 85.4% 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: 32.2% (LOW) · Higher = larger blast radius
32.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: 85.4% · Lower = rushed or shallow review
85.4%
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: 4.7% · Safe to merge
4.7%