Skip to content

Fix plot idxs dimension check to use transform output arity - #1609

Merged
ChrisRackauckas merged 3 commits into
SciML:masterfrom
ChrisRackauckas-Claude:fix-plot-mixed-dims
Sep 25, 2026
Merged

ChrisRackauckas merged 3 commits into
SciML:masterfrom
ChrisRackauckas-Claude:fix-plot-mixed-dims

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Summary

The plot recipe asserted length(var) - 1 == dims over normalized idxs specs, conflating each spec's input arity with the plotted output dimension. That rejected legal mixes such as plot(sol, idxs=[3, (f,0,3,4)]) when f(t,a,b)=(t,a+b) (both series are 2-D).

Follow-up (independent review #1): (1) short-label branch also required dims==2, so (adder,0,3,4) was labelled "u[4]" instead of "f(t,u[3],u[4])" — now also requires x[1] === DEFAULT_PLOT_FUNC. (2) probing transforms with integer 1s broke typed/DomainError transforms — deleted probe helpers; dims come from length of each series' evaluated map(f, ...) output, with ArgumentError on a genuine 2-D/3-D mix.

Follow-up (independent review #2): deleted the orphan history comment between DEFAULT_PLOT_FUNC and isdenseplot; trimmed the #360 test preamble to one line.

Same logic on the integrator plot recipe. Related/future: SciMLBase PR #1305 intends to delegate these helpers to RecursiveArrayTools.

Review follow-up: before (new tests on prior PR code)

Expression: labels == ["u[3]", "f(t,u[3],u[4])"]
 Evaluated: ["u[3]", "u[4]"] == ["u[3]", "f(t,u[3],u[4])"]

MethodError: no method matching (::var"#g#g##0")(::Int64, ::Int64)
  @ SciMLBase plot_series_output_dims ...
plot idxs ... (#360) |   13     2      1     16

Review follow-up: after

plot idxs with mixed input arity but matching output dims (#360) |   23     23  10.1s
Solution interface |  107    107  (in GROUP=Core)

Test group tail (GROUP=Core via Pkg.test)

Test Summary:                      | Pass  Total     Time
NonlinearProblem Zygote cotangents |    5      5  ...
Test Summary:                     | Pass  Total  Time
Enzyme inactive solver algorithms |   10     10  3.5s
Test Summary: | Pass  Total     Time
Remake        | 4605   4605  8m27.3s
     Testing SciMLBase tests passed

Not verified

  • Full Plots.jl end-to-end rendering of the original CoupledSprings MWE (tested via diffeq_to_arrays / interpret_vars only).
  • Downstream DifferentialEquations.jl / OrdinaryDiffEq CI.
  • SciMLBaseMakieExt still uses input-arity length(var) locally (pre-existing; out of scope of this follow-up).

What to push back on

  • Removing the dims argument from solplot_vecs_and_labels / integplot_vecs_and_labels (developer interface; dims are now discovered during evaluation).
  • Whether MakieExt should get the same output-dim check in a follow-up.
  • custom transforms (f,0,i) are now labelled f(t,u[i]) instead of u[i]; this is more accurate (e.g. (sq,0,3) plots u3²), but it is a visible label change.

Fixes SciML/DifferentialEquations.jl#360

Please ignore this draft until reviewed by @ChrisRackauckas.

Risk assessment

  • Risk: low
  • Blast radius: the AbstractTimeseriesSolution and integrator plot recipes (solution_interface.jl). The consistency check now uses each series' evaluated output dimension instead of the idxs tuple length. Mixed specs that used to throw AssertionError now plot, and a genuine 2-D/3-D mix throws ArgumentError. One visible change: custom transforms (f,0,i) are labelled f(t,u[i]) instead of u[i]. Internal helpers only; no public API change.
  • Evidence: the new tests fail before (AssertionError) and pass after (23/23). The reporter's example matches the solution to 1e-14. The plotted data for every form that worked before is byte-identical before and after. GROUP=Core passes.
  • Independent review: Claude Code (Opus 5.5), two rounds. The first rated it medium (label bug; probing f with integers broke Float-only transforms) with verdict CHANGES. Both were fixed. The re-review rated it low, fairly confident, verdict MERGE after removing a stray comment, which is now removed.
  • Merge: auto-merge candidate once CI is green. The label change is a visible behaviour change; Chris may want to look at it.

Independent review #2 (Claude Code, Opus 5.5): low risk, MERGE after comment cleanup (done in c9de4de7c).

🤖 Generated with Cursor Agent CLI 2026.09.18-9a7762b (model: auto), transcript /home/crackauc/sandbox/goals/issue-backlog/jobs/fix-SciMLBase-DE360/log.txt on amdci2.julia.csail.mit.edu

Risk assessment and review coordination by 🤖 Claude Code (model: claude-opus-5-5[1m]), https://claude.ai/code/session_01NdFVhANTF4nepTbqYxjfRP

The plot recipe asserted length(var)-1 == dims on normalized idxs
specs, rejecting mixes like [3, (f,0,3,4)] when f returns a 2-tuple
even though both series are 2-D. Check each transform's output length
and throw ArgumentError on genuine mismatches.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor Agent CLI 2026.09.18-9a7762b
Agent-Model: auto
Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/jobs/fix-SciMLBase-DE360/log.txt on amdci2.julia.csail.mit.edu
ChrisRackauckas and others added 2 commits September 23, 2026 11:46
Require DEFAULT_PLOT_FUNC for the short time-series label branch so
custom transforms keep f(...) labels, and take series dims from
evaluated map(f, ...) output instead of probing with integer 1s.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor Agent CLI 2026.09.18-9a7762b
Agent-Model: auto
Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/jobs/fix-SciMLBase-DE360/log.txt on amdci2.julia.csail.mit.edu
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor Agent CLI 2026.09.18-9a7762b
Agent-Model: auto
Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/jobs/fix-SciMLBase-DE360/log.txt on amdci2.julia.csail.mit.edu
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review September 25, 2026 02:17
@ChrisRackauckas
ChrisRackauckas merged commit 9cfd9e6 into SciML:master Sep 25, 2026
64 of 73 checks passed
ChrisRackauckas-Claude pushed a commit to ChrisRackauckas-Claude/SciMLBase.jl that referenced this pull request Sep 25, 2026
Master advanced with two commits affecting the moved recipe code and QA:

- SciML#1609 rewrites the plot idxs dimension check to use each transform's
  output arity (solplot_vecs_and_labels/integplot_vecs_and_labels lose
  their dims argument and assert on output length instead of idxs input
  arity, throwing ArgumentError on genuine mismatches). The core helper
  changes merge cleanly; the integplot_vecs_and_labels side is ported
  into SciMLBaseRecipesBaseExt where that function now lives, keeping
  the SciMLBase.-qualified call style.
- SciML#1608 replaces `Base.Callable` (non-public) with SciMLBase's local
  `Callable` alias, clearing the all_qualified_accesses_are_public QA
  failure seen on Julia 1.11+.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Devin <[email protected]>
Agent-Harness: Devin (SWE-2 Max)
Agent-Model: SWE-2 Max
Agent-Session: /home/crackauc/sandbox/fleet-master-jobs/nw-scimlbase-1092/log.txt
ChrisRackauckas referenced this pull request Sep 26, 2026
Agent-Harness: Claude Code
Agent-Model: claude-opus-5-5[1m]
Agent-Session: local Claude Code session 3cd6500a-1f81-46b5-ac0b-c466e15b6a53 on Chris's Mac (session ID, no URL)

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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.

plotting with vars = [a, (f, a, b)] produces error.

2 participants