Skip to content

qa: import names through owning modules in ModelingToolkitBase - #4989

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:mtkbase-import-hygiene
Aug 18, 2026
Merged

qa: import names through owning modules in ModelingToolkitBase#4989
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:mtkbase-import-hygiene

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

What and why

lib/ModelingToolkitBase still used the blanket-using import style that src/ModelingToolkit.jl was already migrated away from, so all six of its ExplicitImports checks errored, and its re-export check had no approved list. This is the debt explicitly deferred in #4934 ("The full strict QA still has separate baseline JET, ExplicitImports, and unapproved-reexport debt. This PR does not suppress or allowlist those failures.").

What was wrong, concretely:

  • 200 implicitly-imported names (bare using SciMLBase, using LinearAlgebra, using Graphs, …)
  • 42 stale explicit imports (Chain/Postwalk/Prewalk/Fixpoint, BuildTargets/JuliaTarget, gradient/hessian/derivative/sparsehessian, Base: RefValue, ADTypes: AutoForwardDiff, …)
  • 8 explicit imports and 13 qualified accesses reaching a name through a re-exporter rather than its owner
  • the _EvalModuleOpt* submodules implicitly importing RuntimeGeneratedFunctions
  • Moshi @data-generated submodules (MissingGuessValue, StructuralHint) being unanalyzable
  • public_reexports reporting all 145 externally-owned public names, because run_qa was called without reexports_allow

This imports each name from the module that defines it, deletes the stale ones, and adds the curated lists that test/qa/qa.jl already carries for ModelingToolkit — NONPUBLIC_EXPLICIT_IMPORTS (27), NONPUBLIC_QUALIFIED_ACCESSES (96), REEXPORTED_API (145), and allow_unanalyzable for the two Moshi modules. No check is disabled and no wildcard is used; every entry names something genuinely owned elsewhere.

Dependency changes

TermInterface, StaticArraysCore and IntervalSets become direct deps of ModelingToolkitBase, since they own names it already uses (maketerm/metadata, SVector/MVector, endpoints) that were previously reached through re-exporters. All three were already transitive dependencies, and all three are MIT — same as ModelingToolkitBase — so this adds no new licensing surface.

ADTypes moves from [deps] to test-only: its source use was dead, and leaving it in [deps] would fail Aqua's stale-dependency check.

Verification

check result
GROUP=QA (ModelingToolkitBase) ExplicitImports 6/6 pass, re-exports pass
GROUP=InterfaceI (ModelingToolkitBase) InterfaceI | 1599 pass, 5 broken, 1604 total — passed
GROUP=QA (umbrella ModelingToolkit) QA | 52 pass, 52 total — passed; exercises @import_mtkbase, which pulls in every MTKBase name
load + build a problem using ModelingToolkit, @mtkcompile, ODEProblemu0 = [1.0]
runic --check over lib/, src/, test/ exit 0
typos exit 0

The QA group goes from 13 pass / 2 fail / 6 error to 20 pass / 1 fail / 0 error.

This does NOT make the QA job green — the JET lane still fails

The one remaining failure is JET-test failed, ═════ 263 possible errors found ═════. It is unchanged by this PR: the findings were extracted before and after, gensym counters normalised, and the diff is empty (263 lines either way).

Of the 263, 249 are local variable ##And#NNN#f#1 may be undefined / ##Call#NNN#... — JET's typo mode misreading the short-circuit guards that Moshi.Match.@match lowers to, the same class already tracked in #4958, JuliaLang/julia#62745 and aviatesk/JET.jl#858. The remaining 14 are is not defined findings that look genuine and are separate bugs (convert_system ×2, get_parameter_dependencies, ModelingtoolkitizeParametersNotSupportedError, field accesses .v/.sz/.s/.new/.expr, locals newbuf ×3, dsti, buffer).

test/qa/qa.jl already sets jet = false for ModelingToolkit with a comment citing those three issues. Applying the same treatment to lib/ModelingToolkitBase/test/qa/aqua.jl would be a one-line change — but that is disabling a failing check, so I have deliberately not done it. Whether to mirror that precedent here is a maintainer call, and the 14 real findings probably deserve their own issue either way.

Scope

Deliberately kept to import hygiene and the QA lists — no behavior changes. Split out of #4983, where these failures surfaced, so that a mechanical sweep does not ride along with a behavior change.

Not verified

GROUP=InterfaceII, the docs build, downstream and downgrade lanes, and non-Linux or non-1.12 Julia versions were not run locally.


Please ignore until reviewed by @ChrisRackauckas.

ModelingToolkitBase still used the blanket-`using` import style that the
umbrella package was already migrated away from, so its ExplicitImports checks
errored: 200 implicit imports, 42 stale explicit imports, and a number of names
reached through a re-exporter rather than their owner.

Import each name from the module that defines it, drop the stale ones, and add
the curated non-public and re-export lists that `test/qa/qa.jl` already carries
for ModelingToolkit. `TermInterface`, `StaticArraysCore` and `IntervalSets`
become direct dependencies since they own names already in use; all three were
already transitive and are MIT. `ADTypes` moves to test-only, its source use
having been dead.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review August 18, 2026 08:00
@ChrisRackauckas
ChrisRackauckas merged commit 63f684c into SciML:master Aug 18, 2026
65 of 93 checks passed
ChrisRackauckas-Claude pushed a commit to ChrisRackauckas-Claude/ModelingToolkit.jl that referenced this pull request Aug 18, 2026
SciML#4989 trimmed `hessian_sparsity`, `MultithreadedForm`, `SerialForm`, `CTarget`
and `derivative` from ModelingToolkitBase's Symbolics import list, as
ExplicitImports reported them unused in `src`. They were still reached as
`ModelingToolkitBase.<name>` from tests, and none is exported by Symbolics, so
the re-export does not cover them. That broke InterfaceII and Extended.

Reference them through Symbolics, which owns them.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
ChrisRackauckas added a commit that referenced this pull request Aug 18, 2026
#4989 trimmed `hessian_sparsity`, `MultithreadedForm`, `SerialForm`, `CTarget`
and `derivative` from ModelingToolkitBase's Symbolics import list, as
ExplicitImports reported them unused in `src`. They were still reached as
`ModelingToolkitBase.<name>` from tests, and none is exported by Symbolics, so
the re-export does not cover them. That broke InterfaceII and Extended.

Reference them through Symbolics, which owns them.

Co-authored-by: ChrisRackauckas-Claude <accounts@chrisrackauckas.com>
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