fix: pin the unassigned type parameter of the observed dependency graph - #4887
Merged
AayushSabharwal merged 1 commit intoAug 6, 2026
Conversation
`observed_dependency_graph` relied on `Matching(v)` inferring `Unassigned`
as the unassigned type parameter from a `Vector{Union{Unassigned, Int}}`.
BipartiteGraphs v0.1.11 changed that inference to yield
`Matching{Union{Unassigned, Int}}`, which no longer matches the concrete
field type of `ObservedGraphCache` and makes populating the cache throw a
`convert` `MethodError`.
Construct `Matching{Unassigned}` explicitly and share the concrete graph
type between the constructor and the cache field so they cannot drift.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Member
|
Why is the fix here? BipartiteGraphs should revert the breaking change. |
Member
|
The changes aren't technically incorrect and while I'm not particularly sold on the BipartiteGraphs change this PR might as well merge so CI is functional again. |
AayushSabharwal
marked this pull request as ready for review
August 6, 2026 08:33
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.
This PR should be ignored until reviewed by @ChrisRackauckas.
The failure
On unmodified
master,GROUP=InterfaceIerrors:Root cause
observed_dependency_graphbuilds its matching asand relies on
Matching(v)inferringUnassignedas the unassigned type parameter, becauseObservedGraphCachedeclares itsgraphfield with the fully concrete typeDiCMOBiGraph{false, Int, BipartiteGraph{Int, Nothing}, Matching{Unassigned, Vector{Union{Unassigned, Int}}}}.BipartiteGraphs v0.1.11 (registered 2026-08-04) changed that inference. Verified locally on two pinned environments:
The change comes from SciML/BipartiteGraphs.jl@e5bc591, which replaced
with a version that uses the whole eltype as
U. There is noconvertbetween the twoDiCMOBiGraphtypes, so populatingObservedGraphCachethrows. Nothing in ModelingToolkit changed — the repo'sManifest.tomlis untracked, so the regression appeared purely from the dependency resolving to v0.1.11. Tracked upstream as SciML/BipartiteGraphs.jl#54.The fix
Construct
Matching{Unassigned}explicitly instead of depending on inference that is not part of a stable contract, and share the concrete graph type betweenobserved_dependency_graphand theObservedGraphCachefield so the two cannot drift apart again. This works against both v0.1.10 and v0.1.11, so no compat bound change is needed.Reproduction and verification
Minimal reproduction of the underlying bug (fails on
master, passes here):Runs performed locally (Julia 1.11.9, BipartiteGraphs v0.1.11):
lib/ModelingToolkitBase/test/symbolic_events.jlwithout this patch — errors at theNon-Realsymtype parameters in callback with unknowntestset, exactly as CI does.lib/ModelingToolkitBase/test/symbolic_events.jlwith this patch — whole file passes, including that testset.lib/ModelingToolkitBase/test/code_generation.jlwith this patch — passes, including the new regression testset.Note that
code_generation.jl(groupInterfaceII) hits the same code path, so that group is affected too.Regression test
code_generation.jlgets a testset asserting thatobserved_dependency_graph's result is assignable to theObservedGraphCachegraph field and that populating the cache viaobserved_equations_used_bydoes not throw.