Skip to content

Require Symbolics 7.32 for code generation - #4744

Closed
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:agent/fix-codegen-options-downgrade
Closed

Require Symbolics 7.32 for code generation#4744
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:agent/fix-codegen-options-downgrade

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Jul 13, 2026

Copy link
Copy Markdown
Member

This PR should be ignored until reviewed by @ChrisRackauckas.

Summary

  • raise the root and ModelingToolkitBase Symbolics compatibility floor from 7.30 to 7.32
  • add a regression test that constructs an ODEProblem and executes its generated RHS

Root cause

The current code-generation path uses Symbolics.CodegenFunctionOptions and Symbolics.codegen_function. A downgrade environment can still resolve Symbolics 7.30, which predates that API and fails while constructing an ODEProblem with UndefVarError: CodegenFunctionOptions not defined.

Bisecting the exact downgrade reproduction identified 4dc2a7abdfa151e48df2e8062fa1b2eff2417d83 as the first bad commit. Its parent, fd8305b225626c81ee45dfa1b81b8f39dbbbe595, completed the same reproduction with Symbolics 7.30.0.

Dependency status

JuliaSymbolics/Symbolics.jl#1928 has merged and Symbolics 7.32.0 is registered in General, so the compatibility floor now resolves from the registry.

The benchmark computations on Symbolics.jl#1928 completed with ratios near 1 and identical allocations. Its benchmark check failed only when AirspeedVelocity attempted to POST the result comment and received 403 Resource not accessible by integration, which is fork-token infrastructure rather than a benchmark regression.

Local verification

  • Julia 1.12 targeted simple_mtkcompile.jl: 1/1 problem-code-generation check and 4/4 existing observed checks passed
  • Julia 1.10 targeted simple_mtkcompile.jl: 1/1 problem-code-generation check and 4/4 existing observed checks passed
  • GROUP=InterfaceI julia +1.12 --project=lib/ModelingToolkitBase -e 'using Pkg; Pkg.test()' with the local Symbolics 7.32 branch: 1,466 passed, 5 marked broken, 1,471 total in 36m42.5s
  • rebased head with registered Symbolics 7.32.0 in a fresh workspace-local depot: 1,466 passed, 5 marked broken, 1,471 total in 53m01.6s
  • Runic 1.7 checked all 219 tracked Julia files successfully

An earlier root InterfaceI run changed Symbolics source while tests were active and hit the ODESystem test's fixed 180-second subprocess guard (1,402 passed, 1 failed, 3 marked broken). The final stable-source ModelingToolkitBase run above passed that same guard without any test or production-code workaround.

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Local verification for commit a366150 is complete: ModelingToolkitBase InterfaceI passed 1,466 checks with 5 marked broken in 36m42.5s, and Runic 1.7 passed all 219 tracked Julia files. This draft remains blocked on JuliaSymbolics/Symbolics.jl#1928 merging and Symbolics 7.32 being released and registered.

Raise the Symbolics floor to 7.32 and cover ODEProblem code generation so downgrade testing cannot select a release that predates the public low-level code generation API.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
@ChrisRackauckas-Claude
ChrisRackauckas-Claude force-pushed the agent/fix-codegen-options-downgrade branch from a366150 to dd1ed5b Compare July 13, 2026 22:09
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Dependency release and rebase verification for head dd1ed5b:

  • Symbolics 7.32.0 is now registered in General.
  • Rebased the single change commit onto current ModelingToolkit master db56a6a. Immediately before the lease-protected push, the remote feature branch still contained only the previous commit a366150 by this account, upstream had no commits beyond the tested base, and the worktree was clean.
  • Exact released-package test: Julia 1.12.6, fresh workspace-local depot and temp root, GROUP=InterfaceI, Pkg.test(). Resolver selected Symbolics 7.32.0. Exit 0: 1,466 pass, 5 existing broken, 1,471 total in 53m01.6s.
  • Whole-repository Runic 1.7 exit 0; Typos 1.48.0 exit 0; git diff --check exit 0.

Fresh CI is running on the rebased head.

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Fresh CI evidence after the rebase and registered Symbolics 7.32.0 release:

  • Downgrade / InterfaceI: passed in 21m54s with 1456 passed and 3 broken.
  • Julia LTS InterfaceI: passed.

The minimum-compatible job that previously failed on CodegenFunctionOptions now resolves and completes successfully. Current and prerelease InterfaceI jobs are still running.

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

The remaining targeted InterfaceI jobs also completed successfully:

  • Julia current: passed (50m38s).
  • Julia prerelease: passed (49m40s).
  • Julia LTS: passed (27m38s).
  • Minimum-compatible downgrade: passed (21m54s; 1456 pass, 3 broken).

This closes the fresh targeted CI matrix for the Symbolics 7.32 dependency floor.

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Broader fresh-CI classification after the targeted matrix passed:

None of these signatures touches this PRs Symbolics compatibility floor or its InterfaceI regression. The directly relevant downgrade, LTS, current, and prerelease InterfaceI checks all pass.

@AayushSabharwal AayushSabharwal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude got every single line of the diff wrong. Amazing.

Comment on lines +4 to +10
@testset "Problem code generation" begin
@variables x(t)
@mtkcompile sys = System([D(x) ~ 2x + 1], t)
prob = ODEProblem(sys, [x => 1.0], (0.0, 1.0))
@test prob.f(prob.u0, prob.p, 0.0) == [3.0]
end

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@testset "Problem code generation" begin
@variables x(t)
@mtkcompile sys = System([D(x) ~ 2x + 1], t)
prob = ODEProblem(sys, [x => 1.0], (0.0, 1.0))
@test prob.f(prob.u0, prob.p, 0.0) == [3.0]
end

We have a billion tests that create an ODEProblem

SymbolicIndexingInterface = "0.3.39"
SymbolicUtils = "4.35.3"
Symbolics = "7.30"
Symbolics = "7.32"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Symbolics = "7.32"
Symbolics = "7.31"

7.31 added CodegenFunctionOptions, not 7.32

Comment thread Project.toml
SymbolicIndexingInterface = "0.3.46"
SymbolicUtils = "4.31"
Symbolics = "7.30"
Symbolics = "7.32"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Symbolics = "7.32"
Symbolics = "7.31"

@AayushSabharwal

Copy link
Copy Markdown
Member

I folded this into #4751

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.

3 participants