← Back to Pull requests

Fix dask array attributes being computed on equivalence check #11845

Open
unknown opened this pull request with 279 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 03, 2026 03:24 UTC
Author

Description

See #11841 for more details. This is my first attempt at trying to resolve that issue, but it seems to be opening a can of worms. Since #10838 dask-backed objects have been getting computed in any equivalent check. While using Claude to create this PR it was shown to go further than I thought and doing DataArray.identical on a deep-copy of that same DataArray raises an exception (ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()).

This PR at the current time of writing is the simplest version of the fix I could come up with. However, it may not be the best solution. I didn't like the is_chunked_array needing a typing ignore comment so started working towards a more strict split between scalar and array-like comparisons but it brought up some questions that I don't think I should be the one to answer:

1. When an array is compared with a non-"pure" array like a DataArray or pd.Index, should they be compared by value like they are today and which computes lazy arrays? Or should they be considered not equal.
2. Should eager non-numpy duck arrays be compared by value? Today they aren't equal.
3. Should the rule I've been going by that two lazy arrays should not be computed and are only equal if their tokens are equal be the rule? Or are their exceptions?

The biggest complication seems to be things of different types, especially arrays and non-pure arrays, as you can easily end up computing lazy arrays.

Checklist

<!-- Feel free to remove check-list items aren't relevant to your change -->

  • Closes #11841

  • Tests added

  • User visible changes (including notable bug fixes) are documented in whats-new.rst
  • AI Disclosure

    <!--- Please review our AI & contribution guidelines: https://docs.xarray.dev/en/stable/contribute/ai-policy.html. Remove this section if your PR does not contain AI-generated content. --->

  • This PR contains AI-generated content.

  • - [x] I have tested any AI-generated content in my PR.
    - [x] I take responsibility for any AI-generated content in my PR.
    <!--- If you used AI to generate code, please specify the tool used and the prompt below. --->
    Tools: Claude (Opus)

    Diff: 279 lines (+209 / -70) across 3 files Reviewer: djhoese Review duration: 28348m
    All Vouch review confidence checks passed
    Residual risk 0.25 = Change Risk (0.45) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 279 lines diff across 3 files
    0.45
    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%
    42%
    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.337
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #11845"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 43.0% 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: 44.6% (MEDIUM) · Higher = larger blast radius
    44.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: 43.0% · Lower = rushed or shallow review
    43.0%
    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: 25.5% · Safe to merge
    25.5%
    Repository