Make ProblemTypeCtx public API - #4842
Merged
ChrisRackauckas merged 2 commits intoJul 29, 2026
Merged
Conversation
`ProblemTypeCtx` is the documented metadata key that controls `prob.problem_type`, read by `ODEProblem` and `NonlinearProblem` construction. SciMLBase's `wrap_sol` dispatches on that value, so PDE discretization packages must set it to have their solutions wrapped in `PDETimeSeriesSolution` / `PDENoTimeSolution`. It is a cross-package protocol key, but was neither exported nor `public`, so downstream users had no non-internal way to reach it. Mark it `@public` and add it to the rendered docs. `MTKVariableTypeCtx` is already public, so this follows the existing treatment of metadata context types. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117aJvytDT3y2jMi5Ng6Q5m
ChrisRackauckas-Claude
pushed a commit
to ChrisRackauckas-Claude/PDEBase.jl
that referenced
this pull request
Jul 29, 2026
Substituting a PDEBase-owned metadata key for `ProblemTypeCtx` silently broke the MethodOfLines solution interface. `ProblemTypeCtx` is not a private helper that can be reproduced locally: ModelingToolkitBase reads it to populate `prob.problem_type`, and SciMLBase's `wrap_sol` dispatches on that value to build a `PDETimeSeriesSolution`. With a different key the metadata never reaches `problem_type`, `wrap_sol` falls through to the identity method, and a raw `ODESolution` comes back with no error at discretize or solve time, so `sol[u(t,x)]` fails. Import it from ModelingToolkitBase, the owner, rather than through the ModelingToolkit re-export. That satisfies the owner check; the remaining publicness check needs the upstream `public` declaration in SciML/ModelingToolkit.jl#4842, so keep one narrow QA ignore until that ships. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117aJvytDT3y2jMi5Ng6Q5m
This was referenced Jul 29, 2026
ChrisRackauckas
marked this pull request as ready for review
July 29, 2026 10:40
ChrisRackauckas-Claude
pushed a commit
to ChrisRackauckas-Claude/PDEBase.jl
that referenced
this pull request
Jul 29, 2026
`ProblemTypeCtx` is public as of ModelingToolkitBase 1.58.0 (SciML/ModelingToolkit.jl#4842), so PDEBase can import it from its owner with no exception. QA is now fully strict. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117aJvytDT3y2jMi5Ng6Q5m
ChrisRackauckas
added a commit
to SciML/PDEBase.jl
that referenced
this pull request
Jul 29, 2026
* Revert PDEBaseMetadataCtx back to ProblemTypeCtx Substituting a PDEBase-owned metadata key for `ProblemTypeCtx` silently broke the MethodOfLines solution interface. `ProblemTypeCtx` is not a private helper that can be reproduced locally: ModelingToolkitBase reads it to populate `prob.problem_type`, and SciMLBase's `wrap_sol` dispatches on that value to build a `PDETimeSeriesSolution`. With a different key the metadata never reaches `problem_type`, `wrap_sol` falls through to the identity method, and a raw `ODESolution` comes back with no error at discretize or solve time, so `sol[u(t,x)]` fails. Import it from ModelingToolkitBase, the owner, rather than through the ModelingToolkit re-export. That satisfies the owner check; the remaining publicness check needs the upstream `public` declaration in SciML/ModelingToolkit.jl#4842, so keep one narrow QA ignore until that ships. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117aJvytDT3y2jMi5Ng6Q5m * Require ModelingToolkitBase 1.58 and drop the last QA ignore `ProblemTypeCtx` is public as of ModelingToolkitBase 1.58.0 (SciML/ModelingToolkit.jl#4842), so PDEBase can import it from its owner with no exception. QA is now fully strict. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117aJvytDT3y2jMi5Ng6Q5m --------- Co-authored-by: ChrisRackauckas-Claude <accounts@chrisrackauckas.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Marks
ModelingToolkitBase.ProblemTypeCtxas@publicand adds it to the rendered docs.ProblemTypeCtxis already documented inlib/ModelingToolkitBase/src/systems/system.jlas the metadata key controllingproblem_type:It is read at
lib/ModelingToolkitBase/src/problems/odeproblem.jl:133andproblems/nonlinearproblem.jl:127, and the resultingprob.problem_typeis whatSciMLBase.wrap_soldispatches on (SciMLBase/src/solutions/basic_solutions.jl:195→solutions/pde_solutions.jl:160) to wrap a solve result inPDETimeSeriesSolution/PDENoTimeSolution.So it is a cross-package protocol key: PDE discretization stacks have to write it for their solutions to be wrapped correctly. But it was neither exported nor
public, so there was no non-internal way to reach it.MTKVariableTypeCtxis already@public, so this just gives the same treatment to the other metadata context type.Motivation
Found while reviewing SciML/PDEBase.jl#98. A strict-QA pass there flagged
ProblemTypeCtxas a non-public name and the workaround was to substitute a PDEBase-local key. That silently broke the MethodOfLines solution interface:prob.problem_typefell back toStandardODEProblem,wrap_solstopped producing aPDETimeSeriesSolution, andsol[u(t,x)]failed withArgumentError: Symbol u(t, x) is not present in the system— with no error at discretize or solve time. Making the key public removes the incentive to work around it.Validation
Verified locally on Julia 1.12.6:
Runic --checkclean on the changed source file. Version bumped1.57.0→1.58.0(additive public API).Ignore until reviewed by @ChrisRackauckas.
🤖 Generated with Claude Code
https://claude.ai/code/session_0117aJvytDT3y2jMi5Ng6Q5m