Skip to content

Accept stochastic caches in nlsolve! - #4386

Closed
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:fix/stochastic-nlsolve-cache-contract
Closed

ChrisRackauckas-Claude wants to merge 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:fix/stochastic-nlsolve-cache-contract

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

Ignore this draft until it has been reviewed by @ChrisRackauckas.

What changed

OrdinaryDiffEqNonlinearSolve.nlsolve! is also used by StochasticDiffEq, whose integrator caches subtype the public common SciMLBase.DECache abstraction rather than OrdinaryDiffEqCache. The cache-slot validation added in #4352 therefore rejected valid ISSEMCache, ImplicitEMCache, and ImplicitEMConstantCache values.

This accepts SciMLBase.DECache while continuing to reject non-cache values, bumps OrdinaryDiffEqNonlinearSolve to 2.9.2, and adds explicit successful-retcode assertions to the implicit event solves.

Regression identification

The first bad commit is e4f0c5e. Before that commit, the downstream Interface3 job passed with OrdinaryDiffEqNonlinearSolve 2.9.0; after it, the new OrdinaryDiffEqCache guard rejected StochasticDiffEq caches. SciMLBase's PR and master jobs have identical failures and the same solver package versions, so this is not caused by the SciMLBase change under test.

Verification

I reproduced all four failures on clean current SciMLBase master from the StochasticDiffEq test environment:

GROUP=Interface1 julia +1.12 --project=lib/StochasticDiffEq -e 'using Pkg; Pkg.test()'
# Default Solver Tests | 5 pass, 1 error, 6 total
# ArgumentError: nlsolve! ... got ... ISSEMCache

GROUP=Interface2 julia +1.12 --project=lib/StochasticDiffEq -e 'using Pkg; Pkg.test()'
# Basic Tau Leaping Tests | 1 pass, 1 error, 2 total
# ArgumentError: nlsolve! ... got ... ImplicitEMCache

GROUP=Interface3 julia +1.12 --project=lib/StochasticDiffEq -e 'using Pkg; Pkg.test()'
# Events Tests | 9 pass, 1 error, 10 total
# ArgumentError: nlsolve! ... got ... ImplicitEMCache

GROUP=AlgConvergence julia +1.12 --project=lib/StochasticDiffEq -e 'using Pkg; Pkg.test()'
# Convergence Tests | 0 pass, 1 error, 1 total
# ArgumentError: nlsolve! ... got ... ImplicitEMConstantCache

With this commit, the same full groups pass:

Interface1: Default Solver Tests | 8 pass, 8 total
            Testing StochasticDiffEq tests passed
Interface2: Basic Tau Leaping Tests | 15 pass, 15 total
            Testing StochasticDiffEq tests passed
Interface3: Events Tests | 14 pass, 14 total
            Testing StochasticDiffEq tests passed
AlgConvergence: Convergence Tests | 93 pass, 93 total
                Testing StochasticDiffEq tests passed

Additional local checks:

GROUP=QA ... --project=lib/OrdinaryDiffEqNonlinearSolve
JET Tests | 13 pass, 33 broken, 46 total
Aqua      | 41 pass, 41 total
Testing OrdinaryDiffEqNonlinearSolve tests passed

GROUP=QA ... --project=lib/StochasticDiffEq
Testing StochasticDiffEq tests passed

Runic --check --diff .: passed
typos .: passed
git diff --check: passed

The full GROUP=Core OrdinaryDiffEqNonlinearSolve run was also attempted with a one-hour timeout. Developer API, Newton, sparse DAE initialization, linear nonlinear solver, linear solver, and split-ODE testsets passed; the run reached mass_matrix_tests.jl but did not finish before the timeout. I did not run GROUP=Everything, Julia LTS/pre, GPU groups, or docs. Docs were not run because this changes no docs, docstrings, or public API.

Reviewer judgment: accepting every SciMLBase.DECache intentionally uses the shared public cache contract. It preserves the guard against the non-cache third argument that motivated #4352.

Links

🤖 Generated with Claude Code

https://chatgpt.com/codex/tasks/01a03c36-0ac6-7311-82e4-20b12ea6f040

The nonlinear solve helper is shared with StochasticDiffEq, whose integrator caches implement the common public SciMLBase.DECache contract rather than OrdinaryDiffEqCache. Accept that shared contract while retaining the wrong-slot guard.

Co-Authored-By: Chris Rackauckas <[email protected]>

Co-Authored-By: Claude <[email protected]>

Claude-Session: https://chatgpt.com/codex/tasks/01a03c36-0ac6-7311-82e4-20b12ea6f040
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

The separate clean-master NonlinearSolve downgrade failure is fixed by the dependency-floor correction in #4394. The exact locked downgraded Core group passes locally after requiring OrdinaryDiffEqDifferentiation 3.10 and OrdinaryDiffEqSDIRK 2.9. Please merge #4394 first, then rebase this PR and rerun its NonlinearSolve downgrade job. This preserves this PR’s existing 2.9.2 package-version bump and avoids competing version bumps.

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