← Back to Pull requests

reinterpretarray: fix offset indexing in pass-through wrappers #63418

Closed
unknown closed this pull request without merging on Sep 29, 2026 21:32 UTC
View on GitHub
unknown unknown commented on Sep 27, 2026 14:20 UTC
Author

Claude:

---

Wrappers such as OffsetArray around a reshaped reinterpret pass indexing through with IndexSCartesian2. Its fallback methods treated SCartesianIndex2.j, a linear index of the innermost parent, as a 1-based position. With an offset parent, reductions read the wrong elements and copyto!, which indexes under @inbounds, wrote past the parent:

julia> big = UInt32[0x04030201, 0x08070605, 0x0c0b0a09, 0x100f0e0d, 0xaaaaaaaa, 0xbbbbbbbb];

julia> R = reinterpret(reshape, UInt16, OffsetArray(view(big, 1:4), 2)); O = OffsetArray(R, 0, 0);

julia> sum(O) == sum(R)
false

julia> copyto!(O, zeros(UInt16, 2, 4)); big[5:6]   # outside the view
2-element Vector{UInt32}:
 0x00000000
 0x00000000

The two-dimensional method was also declared for a size ratio of 2 (IndexSCartesian2{2}) rather than for two dimensions, so other ratios reached _ind2sub on a single offset axis and threw, e.g. sum(OffsetArray(reinterpret(reshape, UInt8, UInt32[1, 2, 3]), 0, 10)).

This replaces the fallbacks with one mapping: subtract the iterator's starting index and place the position on the wrapper's trailing axes. The wrong results came in with #58898 (1.13); before that these cases threw. sum over a 10^6-element ratio-2 wrapped array, which used the removed method, takes the same time.

This was found and fixed with Claude Code (Opus 5.5) and reviewed by Codex (gpt-6-astra). The human author has not yet reviewed the change or this text.

Diff: 183 lines (+137 / -46) across 2 files Reviewer: adienes Review duration: 3311m
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.41) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.41 · 183 lines diff across 2 files
0.41
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
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.312
Shallow Review Depth shallow_review_depth
0.289
Ai Authored ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #63418"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% 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: 40.6% (MEDIUM) · Higher = larger blast radius
40.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: 60.5% · Lower = rushed or shallow review
60.5%
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: 16.1% · Safe to merge
16.1%