Skip to content

Reject remake(prob; p) on steady problems instead of ignoring it - #55

Merged
xtalax merged 3 commits into
masterfrom
fix/remake-p
Nov 5, 2026
Merged

xtalax merged 3 commits into
masterfrom
fix/remake-p

Conversation

@xtalax-droid

Copy link
Copy Markdown
Collaborator

remake(prob; p = ...) on a steady problem was silently ignored: _steady_problem built the NonlinearProblem with NullParameters() and the residual and Jacobian never looked at p, so remake(prob; p = [3.0]) solved the original problem, although docs/src/extension_contract.md says solve rejects it. The pair form remake(prob; p = [D => 2.0]) crashed with ArgumentError: no applicable remake_buffer method for buffer type NullParameters. The transient DAEProblem path already rejected both forms correctly (assembled_parameter_check in src/numeric_dae.jl), so only the steady path is fixed. The stack overflow and segfault Codex once reported for [k => 3.0] does not reproduce on current master.

Case Steady before Steady after Transient (before and after)
remake(prob; u0 = ...) solves solves solves
p = [2.0] (unchanged) solves solves solves
p = [3.0] solves the original problem silently ArgumentError: parameter D was 2.0 when the operators were assembled but is 3.0 ... already throws
p = [D => 2.0] (unchanged) crashes (remake_buffer on NullParameters) solves solves
p = [D => 3.0] same crash ArgumentError: parameter D was 2.0 ... already throws

The fix: _steady_problem now carries the assembled parameter values as p (still NullParameters when there are none), and the residual and Jacobian check p against them. A small SteadyParameters struct attached as the NonlinearFunction's sys lets the pair form resolve to its slot in p, implementing the SymbolicIndexingInterface methods the remake path calls. The error message now lives in one function, check_assembled_values in src/numeric_dae.jl, shared by both paths. No reassembly is attempted. Codex found that p shared the vector the check compares against, so prob.p[1] = 3.0 silently changed the reference; p is now a copy, with a test that fails without the copy.

Tests (test/shared/frontend_tests/remake_p.jl, registered by test/Frontend/remake_p.jl, 16 tests) cover steady and transient for an unchanged p, a numeric p, a symbolic pair, and editing prob.p in place. Against master's source the steady [3.0] case did not throw and the pair form raised the NullParameters error. Local results on Julia 1.12.1: Runic 1.13 clean; Frontend, Core, QA, Solution, DAE and Integration pass (the group runs were on the first commit; the second commit changes one line and adds the in-place test, rerun for that file and Runic); Codex approved. CI is currently billing-blocked. This should land before any release. Risk: SteadyParameters implements SymbolicIndexingInterface methods by hand; if SciMLBase's remake path starts calling another method it fails loudly rather than silently.


🤖 Posted by an AI agent · harness: Claude Code 2.1.312 · model: claude-sonnet-5-5
Review: unreviewed
Session: 43e03fde-3384-4386-bae9-03e81f19ba7c

t and others added 2 commits November 3, 2026 23:49
The steady NonlinearProblem carried NullParameters and its residual and Jacobian ignored p, so remake(prob; p = [3.0]) solved the original problem and remake(prob; p = [k => 3.0]) left p unchanged or failed in SymbolicIndexingInterface. The problem now carries the assembled parameter values, a symbolic container resolves the keys of the pair form, and the residual and Jacobian throw the same ArgumentError as the DAE path. The DAE path already rejected both forms; the new test covers both.

Agent-Harness: Claude Code 2.1.312
Agent-Model: claude-sonnet-5-5
Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c
Agent-Review: unreviewed
Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Codex finding: the steady problem's p was the vector the check compares against, so editing prob.p in place changed the reference. p is now a copy, with a regression test.

Agent-Harness: Claude Code 2.1.312
Agent-Model: claude-sonnet-5-5
Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c
Agent-Review: unreviewed
Co-authored-by: Claude Code <agent@noreply.juliahub.com>
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark Results (Julia v1)

Time benchmarks
master ef166ad... master / ef166ad...
construction/heat P1 10x10 7.16 ± 0.32 ms 7.68 ± 0.82 ms 0.932 ± 0.11
construction/heat P1 20x20 9.74 ± 0.19 ms 10.4 ± 1.1 ms 0.937 ± 0.098
time_to_load 5.55 ± 0.03 s 5.65 ± 0.041 s 0.983 ± 0.0089
Memory benchmarks
master ef166ad... master / ef166ad...
construction/heat P1 10x10 0.0375 M allocs: 2.01 MB 0.0375 M allocs: 2.01 MB 1
construction/heat P1 20x20 0.0624 M allocs: 4.31 MB 0.0624 M allocs: 4.31 MB 1
time_to_load 0.2 k allocs: 11.8 kB 0.2 k allocs: 11.8 kB 1

Agent-Harness: Claude Code 2.1.312
Agent-Model: claude-sonnet-5-5
Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c
Agent-Review: unreviewed
Co-authored-by: Claude Code <agent@noreply.juliahub.com>
@xtalax
xtalax merged commit bf2e2e5 into master Nov 5, 2026
45 checks passed
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