Fix flaky TensorKit permute! integration test (destination aliased source) #3839
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.40) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 176 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 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
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.310
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #3839"
general
weight: 0.35
kshyatt
<!-- claude-projects-attribution: {"github_login":"vchuravy"} -->
_Requested by Valentin · project thread_
Before: the TensorKit integration test occasionally fails in
Trivial (ComplexF64) … permute(e.g. this run on #3833), with "active derivative for argument 4 should agree with finite differences" and "The rule must mutate argument 2 the same way as the function".After: the destination
Cis always a fresh array, so the test no longer depends on which random permutation it draws.How:
pcomes fromrandindextuple, and forTrivialsectors TensorKit 0.17.2'spermute(A, p)returns a tensor sharingA.datawheneverpkeeps the memory order (has_shared_permute), herep = ((1,2,3,4,5), ()).CandAthen alias, sopermute!(C, A, p, α, β)reads and writes the same buffer and finite differences disagree with Enzyme. Passingcopy = truebreaks the aliasing. This is a test bug, not an Enzyme bug, and unrelated to the CEnum compat bump in #3833.🤖 Generated with Claude Code
https://claude.ai/code/session_017NF6irsuJkwyjGc6vG2DQH
---
_Generated by Claude Code_