don't emit unsafe code in filter_fn's execute() #767
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.32) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.32 · 129 lines diff across 1 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.291
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #767"
general
weight: 0.35
GuillaumeGomez
The
execute()method generated by#[askama::filter_fn]takes the required arguments out of theirOptionfields withunwrap_unchecked(), trusting the const generic flags to match the fields, but only field privacy keeps the two in sync, so a struct literal in the filter's own module can build atrueflagged builder with aNonefield and reach UB without writingunsafe(a debug build aborts on theunreachable_uncheckedprecondition check), and the optional arguments are moved out inside anunsafe {}block that does nothing. This switches to a plainunwrap()and drops the empty block, so the generated code no longer containsunsafewhile still compiling to the same thing, because the setters andexecute()are#[inline(always)]and the check folds away. Worth checking during review: a release build of adefault().with_x(..).execute(..)chain has neither the branch nor theOption::unwrap()panic message in it, and theaskama_deriveunit tests plus the filter tests intestingpass unchanged.