Make `when` a curried guard: `when(pred)(sink)` #12462
All Vouch review confidence checks passed
Residual risk 0.15 = 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 · 181 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.311
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #12462"
general
weight: 0.35
caugonnet
Description
whenwas the one selector inexception_policy.cuhthat took its sink as a second argument,when(pred, sink). Every other selector applies to a sink:if_isa<E>(s),if_monomorphic<E>(s),if_equal(v...)(s),thrown(s),returned(s). This PR giveswhenthe same shape,when(pred)(sink), and removes the two-argument form.whenis now the guard class template itself.when(pred)deduces the predicate type by CTAD and is a sink in its own right; applying it to a sink yieldswhen(pred) & sink, exactly what the two-argument function returned. The formerwhen_ttype and the free function are gone, so there is one entity instead of two. A guard can be named and applied to several sinks:Semantics are unchanged. The predicate is stored by value, where the old forwarding-reference deduction held an lvalue predicate by reference. The predicate still takes either nothing or the
const std::exception*of the failure in flight.whenhas no callers outside the header's own unit tests, so the change is confined toexception_policy.cuh. All test call sites are converted and a new test covers a named guard applied to two arms.Checklist
🤖 Generated with Claude Code