fix: add missing OrderedSet/unwrap imports in CasADi/Pyomo dynamic-opt exts#4512
Merged
ChrisRackauckas merged 1 commit intoMay 9, 2026
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
__init__workaround added in 4888437 to fix a Julia 1.10 method invalidation bug callsOrderedSet{SymbolicT}()andunwrap(...), but neither name is imported inMTKCasADiDynamicOptExtorMTKPyomoDynamicOptExt. As a result, on Julia 1.10/LTS the extensions fail to load with:This breaks the LTS
Tests (lts, ModelingToolkit/Extensions)job — visible failure is theRocket launchtest intest/extensions/dynamic_optimization.jl:320. The siblingMTKInfiniteOptExtalready has the properusing OrderedCollections: OrderedSetandusing Symbolics: unwrap, so it loads fine. Mirror those imports.Changes
lib/ModelingToolkitBase/ext/MTKCasADiDynamicOptExt.jl: addusing OrderedCollections: OrderedSetandusing 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.OrderedCollectionsis already a direct[deps]ofModelingToolkitBase(noProject.tomlchange required).Notes
This is one fix; master CI is also failing for several other reasons unrelated to this PR (BVP cost-function
DimensionMismatchinbvproblem.jl:334/357,index_cache.jl:171gradients with special DiffCache paramsinference failure, Aqua piracy/stale-deps regressions inModelingToolkitBase/QA, plus a missinggccon thedeepsea3-19self-hosted runner causing theC Compilation Testto fail inTests (1, ModelingToolkitBase/Extended)). Each is a separate concern; I'll file an issue tracking them.Test plan
Tests (lts, ModelingToolkit/Extensions)job that previously failed loadingMTKCasADiDynamicOptExt.🤖 Generated with Claude Code