Skip to content

Commit 043aaa6

Browse files
ChrisRackauckas-ClaudeChrisRackauckasclaude
authored
QA: run_qa v1.6 form + ExplicitImports (#319)
* QA: run_qa v1.6 form + ExplicitImports Convert test/qa/qa.jl from a hand-rolled Aqua testset to SciMLTesting's run_qa (v1.6) with ExplicitImports enabled. The bespoke JET `@test_opt` constructor type-stability checks stay in test/qa/jet_tests.jl (run_qa's `JET.test_package` error analysis does not subsume them); run_qa keeps its JET off via `jet = false` so loading JET in jet_tests.jl does not auto-enable it. ExplicitImports findings resolved: - no_implicit_imports: add SciMLBase.DiscreteProblem to the explicit imports (was used implicitly). - no_stale_explicit_imports: drop genuinely-unused imports NonlinearLeastSquaresProblem, init, reinit!, solve! (SciMLBase) and ldiv! (LinearAlgebra) — each was only ever accessed in qualified/extended form (SciMLBase.reinit! etc.) or not at all. derivative_discontinuity! is kept and ignored: it is imported inside the @static-if SciMLBase v2/v3 rename shim and used bare on v3, which the static scan cannot see through. - all_qualified_accesses_via_owners: change SciMLBase.copyto! to bare copyto! in the manifold projection (copyto! is Base's, already imported from LinearAlgebra). - Remaining other-package non-public qualified accesses / explicit imports ignored via ei_kwargs (SciMLBase / LinearAlgebra / Base / DiffEqBase internals; several are `public` on 1.11+ but flagged on the LTS). test/qa/Project.toml: add SciMLTesting (compat "1.6"); ExplicitImports comes transitively via SciMLTesting; Aqua and JET stay direct deps (Aqua's ambiguities child-proc and the bespoke JET check need them). Verified locally against released SciMLTesting 1.6.0: QA group green on both lanes (Julia 1.12: jet_tests 15/15, qa.jl 17/17; Julia 1.10 LTS: jet_tests 1 broken [JET-skip-on-LTS, preserved], qa.jl 17/17). Full Core lane green on 1.12 (manifold 25/25, domain 19/19, terminatesteadystate 11/11). Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * QA: trim redundant public-API EI ignores (SciMLTesting 1.7 + released base libs) SciMLTesting 1.7.0 runs the two public-API ExplicitImports checks (check_all_qualified_accesses_are_public / check_all_explicit_imports_are_public) only on Julia >= 1.11 and skips them on the LTS, and SciMLBase 3.24.0 made several formerly-internal names public. With those released, the per-name public-API ignore-lists in test/qa/qa.jl are largely redundant. Drop the entries that are now public on the registered releases (verified on Julia 1.12 against SciMLBase 3.24.0): - all_qualified_accesses_are_public: remove numargs, successful_retcode, Success, ConvergenceFailure, InitialFailure (SciMLBase), depwarn (Base), reverse (Base.Iterators). Keep only what the public checks still flag against the registered releases: - all_qualified_accesses_are_public: AbstractDEProblem, AbstractODEIntegrator, INITIALIZE_DEFAULT, _unwrap_val, alg_order, isadaptive (SciMLBase 3.24.0, still non-public), QRCompactWY (LinearAlgebra), RefValue (Base). - all_explicit_imports_are_public: get_tstops, get_tstops_array, get_tstops_max (DiffEqBase 7.5.7, still non-public). The no_stale_explicit_imports ignore (derivative_discontinuity!) is unchanged. qa/Project.toml needs no compat change: SciMLTesting="1.6" already admits 1.7, and the base-lib floors transitively admit the released versions. Verified locally against registered releases (SciMLTesting 1.7.0, SciMLBase 3.24.0, DiffEqBase 7.5.7, ExplicitImports 1.15.0): - Julia 1.12 (public checks run): QA group 32/32 pass. - Julia 1.10 LTS (public checks skipped): QA group 15 pass + 1 broken (pre-existing JET-skip-on-LTS marker), 0 fail. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * QA: migrate DiffEqBase.X -> SciMLBase.X callers; strip now-public EI ignores DiffEqBase 7.6.0 / SciMLBase 3.27.0 make the previously-internal names public, so the public-API ExplicitImports ignores can be trimmed and the qualified-access callers pointed at the owning module (SciMLBase): - src: rewrite `DiffEqBase.isinplace/addsteps!/get_du!/DiscreteProblem` (all SciMLBase-owned, now public, identity-equal re-exports) to `SciMLBase.X`; drop the now-unused `DiffEqBase` module self-binding from the import (only the DiffEqBase-own `get_tstops*` are still used bare); fix the PresetTimeCallback docstring to `SciMLBase.INITIALIZE_DEFAULT`. - qa.jl: empty `all_explicit_imports_are_public` (get_tstops* now public in DiffEqBase 7.6.0) and drop `AbstractDEProblem/alg_order/isadaptive` from `all_qualified_accesses_are_public` (now public in SciMLBase 3.27.0). Survivors kept (verified still non-public on Julia 1.12 / SciMLBase 3.27.0, DiffEqBase 7.6.0, stdlib): AbstractODEIntegrator, INITIALIZE_DEFAULT, _unwrap_val (SciMLBase), QRCompactWY (LinearAlgebra), RefValue (Base). Verified: QA group 17/17 on Julia 1.12 (public-API checks run), 15/15 on Julia 1.10 (public-API checks gated off by SciMLTesting 1.7); 0 fail/error. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * QA: eliminate fixable EI exceptions (migrate/local-define), keep only stdlib internals ExplicitImports exceptions in test/qa/qa.jl reduced from 6 to 2 by fixing the root cause instead of ignoring: - derivative_discontinuity! (no_stale_explicit_imports ignore): the v2/v3 rename shim used `using SciMLBase: derivative_discontinuity!` on one branch and a `const ... = SciMLBase.u_modified!` on the other, which EI flagged as a stale import. Replaced with a single `const` bound to whichever public name the loaded SciMLBase provides; behavior is identical on both v2 (u_modified!) and v3 (derivative_discontinuity!), both of which are public. Drops the ignore. - AbstractODEIntegrator (all_qualified_accesses_are_public ignore): now public in SciMLBase 3.30.0 and already accessed via the public owner SciMLBase; ignore is redundant and dropped. - INITIALIZE_DEFAULT: defined a local no-op `INITIALIZE_DEFAULT(cb,u,t,integrator) = derivative_discontinuity!(integrator, false)` matching SciMLBase's non-public const (no identity comparison exists for it anywhere in SciMLBase/DiffEqBase/ OrdinaryDiffEqCore, so a local binding is behavior-preserving) and use it as the PresetTimeCallback default. Drops the ignore. - _unwrap_val: defined a local `_unwrap_val` (the leading-underscore SciMLBase internal that will not be made public) reproducing its exact behavior, used in manifold.jl. Drops the ignore. Remaining 2 ignores are genuinely-irreducible concrete stdlib internal types with no public spelling: LinearAlgebra.QRCompactWY (dispatch target of fact_successful) and Base.RefValue (concrete Ref type in a parametric NamedTuple alias). No new direct deps: all migrations went to local definitions or to already-imported public SciMLBase API. Verified on Julia 1.12 / SciMLBase 3.30.0 / SciMLTesting 1.7.0: QA group 17/17 pass; print_explicit_imports reports only the 2 stdlib internals. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> --------- Co-authored-by: ChrisRackauckas-Claude <accounts@chrisrackauckas.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 411b4bc commit 043aaa6

12 files changed

Lines changed: 67 additions & 40 deletions

src/DiffEqCallbacks.jl

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,46 @@ module DiffEqCallbacks
22

33
using ConcreteStructs: @concrete
44
using DataStructures: DataStructures, BinaryMaxHeap, BinaryMinHeap
5-
using DiffEqBase: DiffEqBase, get_tstops, get_tstops_array, get_tstops_max
5+
using DiffEqBase: get_tstops, get_tstops_array, get_tstops_max
66
using DifferentiationInterface: DifferentiationInterface, Constant
7-
using LinearAlgebra: LinearAlgebra, adjoint, axpy!, copyto!, diagind, mul!, ldiv!
7+
using LinearAlgebra: LinearAlgebra, adjoint, axpy!, copyto!, diagind, mul!
88
using Markdown: @doc_str
99
using PrecompileTools: PrecompileTools
1010
using RecipesBase: @recipe
1111
using RecursiveArrayTools: RecursiveArrayTools, DiffEqArray, copyat_or_push!
12-
using SciMLBase: SciMLBase, CallbackSet, DiscreteCallback, NonlinearFunction,
13-
NonlinearLeastSquaresProblem, NonlinearProblem, RODEProblem,
12+
using SciMLBase: SciMLBase, CallbackSet, DiscreteCallback, DiscreteProblem,
13+
NonlinearFunction, NonlinearProblem, RODEProblem,
1414
ReturnCode, SDEProblem, add_tstop!, check_error, get_du,
15-
get_proposed_dt, get_tmp_cache, init, reinit!,
16-
set_proposed_dt!, solve!, terminate!
15+
get_proposed_dt, get_tmp_cache,
16+
set_proposed_dt!, terminate!
1717
using StaticArraysCore: StaticArraysCore
1818

1919
# SciMLBase v3 renamed `u_modified!` → `derivative_discontinuity!` (with
2020
# an `@deprecate` on the old name). Support both SciMLBase v2 and v3 by
21-
# aliasing to whichever name the loaded SciMLBase provides.
22-
@static if isdefined(SciMLBase, :derivative_discontinuity!)
23-
using SciMLBase: derivative_discontinuity!
21+
# binding a const to whichever name the loaded SciMLBase provides. Both
22+
# `derivative_discontinuity!` and `u_modified!` are public in their
23+
# respective SciMLBase versions, so the qualified access is to public API; a
24+
# `const` (rather than a `using` import on one branch) keeps the name a single
25+
# local binding and avoids a stale-import false positive.
26+
const derivative_discontinuity! = if isdefined(SciMLBase, :derivative_discontinuity!)
27+
SciMLBase.derivative_discontinuity!
2428
else
25-
const derivative_discontinuity! = SciMLBase.u_modified!
29+
SciMLBase.u_modified!
2630
end
2731

2832
const DI = DifferentiationInterface
2933
true_condition(u, t, integrator) = true
3034

35+
# Local reproduction of SciMLBase's `_unwrap_val` (a leading-underscore internal
36+
# that will not be made public): pull the value out of a `Val`, pass anything
37+
# else through unchanged.
38+
_unwrap_val(B) = B
39+
_unwrap_val(::Val{B}) where {B} = B
40+
41+
# No-op default `initialize` for `DiscreteCallback`, matching SciMLBase's
42+
# (non-public) `INITIALIZE_DEFAULT`: reset the derivative-discontinuity flag.
43+
INITIALIZE_DEFAULT(cb, u, t, integrator) = derivative_discontinuity!(integrator, false)
44+
3145
include("functor_helpers.jl")
3246
include("autoabstol.jl")
3347
include("manifold.jl")

src/function_caller.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function (affect!::FunctionCallingAffect)(integrator, force_func = false)
1919
if curt != integrator.t # If <t, interpolate
2020
if integrator isa SciMLBase.AbstractODEIntegrator
2121
# Expand lazy dense for interpolation
22-
DiffEqBase.addsteps!(integrator)
22+
SciMLBase.addsteps!(integrator)
2323
end
2424
if integrator.u isa Union{Number, StaticArraysCore.SArray}
2525
curu = integrator(curt)

src/integrating.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ function (affect!::SavingIntegrandAffect)(integrator)
181181
for i in 1:n
182182
t_temp = ((integrator.t - integrator.tprev) / 2) * gauss_points[n][i] +
183183
(integrator.t + integrator.tprev) / 2
184-
if DiffEqBase.isinplace(integrator.sol.prob)
184+
if SciMLBase.isinplace(integrator.sol.prob)
185185
curu = first(get_tmp_cache(integrator))
186186
integrator(curu, t_temp)
187187
if affect!.integrand_cache == nothing

src/integrating_GK_affect.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ function integrate_gk!(
178178
affect!.gk_err_cache = recursive_zero!(affect!.gk_err_cache)
179179
for i in 1:(2 * order + 1)
180180
t_temp = (gk_points[order][i] + 1) * ((bound_r - bound_l) / 2) + bound_l
181-
if DiffEqBase.isinplace(integrator.sol.prob)
181+
if SciMLBase.isinplace(integrator.sol.prob)
182182
curu = first(get_tmp_cache(integrator))
183183
integrator(curu, t_temp)
184184
if affect!.integrand_cache == nothing

src/integrating_GK_sum.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function integrate_gk!(
1919
)
2020
affect!.gk_step_cache = recursive_zero!(affect!.gk_step_cache)
2121
affect!.gk_err_cache = recursive_zero!(affect!.gk_err_cache)
22-
isinplace_prob = DiffEqBase.isinplace(integrator.sol.prob)
22+
isinplace_prob = SciMLBase.isinplace(integrator.sol.prob)
2323
inplace_integrand = affect!.integrand_inplace === nothing ?
2424
(isinplace_prob && affect!.integrand_cache !== nothing) :
2525
affect!.integrand_inplace

src/integrating_sum.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function (affect!::SavingIntegrandSumAffect)(integrator)
8888
n = div(SciMLBase.alg_order(integrator.alg) + 1, 2)
8989
end
9090
accumulation_cache = recursive_zero!(affect!.accumulation_cache)
91-
isinplace_prob = DiffEqBase.isinplace(integrator.sol.prob)
91+
isinplace_prob = SciMLBase.isinplace(integrator.sol.prob)
9292
inplace_integrand = affect!.integrand_inplace === nothing ?
9393
(isinplace_prob && affect!.integrand_cache !== nothing) :
9494
affect!.integrand_inplace

src/manifold.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function (proj::ManifoldProjection)(integrator)
114114
return
115115
end
116116

117-
return SciMLBase.copyto!(integrator.u, u)
117+
return copyto!(integrator.u, u)
118118
end
119119

120120
function initialize_manifold_projection(cb, u, t, integrator)
@@ -152,7 +152,7 @@ export ManifoldProjection
152152
# wrapper for non-autonomous functions
153153
function wrap_autonomous_function(autonomous::Union{Val{true}, Val{false}}, g)
154154
g === nothing && return nothing
155-
return TypedNonAutonomousFunction{SciMLBase._unwrap_val(autonomous)}(g, nothing)
155+
return TypedNonAutonomousFunction{_unwrap_val(autonomous)}(g, nothing)
156156
end
157157
function wrap_autonomous_function(autonomous::Union{Bool, Nothing}, g)
158158
g === nothing && return nothing

src/preset_time.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ end
3434
"""
3535
```julia
3636
PresetTimeCallback(tstops, user_affect!;
37-
initialize = DiffEqBase.INITIALIZE_DEFAULT,
37+
initialize = INITIALIZE_DEFAULT,
3838
filter_tstops = true,
3939
kwargs...)
4040
```
@@ -55,7 +55,7 @@ automatic.
5555
"""
5656
function PresetTimeCallback(
5757
tstops, user_affect!;
58-
initialize = SciMLBase.INITIALIZE_DEFAULT,
58+
initialize = INITIALIZE_DEFAULT,
5959
filter_tstops = true,
6060
sort_inplace = false, kwargs...
6161
)

src/saving.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ function (affect!::SavingAffect)(integrator, force_save = false)
5252
if curt != integrator.t # If <t, interpolate
5353
if integrator isa SciMLBase.AbstractODEIntegrator
5454
# Expand lazy dense for interpolation
55-
DiffEqBase.addsteps!(integrator)
55+
SciMLBase.addsteps!(integrator)
5656
end
57-
if !DiffEqBase.isinplace(integrator.sol.prob)
57+
if !SciMLBase.isinplace(integrator.sol.prob)
5858
curu = integrator(curt)
5959
else
6060
curu = first(get_tmp_cache(integrator))

src/terminatesteadystate.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@ function allDerivPass(integrator, abstol, reltol, min_t)
88
end
99

1010
testval = if integrator.sol.prob isa DiscreteProblem
11-
if DiffEqBase.isinplace(integrator.sol.prob)
11+
if SciMLBase.isinplace(integrator.sol.prob)
1212
testval = first(get_tmp_cache(integrator))
1313
@. testval = integrator.u - integrator.uprev
1414
else
1515
testval = integrator.u .- integrator.uprev
1616
end
1717
else
18-
if DiffEqBase.isinplace(integrator.sol.prob)
18+
if SciMLBase.isinplace(integrator.sol.prob)
1919
testval = first(get_tmp_cache(integrator))
20-
DiffEqBase.get_du!(testval, integrator)
21-
if integrator.sol.prob isa DiffEqBase.DiscreteProblem
20+
SciMLBase.get_du!(testval, integrator)
21+
if integrator.sol.prob isa SciMLBase.DiscreteProblem
2222
@. testval = testval - integrator.u
2323
end
2424
testval
2525
else
2626
testval = get_du(integrator)
27-
if integrator.sol.prob isa DiffEqBase.DiscreteProblem
27+
if integrator.sol.prob isa SciMLBase.DiscreteProblem
2828
testval = testval - integrator.u
2929
end
3030
testval

0 commit comments

Comments
 (0)