Skip to content

QA: ModelingToolkit depends on ~140 non-public names of its dependencies #4882

Description

@ChrisRackauckas-Claude

Tracking issue for the two remaining run_qa ExplicitImports failures on master:

  • all_explicit_imports_are_public — 53 findings
  • all_qualified_accesses_are_public — 89 findings

all_explicit_imports_via_owners and all_qualified_accesses_via_owners are fixed by #4880, which means every one of these names is already being reached through the module that defines it. There is no other module to import them from. The only real fixes are for the owner to declare the name public (with a docstring and a rendered docs entry — public and documented move together), or for ModelingToolkit to stop needing the name.

Until then they are enumerated exhaustively in NONPUBLIC_EXPLICIT_IMPORTS / NONPUBLIC_QUALIFIED_ACCESSES in test/qa/qa.jl, so reaching for a new internal fails the QA lane rather than sliding in unnoticed.

By owner

ModelingToolkitBase — 9 explicit imports, 28 qualified accesses. ModelingToolkit is the upper half of one library split across a monorepo boundary. These are the pair's shared implementation seams: codegen entry points (build_function_wrapper, BuildFunctionWrapperOptions, GeneratedFunctionOptions, torn_system_jacobian_sparsity, generate_ODENLStepData), problem-type selectors (get_nonlinear_problem_type, get_initialization_problem_type, check_compatible_system), the hashconsed COMMON_* sentinels, and the docstring templates (problem_docstring, function_docstring). They are internal to the pair, not to ModelingToolkitBase alone, so declaring them public would advertise them to end users — the opposite of what they are. Probably the right long-term answer here is not public but a documented internal-interface module.

ModelingToolkitTearing — 2 explicit imports, 16 qualified accesses. The strongest candidate for upstream promotion. TearingState in particular: ModelingToolkit exports it (src/ModelingToolkit.jl), so it is already part of ModelingToolkit's public API while being non-public at its owner. SystemStructure, ClockInference, infer_clocks!, input_timedomain/output_timedomain, split_system, StateMachineOperator are the rest.

StateSelection — 12 qualified accesses. pantelides!, check_consistency, structural_singularity_removal!, trivial_tearing!, var_derivative!, isalgvar, isdervar, is_present, is_only_discrete, get_new_mm, rm_eqs_vars!, complete!. ModelingToolkit is the only consumer of this package's index-reduction entry points; these were internal helpers when the code lived in ModelingToolkit and stayed internal when it was split out.

Symbolics — 33 explicit imports, 7 qualified accesses. The BasicSymbolic representation ModelingToolkit compiles against (SSym, STerm, SArgsT, SConst, SymbolicT, VartypeT, CallAndWrap), the codegen targets (JuliaTarget, CTarget, StanTarget, MATLABTarget, SerialForm, ParallelForm, MultithreadedForm, BuildTargets), and expression helpers (rhss, lhss, hasnode, hasderiv, exprs_occur_in, fixpoint_sub, var_from_nested_derivative, lower_varname, parse_vars, recursive_hasoperator, setdefaultval, isaffine, islinear, jacobian_sparsity, hessian_sparsity, degree, rename, _solve, @derivatives, COMMON_ZERO, DEFAULT_OUTSYM, FixpointSubstituter).

SymbolicUtils — 6 explicit imports, 20 qualified accesses. BSImpl, Operator, Term, promote_symtype, _iszero, _isone, plus the shape/metadata and IR-walking layer used by alias elimination and SCC construction: shape, ShapeVecT, is_array_shape, array_literal, ArrayMaker, RegionsT, IRSubstituter, IRStructureSearchBuffer, search_variables, search_variables!, stable_eachindex, default_is_atomic, is_function_symbolic, AddMulVariant, Unknown, hashcons, and Code.create_array / Code.with_allocator.

SciMLBase — 1 explicit import, 3 qualified accesses. handle_varmap, Void, ODENLStepData, ParamJacobianWrapper.

Moshi, OffsetArrays, Base — 3. Moshi.Match (the @match entry point), OffsetArrays.Origin (imported only to pin invalidations), and Base.RefValue, which has no public spelling at all.

Suggested order of attack

  1. ModelingToolkitTearing: make TearingState (and probably SystemStructure) public + documented. ModelingToolkit already exports TearingState, so this is fixing a real inconsistency, not paperwork.
  2. StateSelection: decide which of the twelve index-reduction entry points are a supported interface and make those public + documented.
  3. SymbolicUtils/Symbolics: the BasicSymbolic accessors (shape, SSym/STerm/SArgsT, promote_symtype, Operator, Term) are used by more than just ModelingToolkit and are the best candidates.
  4. SciMLBase: four names, all plausible public API.
  5. ModelingToolkitBase: needs a design decision (documented internal interface vs. public), not a mechanical change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions