Skip to content

fix: array variable defaults in variable_parsing for Symbolics#2041 - #5247

Closed
ChrisRackauckas-Claude wants to merge 4 commits into
SciML:masterfrom
ChrisRackauckas-Claude:agent/0-symbolics-2041-array-defaults
Closed

ChrisRackauckas-Claude wants to merge 4 commits into
SciML:masterfrom
ChrisRackauckas-Claude:agent/0-symbolics-2041-array-defaults

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Please ignore until reviewed by @ChrisRackauckas.

Symbolics.jl master merged JuliaSymbolics/Symbolics.jl#2041 (fixes #1073): a scalar @variables x = [1, 2] now throws ArgumentError. Update lib/ModelingToolkitBase/test/variable_parsing.jl to declare array variables (x[1:2] = [1, 2]) in both the begin-block and one-line forms, and assert defaults with the public ModelingToolkitBase.getdefault so the same connect/unit metadata is still covered. Repo grep of lib/*/test, lib/*/src, src, test, and docs found no other live scalar-with-array-default declarations to change (only intentional docs/NEWS mentions of the invalid form in docs/src/basics/FAQ.md and NEWS.md).

Follow-up after independent review (Codex gpt-6-astra, VERDICT CHANGES): the first revision used non-public Symbolics.getdefaultval (Base.ispublic(Symbolics, :getdefaultval) == false). Both assertions now use public ModelingToolkitBase.getdefault (Base.ispublic(...) == true).

Other scalar-with-array-default hits (not changed)

  • docs/src/basics/FAQ.md:50 — documents that @parameters p = [1, 2, 3] errors
  • NEWS.md:518 — documents the v9 breaking change for array-valued parameters

Verification

Before (Symbolics master, unfixed test file)

export TMPDIR=.../jobs/0-cursor/tmp
export JULIA_DEPOT_PATH=.../scratch/depot:$HOME/.julia
julia +1.12 --project=.../scratch/env-symbolics-master -e '
using Symbolics
include("lib/ModelingToolkitBase/test/variable_parsing.jl")'

Tail:

ERROR: LoadError: ArgumentError: Variable x must have default of matching size. Got [1, 2] with size (2,).
...
in expression starting at .../variable_parsing.jl:66

After (Symbolics master, fixed; head includes getdefault)

julia +1.12 --project=.../scratch/env-symbolics-master -e '
using Symbolics, ModelingToolkitBase
println("ispublic Symbolics.getdefaultval=", Base.ispublic(Symbolics, :getdefaultval))
println("ispublic ModelingToolkitBase.getdefault=", Base.ispublic(ModelingToolkitBase, :getdefault))
include("lib/ModelingToolkitBase/test/variable_parsing.jl")
println("AFTER_MASTER_OK")'

Tail:

Symbolics path=.../scratch/Symbolics.jl/src/Symbolics.jl
ispublic Symbolics.getdefaultval=false
ispublic ModelingToolkitBase.getdefault=true
Test Summary:                  | Pass  Total  Time
Parameters cannot be dependent |    2      2  0.4s
AFTER_MASTER_OK

After (registered Symbolics 7.42.0 from General, fixed)

julia +1.12 --project=.../scratch/env-symbolics-release -e '
using Symbolics, ModelingToolkitBase
include("lib/ModelingToolkitBase/test/variable_parsing.jl")
println("AFTER_RELEASE_OK")'

Tail:

Symbolics path=~/.julia/packages/Symbolics/JBOvO/src/Symbolics.jl
ispublic Symbolics.getdefaultval=false
ispublic ModelingToolkitBase.getdefault=true
Test Summary:                  | Pass  Total  Time
Parameters cannot be dependent |    2      2  0.3s
AFTER_RELEASE_OK

Also confirmed registered release still accepts the old scalar form (REGISTERED_ACCEPTS_SCALAR_ARRAY_DEFAULT=true), while master rejects it.

typos clean on the changed file; Julia Runic.main(["--check", ...]) exit 0. QA group / full ModelingToolkitBase suite was not attempted (single-file test only, per job brief).

Not verified

  • Full ModelingToolkitBase / ModelingToolkit test suites (including QA / InterfaceI groups)
  • Docs build
  • Downstream packages (ModelingToolkitStandardLibrary, etc.)
  • CI checks on this PR

Reviewer pushback

  • Whether FAQ/NEWS examples of the invalid form should gain a forward pointer to Symbolics#2041.

Risk assessment

  • Risk: low. Test-only change; no production code.
  • Blast radius: two declaration lines and two default assertions in lib/ModelingToolkitBase/test/variable_parsing.jl.
  • Evidence: fails on Symbolics master before the declaration change; passes after on master and registered Symbolics; public-API probe confirms getdefault / rejects getdefaultval.
  • Independent review: Codex gpt-6-astra returned CHANGES (blocking: use public ModelingToolkitBase.getdefault instead of Symbolics.getdefaultval). Addressed in follow-up commit; no functional defect found otherwise.
  • Merge: needs human review by @ChrisRackauckas.

Please ignore this draft until reviewed by @ChrisRackauckas.

Risk assessment

  • Risk: low (tests only)
  • Blast radius: lib/ModelingToolkitBase/test/variable_parsing.jl. It declares array variables (x[1:2] = [1, 2]) where the test gave a scalar an array default, which Symbolics master now rejects (Reject scalar @variables with array-shaped defaults JuliaSymbolics/Symbolics.jl#2041). The assertions check the same connect, unit and default metadata through the public ModelingToolkitBase.getdefault. No other scalar-with-array-default declarations remain in lib/*/test or src.
  • Evidence: the file fails on Symbolics master before the change (ArgumentError). After the change it passes on Symbolics master and on the registered Symbolics release.
  • Independent review: Codex CLI (gpt-6-astra). Round 1 came back CHANGES: the test used the non-public Symbolics.getdefaultval. Round 2 came back verdict MERGE.
  • Merge: auto-merge candidate (tests only; works with both the current and the next Symbolics). Chris's call.

Harness: Cursor Agent CLI 2026.10.01-14929f9; model: auto; transcript: /home/crackauc/sandbox/agent-jobs/MTK-ibsym/jobs/0-cursor/log.txt on amdci2.julia.csail.mit.edu
Risk assessment and independent review added by the ib-sym head: 🤖 Claude Code (model: claude-opus-5-5[1m]), https://claude.ai/code/session_01BcEMkaeynVZ6Ghq3UUibh7

ChrisRackauckas and others added 3 commits October 2, 2026 16:15
Scalar `@variables x = [1, 2]` now throws ArgumentError on Symbolics master;
use `x[1:2] = [1, 2]` and assert defaults via getdefaultval.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor Agent CLI 2026.10.01-14929f9
Agent-Model: auto
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/MTK-ibsym/jobs/0-cursor/log.txt on amdci2.julia.csail.mit.edu
Symbolics.getdefaultval is not public (Base.ispublic false); use
ModelingToolkitBase.getdefault which is public and already used in this file.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor Agent CLI 2026.10.01-14929f9
Agent-Model: auto
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/MTK-ibsym/jobs/0-cursor/log.txt on amdci2.julia.csail.mit.edu
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Devin <[email protected]>
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-5247/log.txt
@ChrisRackauckas

Copy link
Copy Markdown
Member

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

Merged the default branch into this PR (clean merge, no conflicts; head 7ca02fe) so CI runs on current master.


🤖 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
Conversation: local Claude session 3c311569-dda6-4687-bc9f-65febb212c33 (fleet master)

@ChrisRackauckas

Copy link
Copy Markdown
Member

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

Closing as superseded by #5281 (merged), which includes this change. variable_parsing.jl on master now has the same blob as this PR's head (52975d9).


🤖 Posted by an AI agent — harness: Claude Code 2.1.301 · model: claude-opus-5-5
Conversation: https://claude.ai/code/session_01VZjwf7Ux9YtTzwHGHMqnsq

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.

Error on violation of default type

2 participants