Repository navigation
Fix unit validation MethodError on causal variable connect - #5233
Merged
AayushSabharwal merged 2 commits intoOct 6, 2026
Merged
AayushSabharwal merged 2 commits into
AayushSabharwal merged 2 commits into
Conversation
_validate(conn::Connection) assumed get_systems returned systems and called
unknowns; bare-variable connect stores Vector{SymbolicT}, so compare units
on the variables directly instead.
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor Agent CLI 2026.09.28-64d2043
Agent-Model: auto
Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/orch-ibmtk/jobs/5118-cursor/log.txt on amdci2.julia.csail.mit.edu
Covers matching units constructing a system and mismatched units rejecting validation (SciML#5118). Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI 2026.09.28-64d2043 Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/orch-ibmtk/jobs/5118-cursor/log.txt on amdci2.julia.csail.mit.edu
AayushSabharwal
approved these changes
Oct 6, 2026
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.
Please ignore until reviewed by @ChrisRackauckas.
Summary
MTK._validate(conn::Connection)inMTKDynamicQuantitiesExtassumed every connection payload was a vector of systems and calledunknownson each element. Causal variableconnect(a.y, b.u)stores aVector{SymbolicT}, which triggeredMethodError: unknowns(::BasicSymbolic). This adds a branch viais_causal_variable_connectionthat compares connected variables' units withsafe_get_unit/equivalent, and regression tests indq_units.jl.Fixes #5118
Fail before / pass after
Negative control (src fix reverted; same
scratch/test_5118.jl):Positive control (fix restored):
(exit 0; mismatched V↔A connection warns and throws
ValidationErroras expected)Verification
InterfaceI tail:
Runic
--checkandtyposclean on the two touched files.What was NOT verified
GROUP=All/ other test groups (InterfaceII, Initialization, Extensions, …)ModelingToolkitpackage testsmulticonnect: graph-based connections over node arrays #5117 (multiconnect); that PR was left alone as requestedRisk assessment
Vector{SymbolicT}connections; connector-system path unchangedconnectdq_units.jl; InterfaceI greenmulticonnect: graph-based connections over node arrays #5117 must keep this branch when it lands.Please ignore this draft until reviewed by @ChrisRackauckas.
Harness: Cursor Agent CLI 2026.09.28-64d2043 | Model: auto | Transcript: /home/crackauc/sandbox/goals/issue-backlog/orch-ibmtk/jobs/5118-cursor/log.txt on amdci2.julia.csail.mit.edu
Head orchestration and review routing: Claude Code (model: claude-opus-5-5[1m]), https://claude.ai/code/session_01H4fXBChQshAwfpLMCpEvAX