Repository navigation
Reject multi-block time-dependent SCCNonlinearProblem with a clear error - #5182
ChrisRackauckas-Claude wants to merge 8 commits into
Conversation
|
I think this should just fail |
SCCNonlinearProblem on a compiled algebraic System with an independent variable indexed the parameter tuple out of bounds because the system was never normalized to a time-independent nonlinear system. Fixes SciML#5174. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Codex <noreply@openai.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Agent-Harness: Codex CLI 0.155.1 (patch and tests); Claude Code 2.1.278 (rebase, verification, PR) Agent-Model: gpt-6-astra; claude-fable-5-1 Agent-Session: https://claude.ai/code/session_01VJtEvCkHe9XafoMbYvR9No
Per review, do not silently re-mtkcompile; require mtkcompile(NonlinearSystem(sys)). Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/adopt/SciML_ModelingToolkit.jl-5182/log.txt on amdci2.julia.csail.mit.edu
e1d9987 to
08a73f0
Compare
Single-block time-dependent systems keep falling through to NonlinearProblem as on master. Multi-block gets a clear error (no check_compatibility=false hint); that opt-out converts safely instead. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/adopt/SciML_ModelingToolkit.jl-5182/log.txt on amdci2.julia.csail.mit.edu
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/adopt/SciML_ModelingToolkit.jl-5182/log.txt on amdci2.julia.csail.mit.edu
|
Merge conflicts |
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Devin <noreply@cognition.ai> Agent-Harness: Devin CLI 3000.11.3 (conflict resolution), Claude Code 2.1.285 (orchestration) Agent-Model: fusion-claude-opus-5-5-high-sidekick-swe-2-medium Agent-Session: local Claude session 3c311569-dda6-4687-bc9f-65febb212c33 (fleet master); Devin log /Users/chrisrackauckas/sandbox/master/fusion-fixes/SciML_ModelingToolkit.jl-5182/log.txt # Conflicts: # src/problems/sccnonlinearproblem.jl # test/scc_nonlinear_problem.jl
Merged the default branch into this PR to resolve conflicts (head 3ca6499). Re-review the resolution before merging. Conflict resolution reportSTATUS: RESOLVED Merge of Conflicting files
Runic ( Tests
No Julia processes started by this run are still running. 🤖 Posted by an AI agent — harness: Devin CLI 3000.11.3 (merge), Claude Code 2.1.285 (posting) · model: fusion-claude-opus-5-5-high-sidekick-swe-2-medium |
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Harness: Claude Code 2.1.301 Agent-Model: claude-opus-5-5 Agent-Session: local session ID ec3d0300-24c6-4a77-ba04-c1622ff0e24b (headless claude -p, no URL)
Throw SystemCompatibilityError from ModelingToolkit's own check_compatible_system method for SCCNonlinearProblem instead of adding `suggest_disable`/`msg` keywords to ModelingToolkitBase internals. The released ModelingToolkitBase versions allowed by ModelingToolkit's compat bound lack those keywords, so a release of this branch could have paired with them and thrown a MethodError on the multi-block path. `check_compatibility = false` now skips the check, as it does for every other problem constructor, instead of silently recompiling the system with `mtkcompile(NonlinearSystem(sys))`; the user does that conversion, which is what the error message names. `check_compatibility` is forwarded to `process_SciMLProblem` and the per-block functions, as it was through `kwargs...` before the keyword was captured. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Harness: Claude Code 2.1.301 Agent-Model: claude-opus-5-5 Agent-Session: local session ID ec3d0300-24c6-4a77-ba04-c1622ff0e24b (headless claude -p, no URL)
Fixes #5174.
Multi-block
SCCNonlinearProblemon a compiled algebraicSystemwith anindependent variable previously indexed the parameter tuple out of bounds. Per
review, do not silently rewrite the system: require a time-independent system
(or convert with
mtkcompile(NonlinearSystem(sys))) before the multi-block path.Single-block (and empty) systems still fall through to
NonlinearProblem/HomotopyProblem/LinearProblemas on master, including the silentNonlinearSystemconversion those constructors already perform.The issue #5174 reproducer (two independent blocks,
combine_sccs = false) nowgets a clear
SystemCompatibilityErrornaming the conversion; aftermtkcompile(NonlinearSystem(sys))it solves toy = 3,z = 4.Verification
Regression
test/scc_two_blocks_regression.jl: multi-block timedep throws;single-block timedep returns a successful
NonlinearProblem; converted multi-blocksolves. Full
test/scc_nonlinear_problem.jl:SCC two-blocks | 20/20,SCC_FILE_PASSED. Runic--checkon touched files: clean.Please ignore this draft until reviewed by @ChrisRackauckas.
Adoption update
Rebased onto
origin/master(0459027b88). Addressed @AayushSabharwal by failingcheck_compatibilityinstead of silent rewrite. Follow-up review (Opus 5.5 CHANGES):check_time_independentwithsuggest_disable = falseso the message doesnot advertise
check_compatibility = false(that opt-out now converts viamtkcompile(NonlinearSystem(sys))instead of BoundsError). ExtendedSystemCompatibilityErrorwith an optionalsuggest_disableflag.Fixes #5174remains correct (clear error for the reporter case; working path after conversion).
Fail-before / pass-after (earlier adoption of the error path)
With the multi-block check absent:
12 passed, 2 failed(SystemCompatibilityErrornot thrown). With the check:
14/14, later20/20after adding the single-block test.CI classification (prior PR head vs master)
QA reexports, SciMLBase/NeuralPDE/SciMLSensitivity IntegrationTest, and
downgrade-mtkbase Optimization failures also occur on master
(
0459027b88Tests / IntegrationTest / Downgrade Sublibraries runs). Docs linkcheckwas flaky vs green Documentation on master.
Not verified
GROUP=InterfaceIIviaPkg.testunder a clean depot (SCC file run instead).Risk assessment
Risk assessment and review coordination by 🤖 Claude Code (model: claude-opus-5-5[1m]), https://claude.ai/code/session_01NdFVhANTF4nepTbqYxjfRP
Risk assessment
SCCNonlinearProblemconstruction and shared compatibility errors. Public constructor behavior changes: time-dependent systems are rejected by default;check_compatibility=falserecompiles them. This can qualify as a bug fix, but the description’s “No public API change” needs qualification. No tests were weakened.948c123has 10 failures, all also failing on recentmastercommitsda8e682and0459027; inspected head/latest-master logs show matching failures. Pre-existing:tests / Optimization(Julia 1 and lts),sublibrary-ci / lib/ModelingToolkitBase [Optimization](Julia 1 and lts), anddowngrade-mtkbase (Optimization)—constraint Hessian, AmplNLWriter, and Ipopt failures;tests / QA—unapproved reexports;sublibrary-ci / lib/ModelingToolkitBase [QA]—the same 234 JET diagnostics;SciMLBase.jl/SymbolicIndexingInterface/1/—missing SCCu0;NeuralPDE.jl/NNPDE2/1/—Enzyme activity error;SciMLSensitivity.jl/Core8/1/—matching Enzyme/Mooncake errors. No observed CI test regressions. InterfaceII passes. Comparison runs: Tests, Sublibrary CI, Downgrade Sublibraries, IntegrationTest.check_time_independentand extension of non-publiccheck_compatible_system; unchangedModelingToolkitBase = "1.76"permits released versions lacking the new keywords, implying an unsupported-keyword error—source-level finding, not locally executed; this dependency risk is undisclosed; add regression coverage forcheck_compatibility=falseand document the constructor behavior/SemVer implications).🤖 Risk assessment posted by an AI agent (fleet master) — harness: Codex CLI 0.156.1 / gpt-6-astra; dispatched by Claude Code head, model claude-opus-5-5[1m]
Conversation: local Claude Code session 3cd6500a-1f81-46b5-ac0b-c466e15b6a53 (session ID, no URL)
Agent follow-up
This follow-up commit changes the design described in the sections above. ModelingToolkitBase is no longer touched.
SystemCompatibilityErrorgains nosuggest_disablefield, andcheck_time_independentgains nosuggest_disable/msgkeywords.ModelingToolkitBase = "1.77.1"compat bound allows released ModelingToolkitBase versions that lack those keywords. A ModelingToolkit release could resolve against one of them and throw aMethodErroron the multi-block path. With the change kept inside ModelingToolkit, there is no compat floor to raise.SCCNonlinearProblemrunscheck_compatibility && check_compatible_system(SCCNonlinearProblem, sys). ModelingToolkit's method throwsSystemCompatibilityError("SCCNonlinearProblemwith multiple SCCs requires a time-independent system. Convert it withmtkcompile(NonlinearSystem(sys))first.").check_compatibility = falseskips the check, as it does for every other problem constructor. It no longer recompiles the system silently: the user does the conversion, as @AayushSabharwal asked. The generic "To disable this check…" hint therefore appears again. Disabling the check on a multi-block time-dependent system reaches the same solve-timeBoundsErroras on master. Push back if you would rather keep the automatic conversion on the opt-out path.check_compatibilityis forwarded explicitly toprocess_SciMLProblemand the per-blockSCCNonlinearFunction/LinearFunction. Master forwards it there throughkwargs..., and capturing it as a named keyword had stopped that.master, which brings in Update MTKBase tests and compat floors for Symbolics 7.43-7.45 #5281 (Symbolics 7.43/7.45 test updates). That PR fixes thelib/ModelingToolkitBase [InterfaceI]and[RegressionI]reds on the previous head.Verification (Julia 1.13.2)
test/scc_two_blocks_regression.jlwithsrc/problems/sccnonlinearproblem.jlreverted to master:SCC two-blocks | 17 passed, 3 failed. The 3 failures areerr isa SystemCompatibilityError(Evaluated: nothing isa SystemCompatibilityError), the message check, and thecombine_sccs = true@test_throws.SCC two-blocks | 20 20.GROUP=InterfaceII julia --project -e 'using Pkg; Pkg.test()'on the pushed tree:InterfaceII | 1460 passed, 7 broken (pre-existing), 1467 total, exit 0.--checkandtyposon the changed files: clean.GROUP=QA(no exports, dependencies, or public names changed; the only qualified access,MTKBase.check_compatible_system, is already in the QA ignore list).CI on the previous head (
25383784e5)All 7 reds are pre-existing:
build(Documentation): linkcheck on openmodelica.org. Also fails on master: https://github.com/SciML/ModelingToolkit.jl/actions/runs/38856355754SciMLBase.jl/SymbolicIndexingInterface/1/(3747 passed, 2 errored) andSciMLSensitivity.jl/Core8/1/(MTK Forward Mode,mtk.jl:216): identical on master: https://github.com/SciML/ModelingToolkit.jl/actions/runs/38856355740sublibrary-ci / lib/ModelingToolkitBase [InterfaceI]and[RegressionI](Julia 1 and lts):variable_parsing.jl:66and the latexify reference output, caused by Symbolics 7.43/7.45. Fixed on master by Update MTKBase tests and compat floors for Symbolics 7.43-7.45 #5281, merged here.Risk
SCCNonlinearProblempath for time-dependent systems, which crashed with aBoundsErroron master. Time-independent systems and the single-SCC / empty fallbacks behave as on master.🤖 Posted by an AI agent — harness: Claude Code 2.1.301 · model: claude-opus-5-5
Conversation: local session ID ec3d0300-24c6-4a77-ba04-c1622ff0e24b (headless, no URL)