Skip to content

Fix sublibrary QA (Aqua/JET) findings in OUQBase and CanonicalMoments#27

Draft
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:mainfrom
ChrisRackauckas-Claude:fix-sublibrary-qa-findings
Draft

Fix sublibrary QA (Aqua/JET) findings in OUQBase and CanonicalMoments#27
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:mainfrom
ChrisRackauckas-Claude:fix-sublibrary-qa-findings

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Contributor

Problem

The sublibraries / lib/OUQBase [QA] and sublibraries / lib/CanonicalMoments [QA] checks (added in #17) fail on main with real Aqua/JET findings — they are not harness bugs. This PR fixes them at the source.

OUQBase QA findings (Aqua 9 pass / 3 fail + 7 JET errors)

  • Aqua stale dep: PolynomialRoots is declared in [deps] but never used anywhere in src or test. Removed it (and its compat).
  • Aqua piracy: CanonicalMoments.RawMomentSequence(::Num, ::Vector{Union{Equation,Inequality}}) defined a constructor on a foreign type with foreign argument types. Renamed to an internal build_raw_moment_sequence; it was only ever called inside OUQBase, so behavior is unchanged.
  • JET OUQBase.simplify is not defined: the bare simplify binding is ambiguous between the using ModelingToolkit and using Symbolics imports. Qualified it as Symbolics.simplify (matching every other simplify call in the file).
  • JET local variable objective is not defined: a @debug interpolated objective one line before objective = ouq_sys.objective. Reordered.
  • JET getindex(::Nothing, ::Any): raw_moments_map/p_free_map returned Union{Nothing, OrderedDict} via a runtime isa ternary. Made them dispatch on the concretely typed reduction_data, and read the maps off the concrete StengerCanonicalMoments argument inside discrete_measure_map, so they stay type stable.
  • JET convert(...) union split in the OUQSystem constructor: process_objective returns a Union, so routed it through a _OUQSystem function barrier to build the struct with a concrete objective type parameter.

CanonicalMoments QA finding (3 JET errors)

  • JET no matching method found kwcall(...): DEFAULT_ROOT_SOLVER forwarded args...; kwargs... to the closed-form solvers (quadratic_eq_sridhare, simple_real_cubic_eq, simple_real_quartic_eq), which accept only the coefficient vector. Only the generic Polynomials.roots fallback consumes those options, so they are now passed only there.

Local verification

  • OUQBase QA, Julia 1.12: Aqua 11/11, JET 1/1 (was 9/3 + 7 JET errors).
  • CanonicalMoments JET, Julia 1.10 (lts): 1/1 (was 3 errors).
  • CanonicalMoments analytic root-solver branches (quadratic/cubic/quartic + generic fallback) still return correct roots (orthopoly_roots.jl Core tests pass 11/11).
  • OUQBase Core Pkg.test() on Julia 1.12 passes, including the canonical-moments objective test that exercises the refactored accessor / constructor path.

Scope / remaining main reds (NOT addressed here)

These have different root causes and need cross-repo coordination, so they are out of scope for this focused PR:

  • tests / Core (julia lts) and tests / QA (julia lts) fail at julia-buildpkg with expected package CanonicalMoments ... to be registered. The centralized SciML/.github tests.yml skips developing in-repo [sources] path deps when project == '.', and on Julia 1.10 [sources] is not auto-resolved — a SciML/.github workflow issue.
  • Downgrade / Downgrade Sublibraries fail because julia-actions/julia-downgrade-compat@v2 errors with unknown package UUID on the unregistered in-repo [sources] package — an upstream action limitation.
  • tests / QA (julia 1) GROUP=QA dispatch is fixed by the separate Route umbrella QA group through the qa keyword (fixes GROUP=QA dispatch) #22.

Please ignore until reviewed by @ChrisRackauckas.

The `sublibraries / [QA]` checks (added in SciML#17) fail on `main` with real
Aqua/JET findings. Fix them at the source:

OUQBase
- Aqua stale dep: drop the unused `PolynomialRoots` dependency (and its
  compat) from `lib/OUQBase/Project.toml`; it is not referenced anywhere in
  src or test.
- Aqua piracy: rename the pirate `CanonicalMoments.RawMomentSequence(::Num,
  ::Vector{...})` method (a constructor on a foreign type with foreign arg
  types) to an internal `build_raw_moment_sequence`; it was only ever called
  inside OUQBase, so behavior is unchanged.
- JET `OUQBase.simplify is not defined`: qualify the bare `simplify` call as
  `Symbolics.simplify` (the bare binding is ambiguous between the
  ModelingToolkit and Symbolics `using` imports).
- JET `local variable objective is not defined`: assign `objective =
  ouq_sys.objective` before the `@debug` that interpolates it.
- JET `getindex(::Nothing, ::Any)`: make `raw_moments_map`/`p_free_map`
  dispatch on the concretely typed `reduction_data` instead of a runtime
  `isa` ternary, and read the maps off the concrete `StengerCanonicalMoments`
  arg inside `discrete_measure_map`, so the accessors stay type stable.
- JET `convert(...)` union split in the `OUQSystem` constructor: route the
  `process_objective` result through a `_OUQSystem` function barrier so the
  struct's objective field is built with a concrete type parameter.

CanonicalMoments
- JET `no matching method found kwcall(...)`: `DEFAULT_ROOT_SOLVER` forwarded
  `args...; kwargs...` to the closed-form solvers (`quadratic_eq_sridhare`,
  `simple_real_cubic_eq`, `simple_real_quartic_eq`), which take only the
  coefficient vector. Only the generic `Polynomials.roots` fallback consumes
  those options, so pass them only there.

Verified locally:
- OUQBase QA on Julia 1.12: Aqua 11/11, JET 1/1 (was 9/3 + 7 JET errors).
- CanonicalMoments JET on Julia 1.10 (lts): 1/1 (was 3 errors).
- CanonicalMoments analytic root-solver branches still return correct roots.
- OUQBase Core `Pkg.test()` on Julia 1.12 passes (canonical-moments path).

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Contributor Author

Status update (CI triage 2026-06-20): the four sublibraries / lib/OUQBase [QA] and sublibraries / lib/CanonicalMoments [QA] checks this PR targets are now GREEN on this branch (Julia 1 and lts). The remaining reds on this branch have separate root causes and are tracked elsewhere:

  • tests / Core (julia lts) + tests / QA (julia lts): the centralized SciML/.github tests.yml skipped the 'Develop in-repo [sources]' step for the monorepo ROOT (project: '.'), so on the LTS the root's path-[sources] siblings (CanonicalMoments/DiscreteMeasures/OUQBase) aren't developed and julia-buildpkg errors with expected package CanonicalMoments ... to be registered. Fixed in tests.yml: develop in-repo [sources] for monorepo ROOT (project: '.') on the LTS .github#101 (verified locally on Julia 1.10); greens once merged + v1 re-tagged.
  • tests / QA (julia 1): GROUP=QA reserved-name dispatch, fixed by the separate Route umbrella QA group through the qa keyword (fixes GROUP=QA dispatch) #22.
  • Downgrade / Downgrade Sublibraries (lib/OUQBase, lib/CanonicalMoments): a julia-actions/julia-downgrade-compat bug — its create_merged_project keeps path-[sources] deps in the merged base [deps], so the resolver hits unknown package UUID: <source pkg>. Reproduced locally; reported upstream (third-party action).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants