← Back to Pull requests

[ty] Keep tuple inference off the stack for other expressions #31427

Merged
MichaReiser merged 1 files (2 lines) on Dec 04, 2026 20:31 UTC
View on GitHub
MichaReiser MichaReiser commented on Dec 04, 2026 10:36 UTC
Author

Summary

Tuple inference can build a speculative TypeInferenceBuilder for each member of an expected union. When LLVM inlines this code into infer_value_expression_impl, every expression reserves that space, including each operand in a + b + c.

This PR keeps infer_tuple_expression out of line. In a Linux x86-64 profiling build, the dispatcher shrinks from 2,064 to 384 bytes and the total stack per addition falls from 4,656 to 2,976 bytes. This complements the on-demand stack growth in #29077.

The semantic unit tests and mdtests pass, and ty now checks a chain of 2,200 method calls that previously overflowed the worker stack.

Diff: 2 lines (+2 / -0) across 1 files Reviewer: carljm Review duration: 595m
All Vouch review confidence checks passed
Residual risk 0.02 = Change Risk (0.10) × (1 − Review Confidence (0.89)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.10 · 2 lines diff across 1 files
0.10
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%
89%
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.066
Real PR Conversation Timeline
5 items
astral-automations-bot[bot] astral-automations-bot[bot] commented on Dec 04, 2026 10:38 UTC
Bot

<!-- generated-comment typing-conformance -->
<!-- report-run:47317509834:1 -->

Typing conformance results

No changes detected ✅

<details>
<summary>Current numbers</summary>

<br>
The percentage of diagnostics emitted that were expected errors held steady at <b>98.60%</b>. The percentage of expected errors that received a diagnostic held steady at <b>98.86%</b>. The number of fully passing files held steady at <b>137/146</b>.

</details>

---

Results for 55cb776 · Workflow run

astral-automations-bot[bot] astral-automations-bot[bot] commented on Dec 04, 2026 10:41 UTC
Bot

<!-- generated-comment memory -->
<!-- report-run:47317509520:1 -->

Memory usage report

Memory usage unchanged ✅

---

Results for 55cb776 · Workflow run

astral-automations-bot[bot] astral-automations-bot[bot] commented on Dec 04, 2026 10:41 UTC
Bot

<!-- generated-comment ty-ecosystem -->
<!-- report-run:47317509744:1 -->

ecosystem-analyzer results

No diagnostic changes detected ✅

Full report with detailed diff · Timing results

---

Results for 55cb776 · Workflow run

carljm carljm approved these changes on Dec 04, 2026 19:48 UTC
Approved Reviewer

Nice find, thank you.

Reviewers
Assignees
MichaReiser MichaReiser
Labels
risk: low confidence: 89.1% 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: 9.6% (LOW) · Higher = larger blast radius
9.6%
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: 89.1% · Lower = rushed or shallow review
89.1%
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: 2% · Safe to merge
2%
Repository