Skip to content

WIP: Pass jump dependency maps to JumpProblem as a JumpDependencies - #5425

Closed
isaacsas wants to merge 1 commit into
SciML:masterfrom
isaacsas:mtkbase/jump-dependencies
Closed

isaacsas wants to merge 1 commit into
SciML:masterfrom
isaacsas:mtkbase/jump-dependencies

Conversation

@isaacsas

Copy link
Copy Markdown
Member

JumpProcesses 10.2 deprecated passing dep_graph, vartojumps_map and jumptovars_map as JumpProblem keywords, in favor of a JumpDependencies passed through the dependencies keyword; the keywords will be removed in JumpProcesses 11. JumpProblem(::System, ...) still passed the keywords, so with deprecation warnings on (as under Pkg.test), every JumpProblem it builds for an aggregator that uses the maps, including the default one, warns. This is what fails the InterfaceII tests on master and on PRs: the @test_nowarn in the "Proper substitution in JumpSysMajParamWrapper" testset of test/jumpsystem.jl sees the deprecation warning.

This PR passes the maps in a JumpDependencies instead, with alias = true since they are built for the problem only, and raises the JumpProcesses lower bound to 10.2, which added JumpDependencies, for ModelingToolkitBase and for ModelingToolkit (whose downgrade tests would otherwise pin JumpProcesses 10.0 against ModelingToolkitBase's 10.2).

One difference: JumpProcesses checks maps passed in a JumpDependencies against the problem (their lengths and indices), which the deprecated keywords skipped.

Tests

Run locally with --depwarn=yes (as under Pkg.test) on Julia 1.13.3 with JumpProcesses 10.2.0, all passing with no remaining deprecation warnings for the keywords: jumpsystem.jl (including the JumpSysMajParamWrapper testset), extend_sde_jump.jl, poissonians.jl, verbosity.jl, despecialized_parameters.jl, parameter_bindings.jl, symbolic_events.jl and initializationsystem.jl, i.e. every ModelingToolkitBase test file that builds a JumpProblem. Also the 12 Catalyst test files that build JumpProblems (several aggregators, hybrid and spatial problems) against this branch, which exercise the new checks of the maps.

🤖 Generated with Claude Code 2.1.328 (model: claude-opus-5-5)

JumpProcesses 10.2 deprecated the `dep_graph`, `vartojumps_map` and
`jumptovars_map` keywords of `JumpProblem` in favor of a `JumpDependencies`
passed through `dependencies`. With deprecation warnings on, the keywords
made the `@test_nowarn` in the `JumpSysMajParamWrapper` testset fail.

Raises the JumpProcesses lower bound to 10.2 (which added
`JumpDependencies`) for ModelingToolkitBase and ModelingToolkit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ChrisRackauckas

Copy link
Copy Markdown
Member

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

PR: #5425

Reviewed head: 307bd40
Raw SHA-256: 98c691c10cbe8266d11e4bad41397ba4a2b2fc8aab62996ed2f033fccbf3c2be
Source SHA-256: 268a466910e5faaa96279a32c5f7f132fff0a596dc86ff5febd4bc819e243e06
Source: standard-review-v1 (harness-log)
Reviewer session: 01a1fbd8-3d86-7731-b194-0e2313b486be
Slot: 1
Confidence: unknown
Own risk fixed before author rating/discussion: yes
Redaction: ran (substitutions=0)

Risk assessment

  • Risk: high (H1)
  • Verdict: CHANGES
  • Reviewed head: 307bd40

Review report

VERDICT: CHANGES
Round: 1
Head: 307bd40
Slot: 1
CI: CI is not green
Session: 01a1fbd8-3d86-7731-b194-0e2313b486be
Reviewer: codex-cli 0.169.0; model: gpt-6.2-astra

Risk

high (H1: the public JumpProblem constructor rejects previously working inputs, including an array-valued state with default aggregator selection).

Blocking findings

  • [P1] lib/ModelingToolkitBase/src/problems/jumpproblem.jl:158 — The variable-to-jumps map has one row per symbolic unknown, but JumpProcesses validates one row per scalar state. With @variables A(t) X(t)[1:2], a single ConstantRateJump(2.0, [A ~ Pre(A) + 1]), and unknowns [A, X], the merge base's default solver advanced [0, 2, 3] to [7, 2, 3]. The head fails during construction with “vartojumps_map has 2 entries, but needs one per variable: the problem has 3 variables.” Explicit NRM() and RSSA() also regressed. Build both dependency maps using the scalar state ordering already available in dvs at line 109. Add a regression that constructs and solves the array model with automatic selection and a map-consuming aggregator.
  • [P2] lib/ModelingToolkitBase/src/problems/jumpproblem.jl:162 — Caller-supplied dependency maps lose their previous field-by-field behavior. On a mixed mass-action and constant-rate model, aggregator=NRM(), dep_graph=[[1,2],[1,2]] solved on the merge base. The head throws that dep_graph was supplied twice. An explicit pair of species maps with RSSA() fails the same way. The documented form also regresses: aggregator=RSSA(), dependencies=JumpDependencies(; dep_graph=[[1,2],[1,2]]) replaces the entire generated bundle, discarding the two species maps RSSA needs. All three calls solved to [2, 8] on the base. Resolve caller-provided maps and generated defaults per field, forward one bundle, and test both keyword forms.
  • Blocking priorities: P1, P2

Non-blocking findings

None.

What I ran

  • Julia 1.13.2 with JumpProcesses pinned to its compat floor, 10.2.0. The head and merge-base scratch manifests differed only in the ModelingToolkitBase source path. The exported name, constructor docstring and dependency manual's API list all include JumpDependencies. Julia's compat parser confirmed the compat bounds in both Project.toml files admit 10.2.0 and exclude 10.1.1 and 11.0.0.
  • julia --startup-file=no --compiled-modules=existing --project="$env" suite.jl ran the unmodified dep_graphs.jl, jumpsystem.jl, poissonians.jl and extend_sde_jump.jl files from lib/ModelingToolkitBase/test in separate safe testsets. Result on the head: 6,354 passed out of 6,354.
  • julia --startup-file=no --compiled-modules=existing --depwarn=yes --project="$env" probe.jl trajectories ran on both revisions. All 30 scalar cases passed on each: mass-action, constant-rate, variable-rate and mixed systems under automatic selection, Direct, NRM, RSSA, RSSACR and Coevolve. The probes checked the active maps against hand-derived dependencies, checked conservation at every saved state and required a jump to occur. cmp found identical aggregator names, maps, times and state trajectories with seed 274. The two blocking findings above were reproduced separately in the same runs.
  • With deprecation reporting enabled, the check for absence of the legacy map warning failed on the base and passed on the head. This was a review probe. git diff origin/master...HEAD showed no added or weakened tests and no added TODO or WIP marker. git diff --check origin/master...HEAD passed.
  • uv run --locked python --version printed Python 3.15.0 and warned that --locked has no effect outside a project. The checkout has no Python project or lockfile.

What I did not verify

The full repository suite, other Julia versions and remote CI were outside the local run. The checkout has no committed Julia manifest or interpreter pin.

AUTHOR_GRADE: {"task":"deps","score":2,"difficulty":3,"rounds":1,"author_harness":"unknown","author_model":"unknown","note":"The documented 10.2 API removes the deprecation and preserves all 30 scalar trajectories tested. Array-valued states and dependency overrides that solved on the base now fail during construction."}

Head link: 307bd40


🤖 Posted by an AI agent — harness: codex-cli 0.169.0 · model: gpt-6.2-astra
Conversation: local session 01a1fbd8-3d86-7731-b194-0e2313b486be (no session URL)

@isaacsas

Copy link
Copy Markdown
Member Author

Closing in favor of #5429, a hotfix that makes JumpProblem reject unscalarized array unknowns and fixes the failing InterfaceII test without raising the JumpProcesses lower bound.

On the review above: the first point, array-valued unknowns, was real, but it predates this PR. Since #5131 (ModelingToolkitBase 1.72.0), the dependency maps of systems with array unknowns have been indexed by unknowns(sys) instead of the flat state, and so silently wrong; the checks of JumpDependencies only exposed it. Jump and event affects have the same problem. #5428 has the details. The second point, dependency maps passed by the caller through JumpProblem(sys, ...), concerns a path that is neither documented nor tested, and is left for later.

🤖 Generated with Claude Code 2.1.328 (model: claude-opus-5-5)

@isaacsas isaacsas closed this Nov 21, 2026
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