Repository navigation
fix: array variable defaults in variable_parsing for Symbolics#2041 - #5247
ChrisRackauckas-Claude wants to merge 4 commits into
Conversation
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
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 |
Closing as superseded by #5281 (merged), which includes this change. 🤖 Posted by an AI agent — harness: Claude Code 2.1.301 · model: claude-opus-5-5 |
Please ignore until reviewed by @ChrisRackauckas.
Symbolics.jl master merged JuliaSymbolics/Symbolics.jl#2041 (fixes #1073): a scalar
@variables x = [1, 2]now throwsArgumentError. Updatelib/ModelingToolkitBase/test/variable_parsing.jlto declare array variables (x[1:2] = [1, 2]) in both the begin-block and one-line forms, and assert defaults with the publicModelingToolkitBase.getdefaultso the same connect/unit metadata is still covered. Repo grep oflib/*/test,lib/*/src,src,test, anddocsfound no other live scalar-with-array-default declarations to change (only intentional docs/NEWS mentions of the invalid form indocs/src/basics/FAQ.mdandNEWS.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 publicModelingToolkitBase.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]errorsNEWS.md:518— documents the v9 breaking change for array-valued parametersVerification
Before (Symbolics master, unfixed test file)
Tail:
After (Symbolics master, fixed; head includes getdefault)
Tail:
After (registered Symbolics 7.42.0 from General, fixed)
Tail:
Also confirmed registered release still accepts the old scalar form (
REGISTERED_ACCEPTS_SCALAR_ARRAY_DEFAULT=true), while master rejects it.typosclean on the changed file; JuliaRunic.main(["--check", ...])exit 0. QA group / full ModelingToolkitBase suite was not attempted (single-file test only, per job brief).Not verified
Reviewer pushback
Risk assessment
lib/ModelingToolkitBase/test/variable_parsing.jl.getdefault/ rejectsgetdefaultval.ModelingToolkitBase.getdefaultinstead ofSymbolics.getdefaultval). Addressed in follow-up commit; no functional defect found otherwise.Please ignore this draft until reviewed by @ChrisRackauckas.
Risk assessment
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 publicModelingToolkitBase.getdefault. No other scalar-with-array-default declarations remain inlib/*/testorsrc.ArgumentError). After the change it passes on Symbolics master and on the registered Symbolics release.Symbolics.getdefaultval. Round 2 came back verdict MERGE.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