From 602baf56e27bc8fe9dab3c48cc3d784a9e193831 Mon Sep 17 00:00:00 2001 From: Sam Isaacson Date: Wed, 18 Mar 2026 13:39:06 -0400 Subject: [PATCH 1/3] mark faulty input tests as broken for MTKBase v1.23+ MTKBase v1.23 changed initialization to use least-squares fallback for underdetermined systems instead of erroring on incomplete u0/parameter inputs. Co-Authored-By: Claude Opus 4.5 --- test/upstream/mtk_problem_inputs.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/upstream/mtk_problem_inputs.jl b/test/upstream/mtk_problem_inputs.jl index 6f16d93445..2fa98962dc 100644 --- a/test/upstream/mtk_problem_inputs.jl +++ b/test/upstream/mtk_problem_inputs.jl @@ -368,7 +368,9 @@ end ### Checks Errors On Faulty Inputs ### # Checks various erroneous problem inputs, ensuring that these throw errors. -let +# Broken: MTKBase v1.23+ uses least-squares fallback for underdetermined initialization +# instead of erroring on incomplete u0/parameter inputs. +@test_broken let # Declares the model. rn = @reaction_network begin (k1,k2), X1 <--> X2 From 633910254d8e5d66e664d4bb1583fd8b21c7db83 Mon Sep 17 00:00:00 2001 From: Sam Isaacson Date: Wed, 18 Mar 2026 15:40:05 -0400 Subject: [PATCH 2/3] remove faulty input tests superseded by MTKBase v1.23+ behavior MTKBase v1.23 changed initialization to use least-squares fallback for underdetermined systems instead of erroring on incomplete u0/parameter inputs. The @test_throws Exception checks are no longer applicable. Co-Authored-By: Claude Opus 4.5 --- test/upstream/mtk_problem_inputs.jl | 71 ++--------------------------- 1 file changed, 3 insertions(+), 68 deletions(-) diff --git a/test/upstream/mtk_problem_inputs.jl b/test/upstream/mtk_problem_inputs.jl index 2fa98962dc..e6addca74d 100644 --- a/test/upstream/mtk_problem_inputs.jl +++ b/test/upstream/mtk_problem_inputs.jl @@ -365,71 +365,6 @@ let end end -### Checks Errors On Faulty Inputs ### - -# Checks various erroneous problem inputs, ensuring that these throw errors. -# Broken: MTKBase v1.23+ uses least-squares fallback for underdetermined initialization -# instead of erroring on incomplete u0/parameter inputs. -@test_broken let - # Declares the model. - rn = @reaction_network begin - (k1,k2), X1 <--> X2 - end - @unpack k1, k2, X1, X2 = rn - - # Declares valid initial conditions and parameter values - u0_valid = [X1 => 1, X2 => 2] - ps_valid = [k1 => 0.5, k2 => 0.1] - - # Declares invalid initial conditions and parameters. Currently, this only includes cases - # where at least one value is missing. Includes vector/Tuple/Dict forms. - u0s_invalid = [ - [X1 => 1], - [rn.X1 => 1], - [:X1 => 1], - SA[X1 => 1], - SA[rn.X1 => 1], - SA[:X1 => 1], - Dict([X1 => 1]), - Dict([rn.X1 => 1]), - Dict([:X1 => 1]), - (X1 => 1), - (rn.X1 => 1), - (:X1 => 1), - ] - ps_invalid = [ - [k1 => 1.0], - [rn.k1 => 1.0], - [:k1 => 1.0], - SA[k1 => 1.0], - SA[rn.k1 => 1.0], - SA[:k1 => 1.0], - Dict([k1 => 1.0]), - Dict([rn.k1 => 1.0]), - Dict([:k1 => 1.0]), - (k1 => 1.0), - (rn.k1 => 1.0), - (:k1 => 1.0), - ] - - # Loops through all potential parameter sets, checking that their inputs yield errors. - for ps in [[ps_valid]; ps_invalid], u0 in [[u0_valid]; u0s_invalid] - # Handles all types of time-dependent systems. The `isequal` is because some case should pass. - for XProblem in [ODEProblem, SDEProblem, JumpProblem] - if isequal(ps, ps_valid) && isequal(u0, u0_valid) - XProblem(rn, u0, (0.0, 1.0), ps) - else - @test_throws Exception XProblem(rn, u0, (0.0, 1.0), ps) - end - end - - # Handles all types of not time-dependent systems. The `isequal` is because some case should pass. - for XProblem in [NonlinearProblem, SteadyStateProblem] - if isequal(ps, ps_valid) && isequal(u0, u0_valid) - XProblem(rn, u0, ps) - else - @test_throws Exception XProblem(rn, u0, ps) - end - end - end -end +# Checks Errors On Faulty Inputs: tests removed. MTKBase v1.23+ uses least-squares +# fallback for underdetermined initialization instead of erroring on incomplete +# u0/parameter inputs, so the @test_throws Exception checks are no longer applicable. From facf38043e0c4c3f6874b5b9871fc4cb08379d43 Mon Sep 17 00:00:00 2001 From: Sam Isaacson Date: Wed, 18 Mar 2026 15:57:35 -0400 Subject: [PATCH 3/3] comment out faulty input tests disabled by MTKBase v1.23+ behavior MTKBase v1.23 changed initialization to use least-squares fallback for underdetermined systems instead of erroring on incomplete u0/parameter inputs. The @test_throws Exception checks are no longer applicable. Co-Authored-By: Claude Opus 4.5 --- test/upstream/mtk_problem_inputs.jl | 71 +++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 3 deletions(-) diff --git a/test/upstream/mtk_problem_inputs.jl b/test/upstream/mtk_problem_inputs.jl index e6addca74d..622e862061 100644 --- a/test/upstream/mtk_problem_inputs.jl +++ b/test/upstream/mtk_problem_inputs.jl @@ -365,6 +365,71 @@ let end end -# Checks Errors On Faulty Inputs: tests removed. MTKBase v1.23+ uses least-squares -# fallback for underdetermined initialization instead of erroring on incomplete -# u0/parameter inputs, so the @test_throws Exception checks are no longer applicable. +### Checks Errors On Faulty Inputs ### + +# Checks various erroneous problem inputs, ensuring that these throw errors. +# Disabled: MTKBase v1.23+ uses least-squares fallback for underdetermined initialization +# instead of erroring on incomplete u0/parameter inputs. +# @test_broken let +# # Declares the model. +# rn = @reaction_network begin +# (k1,k2), X1 <--> X2 +# end +# @unpack k1, k2, X1, X2 = rn +# +# # Declares valid initial conditions and parameter values +# u0_valid = [X1 => 1, X2 => 2] +# ps_valid = [k1 => 0.5, k2 => 0.1] +# +# # Declares invalid initial conditions and parameters. Currently, this only includes cases +# # where at least one value is missing. Includes vector/Tuple/Dict forms. +# u0s_invalid = [ +# [X1 => 1], +# [rn.X1 => 1], +# [:X1 => 1], +# SA[X1 => 1], +# SA[rn.X1 => 1], +# SA[:X1 => 1], +# Dict([X1 => 1]), +# Dict([rn.X1 => 1]), +# Dict([:X1 => 1]), +# (X1 => 1), +# (rn.X1 => 1), +# (:X1 => 1), +# ] +# ps_invalid = [ +# [k1 => 1.0], +# [rn.k1 => 1.0], +# [:k1 => 1.0], +# SA[k1 => 1.0], +# SA[rn.k1 => 1.0], +# SA[:k1 => 1.0], +# Dict([k1 => 1.0]), +# Dict([rn.k1 => 1.0]), +# Dict([:k1 => 1.0]), +# (k1 => 1.0), +# (rn.k1 => 1.0), +# (:k1 => 1.0), +# ] +# +# # Loops through all potential parameter sets, checking that their inputs yield errors. +# for ps in [[ps_valid]; ps_invalid], u0 in [[u0_valid]; u0s_invalid] +# # Handles all types of time-dependent systems. The `isequal` is because some case should pass. +# for XProblem in [ODEProblem, SDEProblem, JumpProblem] +# if isequal(ps, ps_valid) && isequal(u0, u0_valid) +# XProblem(rn, u0, (0.0, 1.0), ps) +# else +# @test_throws Exception XProblem(rn, u0, (0.0, 1.0), ps) +# end +# end +# +# # Handles all types of not time-dependent systems. The `isequal` is because some case should pass. +# for XProblem in [NonlinearProblem, SteadyStateProblem] +# if isequal(ps, ps_valid) && isequal(u0, u0_valid) +# XProblem(rn, u0, ps) +# else +# @test_throws Exception XProblem(rn, u0, ps) +# end +# end +# end +# end