Repository navigation
Fix method ambiguity in AbstractVectorOfArray similar() breaking QA on Julia 1.10 - #678
ChrisRackauckas-Claude wants to merge 1 commit into
Conversation
…) on Julia 1.10 Making AbstractVectorOfArray <: AbstractArray (SciML#547) made RAT's similar(VA::AbstractVectorOfArray, ::Type{T}, dims::Tuple{Union{Integer,Base.OneTo}, Vararg{...}}) ambiguous with Base.similar(a::AbstractArray, ::Type{T}, dims::Tuple{Integer, Vararg{Integer}}), a Base fallback method that exists on Julia 1.10/1.11 but was removed in 1.12. This was masked by the Aqua ambiguities exemption until SciML#648 removed it, so GROUP=QA on Julia 1.10 (the "lts" CI matrix entry) started failing on master. Adds the more specific Integer-only method Aqua's own diagnostic suggested, mirroring the analogous pair of methods Base itself defines, resolving the ambiguity without an Aqua exclusion. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude <noreply@anthropic.com> Agent-Harness: Claude Code Agent-Model: claude-sonnet-5 Agent-Session: https://claude.ai/code/session_01LPHREnnonfLg1VcE1EJovv
Independent review (Devin CLI 3000.11.3, model fusion-claude-opus-5-5-high-sidekick-swe-2-medium): CHANGES, risk low. Full reviewVERDICT: CHANGES The added method is correct. Running it confirms it removes the ambiguity on Julia 1.10 and 1.11. On 1.12 and 1.13 it is harmless: it returns the same results as master. Two problems remain. The PR adds no test that CI will actually run. The PR body also misdescribes what the bug is and where CI would catch it. Blocking findings
Non-blocking findings
What I ranAll runs used
What I did not verify
Links
🤖 Posted by an AI agent — harness: Devin CLI 3000.11.3 (review), Claude Code 2.1.285 (posting) · model: fusion-claude-opus-5-5-high-sidekick-swe-2-medium |
Please ignore until reviewed by @ChrisRackauckas.
Problem
GROUP=QA julia +1.10 --project -e 'using Pkg; Pkg.test()'fails on master (reproduced at02c477c, "Run ode_gpu.jl in the GPU test group (#659)") with an Aqua method-ambiguity betweenBase.similar(::RecursiveArrayTools.AbstractVectorOfArray, ::Type{T}, ::Tuple{Union{Integer,Base.OneTo}, Vararg{...}})(src/vector_of_array.jl:1157) andBase.similar(a::AbstractArray, ::Type{T}, dims::Tuple{Integer, Vararg{Integer}})(abstractarray.jl:839).GROUP=QAon Julia 1.12 (and the1CI channel) passes.CI does run QA on Julia 1.10:
test/test_groups.tomlhas[QA] versions = ["lts", "1"], and"lts"currently resolves to 1.10. So this is a real CI break on master'sltsQA lane, not a gap in coverage.Root cause
Julia 1.10/1.11's
Basedefines three overlappingsimilar(::AbstractArray, ::Type, dims)fallbacks, includingdims::Tuple{Integer, Vararg{Integer}}atabstractarray.jl:839. That particular fallback was removed in Julia 1.12 (methods(Base.similar, Tuple{AbstractArray,Type,Tuple})only shows theNTuple{N,Int}andTuple{Union{Integer,Base.OneTo},...}overloads there). RecursiveArrayTools definessimilar(VA::AbstractVectorOfArray, ::Type{T}, dims::Tuple{Union{Integer,Base.OneTo}, Vararg{...}}), which is neither more nor less specific than Julia 1.10'sTuple{Integer, Vararg{Integer}}fallback onceAbstractVectorOfArray <: AbstractArray(one dominates on the first argument, the other on the third) — hence the ambiguity, present only on Julia ≤ 1.11.Bisect
cde5c35("Make AbstractVectorOfArray <: AbstractArray for proper interface compliance", PR BREAKING: Make AbstractVectorOfArray <: AbstractArray #547, merged 2026-04-01). Before this,AbstractVectorOfArraywas not anAbstractArray, so Base'ssimilarfallbacks never entered the dispatch intersection.f3569c3("fix: resolve ArrayPartition ambiguity QA", PR fix: resolve ArrayPartition ambiguity QA #648, merged 2026-08-26) removed the blanketaqua_broken = (:ambiguities,)exemption. That PR's own verification fixed thecopyto!/ldiv!ambiguities it found, but did not catch this one (version-dependent on Julia ≤ 1.11).git log -L 1157,1166:src/vector_of_array.jl, which traces the ambiguous method directly tocde5c35.Fix
Adds
similar(VA::AbstractVectorOfArray, ::Type{T}, dims::Tuple{Integer, Vararg{Integer}}), exactly the "possible fix" Aqua's own diagnostic suggests, pinning the Integer-only intersection so it dominates both the existing RAT method and Base's 1.10/1.11 fallback. This mirrors the same two-method split Base itself already uses (NTuple{N,Int}+Tuple{Integer,Vararg{Integer}}), so it does not introduce a new ambiguity. No Aqua exclusion used.Verification
Before (
git stash, Julia 1.10.12, private depot):After (fix applied):
Also ran, all green:
GROUP=QA, Julia 1.12.7:Quality Assurance | Pass 20 Total 20(count differs from 1.10's 18 due to version-gated checks; both fully pass, before and after the fix).GROUP=Core, Julia 1.10.12:RecursiveArrayTools tests passed(all testsets, includingVecOfArr Indexing/Interface Tests, pass).GROUP=Core, Julia 1.12.7:RecursiveArrayTools tests passed.Runic.main(["--diff","--check", "src/vector_of_array.jl"])): no diff, clean.typos src/vector_of_array.jl: clean.Not verified
similardispatch used by the ambiguity check and Core/QA groups above, but these were not re-run.GROUP=Everything.#648exemption state (i.e. confirming the ambiguity was silently present between#547and#648); inferred from the code history (git log -L) rather than executed, since re-instantiating environments at each historical commit was not needed to identify the single-commit cause.Risk assessment
similarmethod forAbstractVectorOfArray; no existing method signature or behavior changes, no public API addition/removal, no version bump needed (internal dispatch fix only).🤖 Generated with Claude Code
https://claude.ai/code/session_01LPHREnnonfLg1VcE1EJovv