Fix SciCompDSL model macro hygiene - #5058
Conversation
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://chatgpt.com/codex/tasks/01a03a17-ad6f-7131-82fc-d0fd57ea6512
|
A second clean docs build reached
No doctest, example, cross-reference, or document-check failure was reported before link checking. I am not rerunning the same external network checks a third time. The failing Optimization CI lanes are the already-reproduced clean-master CasADi 1.3.0 regression, not this SciCompDSL-only diff. The merged CasADi source fix and fully green release draft are at SciML/CasADi.jl#44; current ModelingToolkit master failure evidence is https://github.com/SciML/ModelingToolkit.jl/actions/runs/33444273161/job/99660311800. I am independently reproducing the downgrade-MTKBase QA lane on the unchanged current master tree before classifying that remaining failure. https://chatgpt.com/codex/tasks/01a03a17-ad6f-7131-82fc-d0fd57ea6512 |
Summary
SciCompDSL's
@mtkmodelexpansion emitted unqualified names from its own implementation into the caller module. A caller that imported only SciCompDSL therefore failed unless it happened to bind ModelingToolkitBase, Equation, Num, and setmetadata under the expected names.This captures those owner-module bindings when the macro expands and adds a caller-hygiene regression covering an empty model, equations/defaults, and custom model metadata. No public API is added or changed.
Please ignore this draft until it has been reviewed by @ChrisRackauckas.
Failing before / passing after
I ran the new test against the unfixed source, then restored the source change and ran the identical test:
With this commit:
The test imports SciCompDSL and selected public ModelingToolkitBase names, but deliberately does not bind the ModelingToolkitBase module name.
Verification
Observed locally with Julia 1.12.7:
The full docs build completed the examples and document checks, then failed during final link checking because this unchanged external URL did not answer within the configured 10 seconds:
A retry is running; this change does not touch docs, docstrings, or public API.
Review notes
The interpolated bindings are public/exported from their owning modules. The change does not reach through a re-exporter and does not add a dependency.
🤖 Generated with Claude Code
https://chatgpt.com/codex/tasks/01a03a17-ad6f-7131-82fc-d0fd57ea6512