← Back to Pull requests

Fix flaky TensorKit permute! integration test (destination aliased source) #3839

Open
unknown opened this pull request with 176 lines diff across 2 files
View on GitHub
unknown unknown commented on Oct 14, 2026 09:40 UTC
Author

<!-- 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 C is always a fresh array, so the test no longer depends on which random permutation it draws.

How: p comes from randindextuple, and for Trivial sectors TensorKit 0.17.2's permute(A, p) returns a tensor sharing A.data whenever p keeps the memory order (has_shared_permute), here p = ((1,2,3,4,5), ()). C and A then alias, so permute!(C, A, p, α, β) reads and writes the same buffer and finite differences disagree with Enzyme. Passing copy = true breaks 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_

Diff: 176 lines (+132 / -44) across 2 files Reviewer: kshyatt Review duration: 19394m
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
0.40
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
46%
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
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
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 46.7% 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.4% (MEDIUM) · Higher = larger blast radius
40.4%
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: 46.7% · Lower = rushed or shallow review
46.7%
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: 21.5% · Safe to merge
21.5%