Skip to content

Method ambiguities present; Aqua ambiguity/piracy checks disabled in CI #312

Description

@docxology

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

  1. Re-enable ambiguities = true (and ideally piracies = true) in test/runtests.jl.
  2. Add explicit disambiguating methods for the self-inflicted cases (exact signatures listed
    in findings/medium-04-...md).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions