feat[next]: Tracer support part 1: tree_map #2586
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.35) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.35 · 163 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.305
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #2586"
general
weight: 0.35
SF-N
As a first step towards tracer support (enabling vector operations), this PR adds the infrastructure for mapping a function over the elements of a tuple.
What this PR does
New ITIR builtins (
iterator/builtins.py), each taking a single tuple argument:tree_map_tuple(f)(t)— recursively mapsfover the (possibly nested) tuple structure oft, applying it at the leaves.map_tuple(f)(t)— mapsfover the top-level elements oftonly (no recursion).New pass
ExpandTupleMaps(iterator/transforms/expand_tuple_maps.py) — expands both builtins intomake_tuple/tuple_getcalls. It runs early in bothapply_common_transformsandapply_fieldview_transforms(iterator/transforms/pass_manager.py).Type synthesizers for the new builtins (
iterator/type_system/type_synthesizer.py).Rename
map_→map_listacross the codebase, to disambiguate list/neighbor mapping from the new tuple-mapping operators.Not yet included
The frontend lowering (
ffront/foast_to_gtir.py) does not emit these builtins yet —where/ casts still expand tuples statically viaprocess_elements(see the TODOs there). This PR only lands the builtins, type inference, and expanding infrastructure that subsequent tracer-support steps will build on.