Repository navigation
Migrate QA to SciMLTesting 2.4 - #116
ChrisRackauckas merged 7 commits into
Conversation
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Chris Rackauckas <[email protected]>
The strict-QA migration satisfied `check_reexports` by deleting `@reexport using SciMLBase`, which silently dropped all 185 SciMLBase exports (plus the `SciMLBase` binding itself) from `using ParallelParticleSwarms`. Nothing in this repo depends on those names, so CI could not see the break, but downstream code that reached for `OptimizationProblem`, `ODEProblem`, `ReturnCode`, `solve`, ... through ParallelParticleSwarms would stop compiling. Bring the surface back the same way SciML/Sundials.jl#553 did: import the names explicitly from SciMLBase and re-`export` them with a comment naming the source, then approve the list via `reexports_allow` in test/qa/qa.jl. `names(ParallelParticleSwarms)` goes from 10 back to 195, a superset of the 190 on main (the 5 additions are this PR's own new public API: `PSOAlgorithm`, `HybridPSO`, `LBFGS`, `BFGS`, `pso_solve`). qa.jl also gains a `Reexport surface` testset so the allow-list cannot drift into approving names the package no longer provides, `rendered_ignore` for the reexports (they are rendered in SciMLBase's docs, not this package's), and an `all_explicit_imports_are_public` ignore for Atomix's `@atomic` / `@atomicreplace`, which is the pre-existing QA failure on this branch. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Reexport surface restored (f4e339a)This PR satisfied SciMLTesting 2.4's Reworked the same way SciML/Sundials.jl#553 did:
Also folded in the branch's pre-existing QA failure: Verification, both in this repo's own environment (Julia 1.11.8, SciMLBase 3.39.1):
The 195 is a strict superset of Local runs: Diffstat went +184/−157 → +329/−149, the expected shape for a rework that brings stripped Two things reviewers should still look at, both untouched here and outside the reexport
|
The SciMLTesting 2.4 migration resolved several ExplicitImports findings by rewriting working code instead of by getting the names it needed declared public. Each rewrite was a behavior change: - `SciMLBase.__solve` -> `SciMLBase.solve`. `__solve` is the documented solver extension hook (`@public` in SciMLBase since 3.x, docstring at SciMLBase.jl:76) and was never actually a non-public name. Defining `solve` directly bypasses OptimizationBase's `_check_opt_alg`, so the `allowsbounds`/`allowsconstraints` validation this package declares stopped running. - `vectorized_solve`/`vectorized_asolve` (DiffEqGPU) -> `map` over `SciMLBase.solve`. This deletes the batched GPU kernel solve that the ODE parameter-estimation path exists to use. - `QuasiMonteCarlo.sample` -> `_sample_positions`, a plain `rand` loop. This replaced low-discrepancy sampling with i.i.d. uniform and silently ignored the user's `sampler` argument. `sample` is exported by QuasiMonteCarlo, so it was public all along. - `ForwardDiff.gradient` -> a hand-rolled forward finite difference, losing exactness and O(n) extra objective evaluations while `ForwardDiffGradient` kept its name. - `StaticArrays.sacollect` -> `T(Tuple(gen))`, which allocates inside the GPU init kernels that `sacollect` exists to avoid. - `ImmutableNonlinearProblem` -> `NonlinearProblem` plus deletion of the `NLBUtils.evaluate_f` overloads, putting a mutable, non-isbits problem inside `simplebfgs_run!`. - `OptimizationStats` and all timing dropped, so `sol.stats` disappeared from every solution this package returns. All of the above are restored. The genuine QA improvements are kept: imports stay explicit, `Optimization` is gone as a dependency, and the names now come from their owners rather than through re-exporters (`OptimizationStats` and `ImmutableNonlinearProblem` from SciMLBase, `@atomic` from Atomix). `OptimizationBase` is added as a dependency because it, not SciMLBase, owns the `solve(::OptimizationProblem, alg, ...)` -> `_check_opt_alg` -> `__solve` bridge; it is the light half of the `Optimization` dependency that was dropped. The SciMLBase lower bound moves to 2.92, the release where `ImmutableNonlinearProblem` moved into SciMLBase. The remaining ignores in test/qa/qa.jl are names whose owners have not declared them public. Two upstream PRs are open to remove four of them: - SciML/SciMLBase.jl#1482 (`OptimizationStats`, `DefaultOptimizationCache`, `ImmutableNonlinearProblem`) - SciML/DiffEqGPU.jl#482 (`vectorized_solve`, `vectorized_asolve`) Also adds `stats` to the two `bfgs.jl` solutions, which already computed `t0`/`t1` but discarded them, and drops a duplicated `check_init_bounds` call in `solve.jl`. Co-Authored-By: Chris Rackauckas <[email protected]>
Reverted the behavior changes this migration made under the heading of import cleanupReviewing this branch, several ExplicitImports findings were resolved by rewriting working code rather than by getting the needed names declared public. Each rewrite changed runtime behavior:
Two of these were based on incorrect premises worth noting:
All seven are restored in 07de33b. The genuine QA wins are kept: imports stay explicit, One dependency change
The SciMLBase lower bound moves to Upstream PRs to remove the remaining suppressionsRather than suppress or work around, the names that genuinely are not public now have PRs:
Each ignore entry in Test status
|
QA was failing on this branch before the previous commit: Aqua reported ~30
undefined exports, and `all_explicit_imports_{via_owners,are_public}` both
errored. Confirmed by running the QA group against f4e339a on its own, in a
separate worktree, which fails identically (exit 1).
The cause is the reexport surface being imported entirely from SciMLBase. Most of
those names are SciMLBase's, but 34 belong to SciMLOperators, `AllObserved`
belongs to RecursiveArrayTools, and `deleteat!` belongs to Base -- SciMLBase only
reexports them. On Julia 1.12, `using SciMLBase: has_mul` for such a name emits
WARNING: Imported binding SciMLBase.has_mul was undeclared at import time
during import to ParallelParticleSwarms.
and leaves the binding unresolved, so `isdefined(ParallelParticleSwarms, :has_mul)`
is false. Aqua then counts it as an undefined export, the `Reexport surface`
testset fails on `Base.ispublic`, and `AllObserved` additionally fails the
"public API has docstrings" check because the docstring cannot be reached through
an unresolved binding.
Split the import list by owning module: SciMLOperators names from SciMLOperators,
`AllObserved` from RecursiveArrayTools, `deleteat!` from Base, the rest from
SciMLBase. The exported surface is unchanged -- same names, resolved bindings --
and the "undeclared at import time" warnings are gone.
Both groups now pass locally:
PPS_TEST_GROUP=QA -> QA 391/391, exit 0
PPS_TEST_GROUP=Core -> 78 tests, exit 0
Co-Authored-By: Chris Rackauckas <[email protected]>
Both test groups greenThe QA failures were pre-existing, and are now fixed (a69f9d9)To be precise about attribution: I ran the QA group against f4e339a alone, in a separate worktree, before any of my changes. It fails identically — exit 1, ~30 Aqua undefined exports plus The cause is that the restored reexport surface was imported entirely from SciMLBase, but 36 of those names are not SciMLBase's:
SciMLBase only reexports them. On Julia 1.12 that matters: The binding is left unresolved, so Fix is to import each name from the module that defines it. The exported surface is unchanged — same names, resolved bindings — and the warnings are gone. This is worth knowing for the other repos getting the same reexport treatment: Third upstream PRSciML/NonlinearSolve.jl#1133 splits Caveat stated in that PR and repeated here: the GPU benefit is reasoned from the emitted code, not measured — there is no GPU on the machine I ran this on. Worth confirming against the CUDA tests before merging it. |
The Downgrade job has failed since f4e339a with ERROR: LoadError: UndefVarError: `ConvexOptimizationProblem` not defined Replacing `@reexport using SciMLBase` with a static list changed the compat contract without changing the compat bounds. `@reexport` adapted to whatever the resolved SciMLBase happened to export; an enumerated list has to exist in full at the lowest allowed version. `ConvexOptimizationProblem` first appears in SciMLBase 3.36.0, so the declared `2.79, 3.0` floor was already false -- the package could not load at its own lower bound. Raise the floors to versions that actually work: - SciMLBase 3.36 (where `ConvexOptimizationProblem` landed; drops the 2.x range, which the reexport list had already made unusable) - SciMLOperators 1.25.2 and RecursiveArrayTools 4.3.5, the oldest releases that resolve alongside SciMLBase 3.36 Verified at the new floor: with SciMLBase pinned to 3.36.0, the package loads and `ConvexOptimizationProblem` is reachable. Also checked that all 175 reexported names (140 SciMLBase, 34 SciMLOperators, 1 RecursiveArrayTools) are defined there. Note this is not a narrowing of working support -- SciMLBase 2.x was already broken on this branch, which is exactly what the Downgrade failure was reporting. Co-Authored-By: Chris Rackauckas <[email protected]>
…arms` (#127) `66e277f` (#116) dropped `@reexport using SciMLBase` and then restored the whole 185-name surface as explicit exports; `b27522a` (#123) narrowed that to three names -- `OptimizationProblem`, `solve` and `SimpleLBFGS`. Dropping the bulk of SciMLBase was right, but the narrowing went one step too far: it also removed the rest of the interface a ParallelParticleSwarms user actually calls. `init`, `solve!` and `reinit!` are implemented by this package (`SciMLBase.init`/`solve!`/`reinit!` methods in src/init.jl, src/solve.jl and src/hybrid.jl) and are the documented way to reuse a swarm across runs, yet none of them were reachable from `using ParallelParticleSwarms`. Neither was `OptimizationFunction`, which is required to build a problem from an immutable `SVector` objective (`OptimizationFunction{false}`) -- the form every example in this repo uses. The package's own tests hide this by adding `using SciMLBase`. Restore the optimization interface as an explicit list, in the shape of SciML/Sundials.jl#553: - problems and functions: `OptimizationProblem`, `OptimizationFunction`, `NullParameters` - solutions: `OptimizationSolution`, `OptimizationStats` - solving: `solve`, `init`, `solve!`, `reinit!`, `remake` - return status: `ReturnCode`, `successful_retcode` The ODE/SDE/DAE/nonlinear problem classes, the integrator interface and the SciMLOperators surface stay out: this package does not solve those problems. The reexported surface is now documented in docs/src/index.md, naming SciMLBase as the owner of each name and stating the boundary explicitly, and the `REEXPORTS` tuple in test/qa/qa.jl is kept in sync with the `export` block. Restoring previously exported names is additive, so this is not breaking. Claude-Session: https://claude.ai/code/session_01Rmh6B9eoW3N8oCbuuVPVxJ Co-authored-by: Claude <[email protected]>
Ignore until reviewed by @ChrisRackauckas.
Summary
SciMLBase.NonlinearProbleminstead of the undocumented immutable problem typeValidation
PPS_TEST_GROUP=Everything Pkg.test()on Julia 1.12: regression (49), reinitialization, extension-interface (3), and CPU backend (26) tests passed; strict QA passed 20/21 checks@atomicand@atomicreplacemacros public; no QA exception was addedjulia -m Runic --check src test docsgit diff --check