Repository navigation
Conversation
Since SciML#5131 (ModelingToolkitBase 1.72.0) a `complete`d system may have unscalarized array unknowns, but the jump dependency maps and the compiled jump affects index the state by position in `unknowns(sys)` instead of the flat state, which gave silently wrong results (SciML#5428). As a hotfix, `JumpProblem` rejects such systems again, as before 1.72.0. Jump rates are now scalarized before their dependencies are collected, so a rate using an array as a whole, e.g. `sum(X)`, depends on its scalarized elements. The `@test_nowarn` in "Proper substitution in `JumpSysMajParamWrapper`", which caught JumpProcesses 10.2's deprecation warning for the dependency map keywords, is replaced with a check of the substituted rate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR: #5429 Reviewed head: 2052975 Risk assessment
Review reportVERDICT: CHANGES Riskhigh (H1: the public constructor now rejects an array-state model that solved correctly on the base) Blocking findings
Non-blocking findings
What I ran
What I did not verify
AUTHOR_GRADE: {"task":"bugfix","score":3,"difficulty":3,"rounds":1,"author_harness":"unknown","author_model":"unknown","note":"The new testset discriminates both failure modes and the guard stops a reproduced wrong state write. The guard also rejects a correct mass-action model and the test replacement drops a warning assertion while the warning persists."} Head link: 2052975 🤖 Posted by an AI agent — harness: codex-cli 0.170.0 · model: gpt-6.2-sol |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
On the points of the automated review above:
🤖 Generated with Claude Code 2.1.328 (model: claude-opus-5-5) |
JumpProblem, which gave silently incorrect resultsJumpProblem, which gave silently incorrect results
Scalarizing the whole rate also expanded array parameters, so a rate such as `p[i] * A` with a parameter index `i` failed to build. Go back to master's dependency collection; the test's constant rate jump now names both elements of `X`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JumpProblem, which gave silently incorrect resultsJumpProblem, which gave silently incorrect results
…ment A rate such as `sum(X)` gets no dependency on the scalarized elements of `X`, so it could still give stale rates with NRM after the suggested scalarization. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR: #5429 Reviewed head: 9c90bc4 Risk assessment
Review reportVERDICT: CHANGES Riskhigh (H1: the public JumpProblem constructor rejects a previously working array-state model) Blocking findings
Non-blocking findings
What I ran
What I did not verify
AUTHOR_GRADE: {"task": "bugfix", "score": 2, "difficulty": 3, "rounds": 2, "author_harness": "unknown", "author_model": "unknown", "note": "The new tests exercise the rejection guard and explicit-element graphs. A working Direct input is rejected and the round-two delta restores a stale NRM whole-array rate."} Head link: 9c90bc4 🤖 Posted by an AI agent — harness: codex-cli 0.170.0 · model: gpt-6.2-sol |
#5131 (ModelingToolkitBase 1.72.0, September) allowed unscalarized array unknowns in
completed systems for every problem type, but did not update or test the jump handling for that case. Since then,JumpProblems of systems with an array unknown have given silently incorrect results whenever the array comes before other unknowns: the jump dependency maps are indexed by position inunknowns(sys)instead of in the flat state, so aggregators that use them, such asNRMandSortingDirect, miss rate updates, and jump affects on an unknown after the array change the wrong state entry, even withDirect.As a hotfix,
JumpProblemnow rejects systems with unscalarized array unknowns, as every problem constructor did before 1.72.0. The error message suggests scalarizing them when building the system, for example by passing[A; collect(X)]instead of[A, X]as the unknowns (mtkcompilekeeps the array unknowns of a pure jump system, so it doesn't help there), and writing any use of a whole array in a jump rate or affect in terms of its elements, such asX[1] + X[2]forsum(X): a rate usingsum(X)gets no dependency on the scalarized elements, so it could still give stale rates (#5428). The check runs even withcheck_compatibility = false, since it guards against wrong results. Systems it accepts are handled exactly as on master.It also replaces the
@test_nowarnin the testset "Proper substitution inJumpSysMajParamWrapper" with a check of the mass action rate the substitution gives (exp(p)). The@test_nowarnfails the InterfaceII tests on master:JumpProblem(::System, ...)passes thedep_graph,vartojumps_mapandjumptovars_mapkeywords, which JumpProcesses 10.2 deprecates, and the deprecation warning trips it. It came with a fix to the then-symbolic substitution of mass action rates (ae72b4a), which made building the problem fail; the rates are now compiled, so warnings no longer say anything about it. JumpProcesses compat stays at"10", and moving toJumpDependenciesis left for later.Other parts are still broken and need more work; #5428 has the details and reproducers. In particular, event affects and conditions give wrong results in
completed systems with array unknowns, also without jumps, and some jump rates get no dependencies, such as rates using an array as a whole (sum(X)) or an observed variable. Supporting array unknowns in jump systems, which would let this check go, is also left for the follow-up there.Supersedes #5425.
Tests
The new testset checks that
JumpProblemrejects a pure jump system and a hybrid system with an array unknown, also withcheck_compatibility = false. With the unknowns scalarized, it checks over three runs per aggregator (the default,Direct,NRM,SortingDirect,RDirect,DirectCR,CCNRM,RSSA,RSSACRandCoevolve) that when two mass action jumps compete for the singleX[2], the losing jump's rate and that of a constant rate jump with ratek * (X[1] + X[2])drop to zero. A second new testset checks the three dependency maps directly against hand-derived ones for array unknowns scalarized by hand, with elements of a vector and of a matrix before and after a scalar unknown.jumpsystem.jlpasses locally on Julia 1.13.3 with JumpProcesses 10.2.0 and--depwarn=yes(as underPkg.test).🤖 Generated with Claude Code 2.1.328 (model: claude-opus-5-5)