Summary
Running Aqua with ambiguities=true reports 27 method ambiguities in GraphPPL. The CI
gate (test/runtests.jl:4) disables both ambiguity and piracy checks:
Aqua.test_all(GraphPPL; ambiguities = false, piracies = false, deps_compat = (; check_extras = false, check_weakdeps = true))
Several ambiguities are self-inflicted and can dispatch to the wrong method (or MethodError)
on valid inputs:
checked_getindex(::NodeLabel, ::FunctionalIndex) vs checked_getindex(nodelabel::NodeLabel, index) — src/graph_engine.jl:376 vs :384
recursive_size(::Val{1}, ::Vector{T}) vs recursive_size(::Val{N}, ::Vector{<:Vector}) — src/resizable_array.jl:59 vs :63
<(::VariableRef, ::VariableRef) / <= — src/graph_engine.jl:935-938
getindex(::NodeCreationOptions, ::NTuple{N,Symbol}) vs getindex(::NodeCreationOptions{Nothing}, ...) — :658 vs :664
- the four
getindex(collection::AbstractArray, range::FunctionalRange{...}) overloads — :108,:111,:112
Why it matters
Julia resolves ambiguous dispatch (possibly nondeterministically) or throws MethodError.
For a library that must build the same factor graph deterministically, an ambiguous
size/recursive_size/getindex is a reproducibility risk. Also, the intentional
"cannot compare VariableRef" error path (equalish-<) can instead dispatch into one of the
mutually-ambiguous generic fallbacks.
Suggested fix
- Re-enable
ambiguities = true (and ideally piracies = true) in test/runtests.jl.
- Add explicit disambiguating methods for the self-inflicted cases (exact signatures listed
in findings/medium-04-...md).
Summary
Running Aqua with
ambiguities=truereports 27 method ambiguities in GraphPPL. The CIgate (
test/runtests.jl:4) disables both ambiguity and piracy checks:Several ambiguities are self-inflicted and can dispatch to the wrong method (or
MethodError)on valid inputs:
checked_getindex(::NodeLabel, ::FunctionalIndex)vschecked_getindex(nodelabel::NodeLabel, index)—src/graph_engine.jl:376vs:384recursive_size(::Val{1}, ::Vector{T})vsrecursive_size(::Val{N}, ::Vector{<:Vector})—src/resizable_array.jl:59vs:63<(::VariableRef, ::VariableRef)/<=—src/graph_engine.jl:935-938getindex(::NodeCreationOptions, ::NTuple{N,Symbol})vsgetindex(::NodeCreationOptions{Nothing}, ...)—:658vs:664getindex(collection::AbstractArray, range::FunctionalRange{...})overloads —:108,:111,:112Why it matters
Julia resolves ambiguous dispatch (possibly nondeterministically) or throws
MethodError.For a library that must build the same factor graph deterministically, an ambiguous
size/recursive_size/getindexis a reproducibility risk. Also, the intentional"cannot compare VariableRef" error path (
equalish-<) can instead dispatch into one of themutually-ambiguous generic fallbacks.
Suggested fix
ambiguities = true(and ideallypiracies = true) intest/runtests.jl.in
findings/medium-04-...md).