Skip to content

Define the independent variable in the motor test#483

Merged
ChrisRackauckas merged 2 commits into
SciML:mainfrom
ChrisRackauckas-Claude:agent/fix-downgrade-dynamicquantities
Jul 13, 2026
Merged

Define the independent variable in the motor test#483
ChrisRackauckas merged 2 commits into
SciML:mainfrom
ChrisRackauckas-Claude:agent/fix-downgrade-dynamicquantities

Conversation

@ChrisRackauckas-Claude

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

Copy link
Copy Markdown
Member

Please ignore this PR until it has been reviewed by @ChrisRackauckas.

Summary

  • define the thermal motor test independent variable with the documented public @independent_variables macro
  • import that macro directly from its declaring owner, ModelingToolkitBase, instead of relying on a ModelingToolkit re-export
  • avoid the implicit SciCompDSL fallback for t, which is a PleaseImportDynamicQuantities sentinel when DynamicQuantities is absent from the minimum dependency environment
  • keep the change limited to the standalone test; runtime code and dependencies are unchanged

Final head: 015b399e, based on upstream d0243bd3.

Root cause

The motor test was the only top-level test using @mtkmodel without defining or importing t. SciCompDSL therefore fell back to ModelingToolkitBase.t. With ModelingToolkit 11.2.0, ModelingToolkitBase 1.0.0, and SciCompDSL 1.0.1, that fallback is ModelingToolkitBase.PleaseImportDynamicQuantities() unless the DynamicQuantities extension is loaded, and @mtkcompile motor = ThermalMotor() fails in _check_if_dde.

A source-history bisect isolated the DynamicQuantities extension boundary:

  • first sentinel commit: 2785a86207f9d96fbe4f9395a4346228a43e8dd3 (refactor: move DynamicQuantities to extension)
  • parent: ce0436f48c25553bcaa3b6bcd6421d1095e98bd1 (refactor: move DiffEqNoiseProcess to extension)

The historical parent cannot currently be instantiated from the registry because its intermediate SymbolicUtils 4 / Symbolics 6 constraints are unsatisfiable. The released failing dependency stack above was reproduced directly.

@independent_variables is exported by its owner ModelingToolkitBase, has an owner docstring in lib/ModelingToolkitBase/src/independent_variables.jl, and is included in the rendered API reference. ModelingToolkitBase is already a direct dependency of this package.

Local verification

  • exact minimum stack before this change: reproduced _check_if_dde(::Vector{Equation}, ::ModelingToolkitBase.PleaseImportDynamicQuantities, ::Vector{System})
  • final exact minimum stack after the explicit owner import, with OrdinaryDiffEq preloaded as in native tests: Thermal Motor Demo | Pass 6 / Total 6 (143.3 s, including first-use work)
  • final current stack after the explicit owner import: Thermal Motor Demo | Pass 6 / Total 6 (137.0 s, including first-use work)
  • GROUP=Core on current upstream passed through Core/isothermal_compressible.jl (27/27), then stopped at the separately audited exact-equality assertion in test/magnetic.jl:66 (2 passed, 1 failed), before reaching motor; the focused runs above execute motor end-to-end
  • repository-wide Julia Runic check: exit 0 across all 81 tracked Julia files
  • git diff --check: exit 0

No test is skipped, disabled, loosened, or made warn-only by this PR.

Independent minimum-compatibility blocker

On current upstream, the downgrade workflow reaches an earlier ModelingToolkitBase 1.0 array-codegen failure in test/continuous.jl before motor. Focused draft #482 raises the ModelingToolkitBase floor to 1.1 and validates continuous 76/76. That independent fix is deliberately not duplicated here; the exact minimum-stack focused motor run above verifies this PR's test after preloading the native solver stack.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Investigation scratchpad

  1. Synced the fork and branched from clean upstream d0243bd36ca2751c983bb49eddb837aeb7583dbe.
  2. Ran the downgrade action logic locally. The current action selected ModelingToolkit 11.0.0 / ModelingToolkitBase 1.0.0 / SciCompDSL 1.0.0, so I also constructed the specifically reported ModelingToolkit 11.2.0 / ModelingToolkitBase 1.0.0 / SciCompDSL 1.0.1 environment.
  3. Reproduced the failure at @mtkcompile motor = ThermalMotor() with _check_if_dde(..., ModelingToolkitBase.PleaseImportDynamicQuantities, ...).
  4. Traced the fallback through SciCompDSL: because the test had no caller binding for t, model parsing selected ModelingToolkitBase.t, which is the extension sentinel in this dependency generation.
  5. Source-history bisection isolated 2785a86207f9d96fbe4f9395a4346228a43e8dd3 as the first commit introducing this sentinel behavior, with parent ce0436f48c25553bcaa3b6bcd6421d1095e98bd1. The parent environment cannot currently resolve because the historical SymbolicUtils 4 / Symbolics 6 combination is unsatisfiable against current registry metadata.
  6. Audited two candidate fixes. ModelingToolkitBase.t_nounits is marked public but lacks an owner binding docstring at version 1.0.0, so I did not add a downstream dependency on it. The selected @independent_variables t macro is exported, owner-documented, rendered in the API docs, and passed the exact stack end to end.
  7. Verified exact stack 6/6, current stack 6/6, and Runic 81/81. Native Core stopped before motor at the existing magnetic exact-equality failure at test/magnetic.jl:66; no test was disabled, silenced, or loosened.
  8. Committed only test/motor.jl as 8421d9e6948ed2215a851425ab6ea73464d820dd with the required co-author trailer.

Depend directly on ModelingToolkitBase public API instead of receiving the macro through ModelingToolkit re-export.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

API-source follow-up at 015b399e:

  • explicitly imported @independent_variables from its declaring/public/documented owner, ModelingToolkitBase, instead of relying on ModelingToolkit's re-export
  • reran the exact MTK 11.2.0 / MTKBase 1.0.0 / SciCompDSL 1.0.1 motor stack: 6/6 passed
  • reran the current dependency stack: 6/6 passed
  • reran repository-wide Julia Runic: exit 0 across all 81 tracked Julia files
  • git diff --check: exit 0
  • refetched upstream and origin before the normal push; upstream remained d0243bd3, the remote feature branch remained exactly 8421d9e6, and no contributor commits were present

The PR body and CI now point at the final head.

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

CI mapping: the downgrade failure is the already-audited ModelingToolkitBase 1.0 symbolic-array indexing defect, not the motor test change. It passes Core/analog.jl (100/100) and Core/chua_circuit.jl (1/1), then errors in StateSpace and TransferFunction with symbolic indices under Core/continuous.jl (54 pass, 2 errors). #482 raises the ModelingToolkitBase floor to 1.1 and adds the focused StateSpace regression; its exact downgraded continuous run passes 76/76. Exact #483 job

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

CI mapping for the newly completed red jobs:

Neither failure implicates this PR’s direct owner import; the exact downgraded and current motor tests both pass 6/6 locally.

@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review July 13, 2026 12:47
@ChrisRackauckas
ChrisRackauckas merged commit 933a983 into SciML:main Jul 13, 2026
5 of 11 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