Skip to content

Fix SciCompDSL model macro hygiene - #5058

Draft
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:fix/scicomputingdsl-macro-hygiene
Draft

Fix SciCompDSL model macro hygiene#5058
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:fix/scicomputingdsl-macro-hygiene

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

Summary

SciCompDSL's @mtkmodel expansion 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:

$ julia +1.12.7 --startup-file=no --project=.validation/root-env -e \
    'using Test; @testset "SciCompDSL macro hygiene" begin include("lib/SciCompDSL/test/macro_hygiene.jl") end'
ERROR: LoadError: UndefVarError: `ModelingToolkitBase` not defined in `Main`

With this commit:

Test Summary:             | Pass  Total
SciCompDSL macro hygiene  |    3      3

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:

SciCompDSL model parsing - MTKBase: 200 passed, 1 pre-existing broken
SciCompDSL model parsing - MTK:     205 passed
SciCompDSL macro hygiene:             3 passed
root QA:                              40 passed
direct SciCompDSL test runner:        passed
Runic check:                          passed
typos:                                passed
git diff --check:                     passed

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:

https://ptolemy.berkeley.edu/projects/embedded/eecsx44/lectures/Spring2013/modelica-dae-part-2.pdf
curl ... --max-time 10
ProcessExited(28)
makedocs encountered an error [:linkcheck]

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

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
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

A second clean docs build reached CrossReferences and CheckDocument again, then failed only in external link checking:

  • the unchanged Berkeley Modelica PDF timed out at curl max-time 10 (ProcessExited(28));
  • GitHub rate-limited the unchanged ColPrac README link with HTTP 429.

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

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