Skip to content

fix: add missing OrderedSet/unwrap imports in CasADi/Pyomo dynamic-opt exts#4512

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:fix-orderedset-import-dynamicopt-exts
May 9, 2026
Merged

fix: add missing OrderedSet/unwrap imports in CasADi/Pyomo dynamic-opt exts#4512
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:fix-orderedset-import-dynamicopt-exts

Conversation

@ChrisRackauckas-Claude
Copy link
Copy Markdown

Summary

The __init__ workaround added in 4888437 to fix a Julia 1.10 method invalidation bug calls OrderedSet{SymbolicT}() and unwrap(...), but neither name is imported in MTKCasADiDynamicOptExt or MTKPyomoDynamicOptExt. As a result, on Julia 1.10/LTS the extensions fail to load with:

InitError: UndefVarError: `OrderedSet` not defined

This breaks the LTS Tests (lts, ModelingToolkit/Extensions) job — visible failure is the Rocket launch test in test/extensions/dynamic_optimization.jl:320. The sibling MTKInfiniteOptExt already has the proper using OrderedCollections: OrderedSet and using Symbolics: unwrap, so it loads fine. Mirror those imports.

Changes

  • lib/ModelingToolkitBase/ext/MTKCasADiDynamicOptExt.jl: add using OrderedCollections: OrderedSet and using Symbolics: SymbolicT, unwrap.
  • lib/ModelingToolkitBase/ext/MTKPyomoDynamicOptExt.jl: same.

Verification

Reproduced locally on Julia 1.10.11 against this branch: _force_collect_var_compilation() now executes successfully. OrderedCollections is already a direct [deps] of ModelingToolkitBase (no Project.toml change required).

Notes

Please ignore until reviewed by @ChrisRackauckas.

This is one fix; master CI is also failing for several other reasons unrelated to this PR (BVP cost-function DimensionMismatch in bvproblem.jl:334/357, index_cache.jl:171 gradients with special DiffCache params inference failure, Aqua piracy/stale-deps regressions in ModelingToolkitBase/QA, plus a missing gcc on the deepsea3-19 self-hosted runner causing the C Compilation Test to fail in Tests (1, ModelingToolkitBase/Extended)). Each is a separate concern; I'll file an issue tracking them.

Test plan

  • CI passes the Tests (lts, ModelingToolkit/Extensions) job that previously failed loading MTKCasADiDynamicOptExt.

🤖 Generated with Claude Code

…t exts

The `__init__` workaround added in 4888437 to fix a Julia 1.10 method
invalidation bug calls `OrderedSet{SymbolicT}()` and `unwrap(...)`, but
neither name is imported in `MTKCasADiDynamicOptExt` or
`MTKPyomoDynamicOptExt`. This causes the extensions to fail to load on
Julia 1.10 with `UndefVarError: OrderedSet not defined`, breaking the
LTS Extensions test job (`Rocket launch` test in
`test/extensions/dynamic_optimization.jl` is the visible failure).

`MTKInfiniteOptExt` had the same workaround but with the proper
`using OrderedCollections: OrderedSet` and `using Symbolics: unwrap`
imports, so it loads fine. Mirror those imports here.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
@ChrisRackauckas ChrisRackauckas marked this pull request as ready for review May 9, 2026 11:26
@ChrisRackauckas ChrisRackauckas merged commit 5978e09 into SciML:master May 9, 2026
59 of 79 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