← Back to Pull requests

GH-55429: [C++] std::invocable in codegen_internal.h fails to compile with CRAN's macOS 11.3 SDK #55457

Merged
thisisnic merged 2 files (33 lines) on Nov 09, 2026 21:07 UTC
View on GitHub
thisisnic thisisnic commented on Nov 09, 2026 15:49 UTC
Author

Rationale for this change

macOS on CRAN is old and doesn't have all the C++20 stuff in it - evidenced by failing CI

What changes are included in this PR?

Refactor code which requires newer stuff that the CRAN stuff doesn't have

Are these changes tested?

Will run CI

Are there any user-facing changes?

Nah

Was AI used for this PR?

Yeah, all generated but I checked it with an adversarial review and will run CI to make sure it actually works

PR code and description written by:

  • Human

  • AI
  • Reviewed before submission by:

  • Human

  • AI

  • Not reviewed
  • GitHub Issue: #55429
  • Diff: 33 lines (+27 / -6) across 2 files Reviewer: pitrou Review duration: 317m
    All Vouch review confidence checks passed
    Residual risk 0.03 = Change Risk (0.26) × (1 − Review Confidence (0.87)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.26 · 33 lines diff across 2 files
    0.26
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.82 · 5 substantive comment(s)
    0.82
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    86%
    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.211
    Real PR Conversation Timeline
    9 items
    thisisnic thisisnic commented on Nov 09, 2026 15:50 UTC
    Author

    @github-actions crossbow submit test-r-macos-as-cran

    github-actions[bot] github-actions[bot] commented on Nov 09, 2026 15:51 UTC
    Bot

    :warning: GitHub issue #55429 has been automatically assigned in GitHub to PR creator.

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Nov 09, 2026 15:51 UTC
    Reviewer

    <!-- ccr-overview-v2 -->

    🟢 Approval recommended

    The review reports no active issues with the macOS SDK compatibility changes.

    No open issues 🎉

    <details>
    <summary><strong>What changed in this PR</strong></summary>

    This PR addresses C++ build compatibility with CRAN’s macOS 11.3 SDK by replacing unavailable standard-library features with older equivalents.

    Changes:

  • Replace std::invocable constraints with std::is_invocable_v in compute kernel generation.

  • Replace std::in_range checks with an integer-capacity trait and add compile-time assertions for representative type pairs.
  • | File | Description |
    | ---- | ----------- |
    | cpp/​src/​parquet/​column_reader.cc | Use numeric limits and signedness to check integer capacity without std::in_range. |
    | cpp/​src/​arrow/​compute/​kernels/​codegen_internal.h | Use std::is_invocable_v and remove the <concepts> include. |
    </details>

    <sub>Review effort: Balanced</sub>

    github-actions[bot] github-actions[bot] commented on Nov 09, 2026 15:55 UTC
    Bot

    Revision: cc05f472c447523ee028eb85299737cdfc1f630f

    Submitted crossbow builds: ursacomputing/crossbow @ actions-fd168d079e

    |Task|Status|
    |----|------|
    |test-r-macos-as-cran|![GitHub Actions](https://github.com/ursacomputing/crossbow/actions/runs/42649383155/job/129271282420)|

    pitrou pitrou commented on code on Nov 09, 2026 15:59 UTC
    Code Review
    cpp/src/parquet/column_reader.cc:1
    @@ -83,10 +83,28 @@ inline void CheckNumberDecoded(int64_t number_decoded, int64_t expected) {
       }
     }
     
    -/// True if a T can hold a U.
    +/// True if an integer type T can hold every value of integer type U.
    +///
    +/// Written in terms of std::numeric_limits rather than std::in_range because
    +/// the libc++ in the macOS 11.3 SDK used by CRAN does not provide the latter.
    +template <typename T, typename U>
    +struct CanHold {
    +  static_assert(std::is_integral_v<T> && std::is_integral_v<U>,
    +                "can_hold_v is only defined for integer types");
    +  static constexpr bool value =
    +      std::numeric_limits<T>::digits >= std::numeric_limits<U>::digits &&
    +      (std::is_signed_v<T> || !std::is_signed_v<U>);
    +};
    +
     template <typename T, typename U>
    -inline constexpr bool can_hold_v = std::in_range<T>(std::numeric_limits<U>::min()) &&
    -                                   std::in_range<T>(std::numeric_limits<U>::max());
    +inline constexpr bool can_hold_v = CanHold<T, U>::value;
    +
    +static_assert(can_hold_v<int64_t, int32_t>);
    +static_assert(can_hold_v<int64_t, uint32_t>);
    +static_assert(can_hold_v<int32_t, int32_t>);
    +static_assert(!can_hold_v<int32_t, int64_t>);
    +static_assert(!can_hold_v<int32_t, uint32_t>);

    The converse should hold true as well?

    static_assert(!can_hold_v<int32_t, uint32_t>);
    static_assert(!can_hold_v<uint32_t, int32_t>);
    

    pitrou pitrou approved these changes on Nov 09, 2026 16:00 UTC
    Approved Reviewer

    Approved these changes.

    thisisnic thisisnic commented on Nov 09, 2026 16:53 UTC
    Author

    CI failures looked unrelated but it's all running again since I accept the changes suggested

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Nov 09, 2026 16:54 UTC
    Reviewer

    <!-- ccr-overview-v2 -->

    🟢 Approval recommended

    No active review issues block the C++ compatibility changes targeting CRAN’s macOS 11.3 SDK.

    No open issues 🎉

    <sub>Review effort: Balanced</sub>

    Reviewers
    Assignees
    thisisnic thisisnic
    Labels
    risk: low confidence: 86.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: 25.6% (LOW) · Higher = larger blast radius
    25.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: 86.7% · Lower = rushed or shallow review
    86.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: 3.4% · Safe to merge
    3.4%
    Repository