Skip to content

Fix QA: approve the limited/constraints_to_penalties API additions - #5116

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:qa-limited-explicit-imports
Sep 12, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:qa-limited-explicit-imports

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

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

What changed and why

tests / QA (julia 1, ubuntu-latest) is red on master. Three recently merged PRs widened ModelingToolkit's API surface without updating the two version-controlled audit lists in test/qa/qa.jl — which is exactly what those lists exist to catch ("a dependency adding a new public name fails this test instead of silently widening ModelingToolkit's API").

Two assertions fail, with two different root causes:

  1. all_qualified_accesses_are_public — LimitedCtx, apply_limited_lowering, attach_stage_limiters. These are MTK↔MTKBase shared implementation seams: a metadata registry key the compiler populates (never something a user sets) and two lowering entry points. They are the direct analogues of lower_homotopy and has_any_homotopy from the homotopy operator, which already sit in NONPUBLIC_QUALIFIED_ACCESSES, so they join them there. Declaring them public in ModelingToolkitBase would advertise compiler internals to end users, which the comment above that list explicitly rejects as the wrong fix for this group (tracked in QA: ModelingToolkit depends on ~140 non-public names of its dependencies #4882). Note the contrast with HomotopyCtx, which is @public + documented: that one is a user-settable toggle, LimitedCtx is a generated registry.

  2. No unapproved public reexports — constraints_to_penalties, limited, limitnew, limitold. Different cause: these are genuinely new public, documented API of ModelingToolkitBase, with rendered @docs entries already in place (docs/src/basics/Limiting.md lines 199-203 for the three limiting names, docs/src/API/problems.md for constraints_to_penalties). Approving them in REEXPORTED_API is the intended action for that list. No docs changes are needed — the Public API documentation check passes both before and after.

Test-file-only change; no library code is touched.

Verification

All runs on this branch's checkout, Julia 1.12.7, GROUP=QA julia --project -e 'using Pkg; Pkg.test()'.

Failing before the fix (unmodified master, 887af5f455):

┌ Info: run_qa: unapproved public reexports
│   pkg = ModelingToolkit
│   reexported =
│    4-element Vector{Symbol}:
│     :constraints_to_penalties
│     :limited
│     :limitnew
└     :limitold
ERROR: LoadError: Some tests did not pass: 38 passed, 1 failed, 1 errored, 0 broken.
all_qualified_accesses_are_public: Error During Test at .../SciMLTesting.jl:1129
  Test threw exception
  Expression: check(pkg; _explicit_imports_kwargs(pkg, name, ei_kwargs)...) === nothing
  NonPublicQualifiedAccessException
  Module `ModelingToolkit` has explicit imports of names from modules in which they are not public (i.e. exported or declared public in Julia 1.11+):
  - `LimitedCtx` is not public in `ModelingToolkitBase` but it was imported from `ModelingToolkitBase` at `src/systems/solver_nlprob.jl:48:39`
  - `apply_limited_lowering` is not public in `ModelingToolkitBase` but it was imported from `ModelingToolkitBase` at `src/systems/systems.jl:12:32`
  - `attach_stage_limiters` is not public in `ModelingToolkitBase` but it was imported from `ModelingToolkitBase` at `src/systems/solver_nlprob.jl:121:21`

No unapproved public reexports: Test Failed at .../SciMLTesting.jl:965
  Expression: isempty(reexported)
   Evaluated: isempty([:constraints_to_penalties, :limited, :limitnew, :limitold])

Test Summary:                                  | Pass  Fail  Error  Total     Time
QA                                             |   38     1      1     40  5m13.4s
...
      all_qualified_accesses_are_public        |                 1      1     3.1s
    No unapproved public reexports             |          1             1     2.8s
ERROR: Package ModelingToolkit errored during testing

Passing after the fix:

Test Summary: | Pass  Total     Time
QA            |   40     40  7m54.9s
     Testing ModelingToolkit tests passed

GROUP=InterfaceI (nothing else broke; the 3 broken are pre-existing @test_broken):

Test Summary: | Pass  Broken  Total      Time
InterfaceI    | 1509       3   1512  50m48.1s
     Testing ModelingToolkit tests passed

Formatting / spelling, both clean:

$ julia -m Runic --check test/qa/qa.jl   # exit 0
$ typos test/qa/qa.jl                    # exit 0

Not verified

  • No docs build was run: the diff touches no docstring, no docs/, and no public API. The @docs entries for all four newly-approved names already exist on master and the QA Public API documentation check passes, which is what would have caught a missing one.
  • Other test groups (InterfaceII, Initialization, SymbolicIndexingInterface, Downstream, FMI, Extensions, Optimization) were not run. The change is confined to test/qa/qa.jl, which only the QA group loads.
  • Only Julia 1.12 was exercised locally; the QA matrix also runs lts. The lts half has its own extra findings (see the Iterators.map note in the file), but nothing in this diff is version-dependent.

What a reviewer should push back on

Whether LimitedCtx, apply_limited_lowering and attach_stage_limiters really belong on the ignore list rather than being promoted to public API in ModelingToolkitBase. I chose the ignore list because it is this repo's documented, exhaustive convention for MTK↔MTKBase seams and because the homotopy operator's equivalents are handled that way — but that is a judgment call about intent, and the author of #4774 may have meant LimitedCtx to be user-facing the way HomotopyCtx is. If so, the fix is a @public + docstring + @docs entry in ModelingToolkitBase instead, and I'll redo it that way.

🤖 Generated with Claude Code (model: claude-opus-5[1m])

https://claude.ai/code/session_01FeJYXni9MkJhPFA9yxYvfn

Three recently merged PRs widened ModelingToolkit's surface without updating
the two version-controlled QA audit lists in `test/qa/qa.jl`, which is what
those lists exist to catch:

- SciML#4774 (`limited` operator) exports `limited`, `limitnew`, `limitold` from
  ModelingToolkitBase and reaches for `MTKBase.LimitedCtx`,
  `MTKBase.apply_limited_lowering` and `MTKBase.attach_stage_limiters` from
  the root package.
- SciML#5111 exports `constraints_to_penalties` from ModelingToolkitBase.

The four exported names are documented public API of ModelingToolkitBase with
rendered `@docs` entries (`docs/src/basics/Limiting.md`,
`docs/src/API/problems.md`), so they are added to `REEXPORTED_API`. The three
qualified accesses are MTK/MTKBase shared implementation seams -- a metadata
registry key and two lowering entry points populated by the compiler, not
anything a user sets -- so they join `lower_homotopy` and `has_any_homotopy`,
the directly analogous names from the `homotopy` operator, in
`NONPUBLIC_QUALIFIED_ACCESSES`.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Agent-Harness: Claude Code 2.0.14
Agent-Model: claude-opus-5[1m]
Agent-Session: https://claude.ai/code/session_01FeJYXni9MkJhPFA9yxYvfn
Claude-Session: https://claude.ai/code/session_01FeJYXni9MkJhPFA9yxYvfn
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review September 12, 2026 10:46
@ChrisRackauckas
ChrisRackauckas merged commit 6bb14bb into SciML:master Sep 12, 2026
44 of 45 checks passed
ChrisRackauckas added a commit that referenced this pull request Sep 13, 2026
- Add constraints_to_penalties: lower constraints to quadratic penalty costs (#5111)
- Fix QA: approve the `limited`/`constraints_to_penalties` API additions (#5116)
- Concretize initialization problems once at construction (#5062)
- Make tovar public (#5120)
- Fix SciCompDSL model macro hygiene (#5058)
- Release ModelingToolkitBase 1.71.0 (#5126)
- Forward ProblemTypeCtx metadata to OptimizationProblem (#5115)
- Release ModelingToolkitBase 1.71.1 (#5127)



Agent-Harness: Claude Code
Agent-Model: claude-opus-5[1m]
Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.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