Skip to content

Fix stochastic JumpProblem initialization dispatch - #4419

Closed
ChrisRackauckas-Claude wants to merge 0 commit into
SciML:masterfrom
ChrisRackauckas-Claude:fix/jumpprocess-stochastic-dispatch
Closed

ChrisRackauckas-Claude wants to merge 0 commit into
SciML:masterfrom
ChrisRackauckas-Claude:fix/jumpprocess-stochastic-dispatch

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

Please ignore this PR until it has been reviewed by @ChrisRackauckas.

What changed and why

JumpProcesses 9.30.1 made its JumpProblem __init overload more specific. That overload then won dispatch for StochasticDiffEq jump algorithms: tau-leaping fell through to the OrdinaryDiffEq cache path, while stochastic solve merged problem callbacks once and the JumpProcesses overload merged them a second time.

This change gives stochastic jump algorithms a JumpProblem-specific __init method and routes their __solve method directly through _sde_init after the one intended keyword merge. It also extends the tau-leaping test to exercise init, step!, and the solve return code. The existing callback-forwarding test covers the duplicate-merge regression.

Regression evidence

Both failures reproduced on a separate clean worktree at OrdinaryDiffEq commit 57dc0b95e30386a9a1b32f83df8f61309721ca67, Julia 1.12.7, and JumpProcesses 9.30.1.

Before this fix:

$ GROUP=Interface1 julia +1.12.7 --startup-file=no --project=lib/StochasticDiffEq -e 'using Pkg; Pkg.test()'
callback from JumpProblem.kwargs fires exactly once
  Evaluated: 2 == 1
merged callbacks each fire exactly once
  Evaluated: 2 == 1
JumpProblem kwarg forwarding Tests | 28 passed, 2 failed, 30 total
ERROR: Some tests did not pass
$ GROUP=Interface2 julia +1.12.7 --startup-file=no --project=lib/StochasticDiffEq -e 'using Pkg; Pkg.test()'
LoadError: MethodError: no method matching alg_cache(::StochasticDiffEqLeaping.TauLeaping{Rational{Int64}}, ...)
Basic Tau Leaping Tests | 1 error, 1 total
ERROR: Package StochasticDiffEq errored during testing

After this fix on rebased commit ed84b3f63e5f7a42b509ae979ce3def8b5f3a875:

$ GROUP=Interface1 julia +1.12.7 --startup-file=no --project=lib/StochasticDiffEq -e 'using Pkg; Pkg.test()'
JumpProblem kwarg forwarding Tests | 30 passed, 30 total
Solver Reversal Tests              | 152 passed, 152 total
Testing StochasticDiffEq tests passed
$ GROUP=Interface2 julia +1.12.7 --startup-file=no --project=lib/StochasticDiffEq -e 'using Pkg; Pkg.test()'
Basic Tau Leaping Tests                       | 18 passed, 18 total
Inplace RODESolution Interpolation Tests      | 11 passed, 11 total
Testing StochasticDiffEq tests passed

Introducing commit

The release boundary is exact: JumpProcesses v9.30.0 is commit 5083791111f57826d95a087dfdb570739d2f8a4a, and that same commit is the parent of the first bad commit. With v9.30.0, the callback-forwarding test passed 30/30 and the tau-leaping test passed 15/15. The next commit, 111b04e62a4391efa6e4d393cde7c6ea33c5be89, split the extension's broad AbstractJumpProblem initializer into concrete JumpProblem methods; v9.30.1 then reproduced both failures.

Verification

$ GROUP=QA julia +1.12.7 --startup-file=no --project -e 'using Pkg; Pkg.test()'
Quality Assurance Tests | 106 passed, 106 total
Testing OrdinaryDiffEq tests passed

$ GROUP=QA julia +1.12.7 --startup-file=no --project=lib/StochasticDiffEq -e 'using Pkg; Pkg.test()'
Testing StochasticDiffEq tests passed

$ GROUP=QA julia +1.12.7 --startup-file=no --project=lib/StochasticDiffEqCore -e 'using Pkg; Pkg.test()'
QA (Aqua and JET) | 21 passed, 21 total
Testing StochasticDiffEqCore tests passed
$ julia +1.12.7 --startup-file=no --project=.validation/runic-env -m Runic --check lib/StochasticDiffEqCore/src/solve.jl lib/StochasticDiffEq/test/tau_leaping.jl
# no output; exit 0

$ typos lib/StochasticDiffEqCore/src/solve.jl lib/StochasticDiffEq/test/tau_leaping.jl
# no output; exit 0

$ julia +1.12.7 --startup-file=no --project=docs docs/make.jl
Documenter completed all build phases; exit 0

I did not run GROUP=Everything, GPU, downstream, Julia pre, or alternate Julia-version jobs locally.

Links

🤖 Generated with Claude Code
https://chatgpt.com/codex/tasks/01a03caf-aae8-74c3-9a79-53b836434858

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.

1 participant