Skip to content

Mark ModelingToolkit's ModelingToolkitBase piracies as allowed - #4861

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:agent/aqua-piracy-mtkbase
Aug 2, 2026
Merged

Mark ModelingToolkit's ModelingToolkitBase piracies as allowed#4861
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:agent/aqua-piracy-mtkbase

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

Summary

Marks the methods ModelingToolkit defines on ModelingToolkitBase's types as allowed in Aqua's piracy check, taking Aqua.test_piracies(ModelingToolkit) from 35 reported methods to zero.

ModelingToolkit is the upper half of ModelingToolkitBase: the two are one library split across a monorepo boundary, with the compilation and problem-construction layer here dispatching on the system and operator types defined below it. Those methods are extensions of the pair's own API, not piracy.

Passed to Aqua via treat_as_own:

  • ModelingToolkitBase typesSystem, Sample, SampleTime, Hold, ShiftIndex (all exported by ModelingToolkitBase). These account for 33 of the 35.
  • Structural typesModelingToolkitTearing.TearingState and StateSelection.DiffGraph, covering the two one-line forwarding shims that wire the structural-transformation stack to ModelingToolkitBase's hooks (MTKBase.complete(::DiffGraph) in src/ModelingToolkit.jl and MTKBase.singular_check(::TearingState) in src/initialization.jl).

The change is purely additive: 34 lines across test/qa/qa.jl and test/qa/Project.toml, no deletions, no existing check weakened or skipped.

Verification

Run locally on Julia 1.11 in an isolated depot, comparing this branch against its merge base (b3ff68bf3):

Check master this branch
Aqua: Piracy Fail — 35 methods Pass
Aqua: ambiguity / unbound / exports / extras / stale / compat / persistent pass pass
ExplicitImports (6 sub-checks) 6 errors 6 errors
JET fail fail
Public API documentation 2 pass 2 pass
No unapproved public reexports fail fail
Totals 12 Pass / 3 Fail / 6 Error 13 Pass / 2 Fail / 6 Error

Exactly one check changes, in the right direction. Confirmed both by running test/qa/qa.jl directly and through the real harness (GROUP=QA julia --project -e 'using Pkg; Pkg.test()'), which also exercises the new test/qa/Project.toml deps and the ModelingToolkitBase [sources] entry via activate_group_env:

  Extensions loaded  |    4                   4
  Quality Assurance  |   13     2      6     21
    Piracy           |    1                   1

Runic reports both changed files already formatted.

Notes

  • The QA job will still be red. ModelingToolkit's QA lane is already failing on master — the 6 ExplicitImports errors, the JET failure and the public-reexports failure all reproduce on an unmodified master checkout. This PR does not address those; it only removes the piracy failure from the pile.
  • ModelingToolkitTearing.TearingState is neither exported nor declared public in ModelingToolkitTearing, so it has to be reached by qualified access here. src/ModelingToolkit.jl already imports it that way, so this is not a new dependency on a non-public name, but promoting it to public API in ModelingToolkitTearing would be the cleaner fix.
  • Split out of Adopt SciMLTesting 2.4 strict QA #4832, which additionally removes several QA waivers and is blocked on upstream Symbolics/SymbolicUtils public-API work. This piece stands alone.

Please ignore until reviewed by @ChrisRackauckas.

🤖 Generated with Claude Code

https://claude.ai/code/session_019ywCW8vbGoc9X3dUbmXyme

ModelingToolkit is the upper half of ModelingToolkitBase: the two are one library
split across a monorepo boundary, so the methods ModelingToolkit adds to `System`,
`Sample`, `SampleTime`, `Hold` and `ShiftIndex` are extensions of the pair's own
API rather than piracy. Pass those types to Aqua via `treat_as_own`, along with
`TearingState` and `DiffGraph` for the forwarding shims that wire the
structural-transformation stack to ModelingToolkitBase's hooks.

This takes Aqua's piracy check from 35 reported methods to zero. No other QA
check changes.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ywCW8vbGoc9X3dUbmXyme
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review August 2, 2026 11:44
@ChrisRackauckas
ChrisRackauckas merged commit a3970fd into SciML:master Aug 2, 2026
56 of 64 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.

3 participants